aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/contrib/dRay
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ode-0.9/contrib/dRay')
-rw-r--r--libraries/ode-0.9/contrib/dRay/Include/dRay.h15
-rw-r--r--libraries/ode-0.9/contrib/dRay/README.txt16
-rw-r--r--libraries/ode-0.9/contrib/dRay/Test/test_ray.cpp1372
-rw-r--r--libraries/ode-0.9/contrib/dRay/dRay.cpp119
-rw-r--r--libraries/ode-0.9/contrib/dRay/dRay_Box.cpp134
-rw-r--r--libraries/ode-0.9/contrib/dRay/dRay_CCylinder.cpp199
-rw-r--r--libraries/ode-0.9/contrib/dRay/dRay_Plane.cpp35
-rw-r--r--libraries/ode-0.9/contrib/dRay/dRay_Sphere.cpp95
-rw-r--r--libraries/ode-0.9/contrib/dRay/dxRay.h32
9 files changed, 0 insertions, 2017 deletions
diff --git a/libraries/ode-0.9/contrib/dRay/Include/dRay.h b/libraries/ode-0.9/contrib/dRay/Include/dRay.h
deleted file mode 100644
index f6caea8..0000000
--- a/libraries/ode-0.9/contrib/dRay/Include/dRay.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#include "ode\ode.h"
2
3/* Class ID */
4extern int dRayClass;
5
6/* Creates a ray */
7dxGeom* dGeomCreateRay(dSpaceID space, dReal Length);
8
9/* Set/Get length */
10void dGeomRaySetLength(dxGeom* g, dReal Length);
11dReal dGeomRayGetLength(dxGeom* g);
12
13/* Utility function to override the ray's pos + rot */
14void dGeomRaySet(dxGeom* g, dVector3 Origin, dVector3 Direction);
15void dGeomRayGet(dxGeom* g, dVector3 Origin, dVector3 Direction);
diff --git a/libraries/ode-0.9/contrib/dRay/README.txt b/libraries/ode-0.9/contrib/dRay/README.txt
deleted file mode 100644
index 8997208..0000000
--- a/libraries/ode-0.9/contrib/dRay/README.txt
+++ /dev/null
@@ -1,16 +0,0 @@
1From: "Erwin de Vries" <erwin@vo.com>
2To: <ode@q12.org>
3Subject: [ODE] dRay class
4Date: Thu, 25 Jul 2002 13:05:28 +0200
5
6Yesterday and today i've written a dRay class. It interacts with dPlane,
7dSphere, dBox and dCCylinder. It does not generate full contact information.
8It only generates the pos member. I dont think its useful to anyone to go
9through hoops and find a reasonable normal and penetration depth, as i dont
10think anyone will want to use it for dynamics. Just for CD.
11
12It should compile in single and double precision mode, and should be
13platform independant. I hope.
14
15The next Tri-Collider release using Opcode 1.1 will also implement a ray
16collision function along with some other not too interesting improvements.
diff --git a/libraries/ode-0.9/contrib/dRay/Test/test_ray.cpp b/libraries/ode-0.9/contrib/dRay/Test/test_ray.cpp
deleted file mode 100644
index faa8b14..0000000
--- a/libraries/ode-0.9/contrib/dRay/Test/test_ray.cpp
+++ /dev/null
@@ -1,1372 +0,0 @@
1/*************************************************************************
2
3
4 * *
5
6
7 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
8
9
10 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
11
12
13 * *
14
15
16 * This library is free software; you can redistribute it and/or *
17
18
19 * modify it under the terms of EITHER: *
20
21
22 * (1) The GNU Lesser General Public License as published by the Free *
23
24
25 * Software Foundation; either version 2.1 of the License, or (at *
26
27
28 * your option) any later version. The text of the GNU Lesser *
29
30
31 * General Public License is included with this library in the *
32
33
34 * file LICENSE.TXT. *
35
36
37 * (2) The BSD-style license that is included with this library in *
38
39
40 * the file LICENSE-BSD.TXT. *
41
42
43 * *
44
45
46 * This library is distributed in the hope that it will be useful, *
47
48
49 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
50
51
52 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
53
54
55 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
56
57
58 * *
59
60
61 *************************************************************************/
62
63
64
65
66
67#include <ode/ode.h>
68
69
70#include <dRay.h>
71
72
73#include <drawstuff/drawstuff.h>
74
75
76
77
78
79#ifdef _MSC_VER
80
81
82#pragma warning(disable:4244 4305) // for VC++, no precision loss complaints
83
84
85#endif
86
87
88
89
90
91// select correct drawing functions
92
93
94
95
96
97#ifdef dDOUBLE
98
99
100#define dsDrawBox dsDrawBoxD
101
102
103#define dsDrawSphere dsDrawSphereD
104
105
106#define dsDrawCylinder dsDrawCylinderD
107
108
109#define dsDrawCappedCylinder dsDrawCappedCylinderD
110
111
112#endif
113
114
115
116
117
118
119
120
121// some constants
122
123
124
125
126
127#define NUM 20 // max number of objects
128
129
130#define DENSITY (5.0) // density of all objects
131
132
133#define GPB 3 // maximum number of geometries per body
134
135
136
137
138
139
140
141
142// dynamics and collision objects
143
144
145
146
147
148struct MyObject {
149
150
151 dBodyID body; // the body
152
153
154 dGeomID geom[GPB]; // geometries representing this body
155
156
157};
158
159
160
161
162
163static int num=0; // number of objects in simulation
164
165
166static int nextobj=0; // next object to recycle if num==NUM
167
168
169static dWorldID world;
170
171
172static dSpaceID space;
173
174
175static MyObject obj[NUM];
176
177
178static dJointGroupID contactgroup;
179
180
181static int selected = -1; // selected object
182
183
184
185
186
187static dGeomID* Rays;
188
189
190static int RayCount;
191
192
193
194
195
196// this is called by dSpaceCollide when two objects in space are
197
198
199// potentially colliding.
200
201
202
203
204
205static void nearCallback (void *data, dGeomID o1, dGeomID o2)
206
207
208{
209
210
211 int i;
212
213
214 // if (o1->body && o2->body) return;
215
216
217
218
219
220 // exit without doing anything if the two bodies are connected by a joint
221
222
223 dBodyID b1 = dGeomGetBody(o1);
224
225
226 dBodyID b2 = dGeomGetBody(o2);
227
228
229 if (b1 && b2 && dAreConnected (b1,b2)) return;
230
231
232
233
234
235 dContact contact[32]; // up to 3 contacts per box
236
237
238 for (i=0; i<32; i++) {
239
240
241 contact[i].surface.mode = dContactBounce; //dContactMu2;
242
243
244 contact[i].surface.mu = dInfinity;
245
246
247 contact[i].surface.mu2 = 0;
248
249
250 contact[i].surface.bounce = 0.5;
251
252
253 contact[i].surface.bounce_vel = 0.1;
254
255
256 }
257
258
259 if (int numc = dCollide (o1,o2,3,&contact[0].geom,sizeof(dContact))) {
260
261
262 dMatrix3 RI;
263
264
265 dRSetIdentity (RI);
266
267
268 const dReal ss[3] = {0.02,0.02,0.02};
269
270
271 for (i=0; i<numc; i++) {
272
273
274 if (dGeomGetClass(o1) == dRayClass || dGeomGetClass(o2) == dRayClass){
275
276
277 dMatrix3 Rotation;
278
279
280 dRSetIdentity(Rotation);
281
282
283 dsDrawSphere(contact[i].geom.pos, Rotation, REAL(0.01));
284
285
286 continue;
287
288
289 }
290
291
292
293
294
295 dJointID c = dJointCreateContact (world,contactgroup,contact+i);
296
297
298 dJointAttach (c,b1,b2);
299
300
301 //dsDrawBox (contact[i].geom.pos,RI,ss);
302
303
304
305
306
307
308
309
310 }
311
312
313 }
314
315
316}
317
318
319
320
321
322// start simulation - set viewpoint
323
324
325
326
327
328static void start()
329
330
331{
332
333
334 static float xyz[3] = {2.1640f,-1.3079f,1.7600f};
335
336
337 static float hpr[3] = {125.5000f,-17.0000f,0.0000f};
338
339
340 dsSetViewpoint (xyz,hpr);
341
342
343 printf ("To drop another object, press:\n");
344
345
346 printf (" b for box.\n");
347
348
349 printf (" s for sphere.\n");
350
351
352 printf (" c for cylinder.\n");
353
354
355 printf (" x for a composite object.\n");
356
357
358 printf ("To select an object, press space.\n");
359
360
361 printf ("To disable the selected object, press d.\n");
362
363
364 printf ("To enable the selected object, press e.\n");
365
366
367}
368
369
370
371
372
373
374
375
376char locase (char c)
377
378
379{
380
381
382 if (c >= 'A' && c <= 'Z') return c - ('a'-'A');
383
384
385 else return c;
386
387
388}
389
390
391
392
393
394
395
396
397// called when a key pressed
398
399
400
401
402
403static void command (int cmd)
404
405
406{
407
408
409 int i,j,k;
410
411
412 dReal sides[3];
413
414
415 dMass m;
416
417
418
419
420
421 cmd = locase (cmd);
422
423
424 if (cmd == 'b' || cmd == 's' || cmd == 'c' || cmd == 'x') {
425
426
427 if (num < NUM) {
428
429
430 i = num;
431
432
433 num++;
434
435
436 }
437
438
439 else {
440
441
442 i = nextobj;
443
444
445 nextobj++;
446
447
448 if (nextobj >= num) nextobj = 0;
449
450
451
452
453
454 // destroy the body and geoms for slot i
455
456
457 dBodyDestroy (obj[i].body);
458
459
460 for (k=0; k < GPB; k++) {
461
462
463 if (obj[i].geom[k]) dGeomDestroy (obj[i].geom[k]);
464
465
466 }
467
468
469 memset (&obj[i],0,sizeof(obj[i]));
470
471
472 }
473
474
475
476
477
478 obj[i].body = dBodyCreate (world);
479
480
481 for (k=0; k<3; k++) sides[k] = dRandReal()*0.5+0.1;
482
483
484
485
486
487 dBodySetPosition (obj[i].body,
488
489
490 dRandReal()*2-1,dRandReal()*2-1,dRandReal()+1);
491
492
493 dMatrix3 R;
494
495
496 dRFromAxisAndAngle (R,dRandReal()*2.0-1.0,dRandReal()*2.0-1.0,
497
498
499 dRandReal()*2.0-1.0,dRandReal()*10.0-5.0);
500
501
502 dBodySetRotation (obj[i].body,R);
503
504
505 dBodySetData (obj[i].body,(void*) i);
506
507
508
509
510
511 if (cmd == 'b') {
512
513
514 dMassSetBox (&m,DENSITY,sides[0],sides[1],sides[2]);
515
516
517 obj[i].geom[0] = dCreateBox (space,sides[0],sides[1],sides[2]);
518
519
520 }
521
522
523 else if (cmd == 'c') {
524
525
526 sides[0] *= 0.5;
527
528
529 dMassSetCappedCylinder (&m,DENSITY,3,sides[0],sides[1]);
530
531
532 obj[i].geom[0] = dCreateCCylinder (space,sides[0],sides[1]);
533
534
535 }
536
537
538 else if (cmd == 's') {
539
540
541 sides[0] *= 0.5;
542
543
544 dMassSetSphere (&m,DENSITY,sides[0]);
545
546
547 obj[i].geom[0] = dCreateSphere (space,sides[0]);
548
549
550 }
551
552
553 else if (cmd == 'x') {
554
555
556 dGeomID g2[GPB]; // encapsulated geometries
557
558
559 dReal dpos[GPB][3]; // delta-positions for encapsulated geometries
560
561
562
563
564
565 // start accumulating masses for the encapsulated geometries
566
567
568 dMass m2;
569
570
571 dMassSetZero (&m);
572
573
574
575
576
577 // set random delta positions
578
579
580 for (j=0; j<GPB; j++) {
581
582
583 for (k=0; k<3; k++) dpos[j][k] = dRandReal()*0.3-0.15;
584
585
586 }
587
588
589
590
591
592 for (k=0; k<3; k++) {
593
594
595 obj[i].geom[k] = dCreateGeomTransform (space);
596
597
598 dGeomTransformSetCleanup (obj[i].geom[k],1);
599
600
601 if (k==0) {
602
603
604 dReal radius = dRandReal()*0.25+0.05;
605
606
607 g2[k] = dCreateSphere (0,radius);
608
609
610 dMassSetSphere (&m2,DENSITY,radius);
611
612
613 }
614
615
616 else if (k==1) {
617
618
619 g2[k] = dCreateBox (0,sides[0],sides[1],sides[2]);
620
621
622 dMassSetBox (&m2,DENSITY,sides[0],sides[1],sides[2]);
623
624
625 }
626
627
628 else {
629
630
631 dReal radius = dRandReal()*0.1+0.05;
632
633
634 dReal length = dRandReal()*1.0+0.1;
635
636
637 g2[k] = dCreateCCylinder (0,radius,length);
638
639
640 dMassSetCappedCylinder (&m2,DENSITY,3,radius,length);
641
642
643 }
644
645
646 dGeomTransformSetGeom (obj[i].geom[k],g2[k]);
647
648
649
650
651
652 // set the transformation (adjust the mass too)
653
654
655 dGeomSetPosition (g2[k],dpos[k][0],dpos[k][1],dpos[k][2]);
656
657
658 dMassTranslate (&m2,dpos[k][0],dpos[k][1],dpos[k][2]);
659
660
661 dMatrix3 Rtx;
662
663
664 dRFromAxisAndAngle (Rtx,dRandReal()*2.0-1.0,dRandReal()*2.0-1.0,
665
666
667 dRandReal()*2.0-1.0,dRandReal()*10.0-5.0);
668
669
670 dGeomSetRotation (g2[k],Rtx);
671
672
673 dMassRotate (&m2,Rtx);
674
675
676
677
678
679 // add to the total mass
680
681
682 dMassAdd (&m,&m2);
683
684
685 }
686
687
688
689
690
691 // move all encapsulated objects so that the center of mass is (0,0,0)
692
693
694 for (k=0; k<2; k++) {
695
696
697 dGeomSetPosition (g2[k],
698
699
700 dpos[k][0]-m.c[0],
701
702
703 dpos[k][1]-m.c[1],
704
705
706 dpos[k][2]-m.c[2]);
707
708
709 }
710
711
712 dMassTranslate (&m,-m.c[0],-m.c[1],-m.c[2]);
713
714
715 }
716
717
718
719
720
721 for (k=0; k < GPB; k++) {
722
723
724 if (obj[i].geom[k]) dGeomSetBody (obj[i].geom[k],obj[i].body);
725
726
727 }
728
729
730
731
732
733 dBodySetMass (obj[i].body,&m);
734
735
736 }
737
738
739
740
741
742 if (cmd == ' ') {
743
744
745 selected++;
746
747
748 if (selected >= num) selected = 0;
749
750
751 if (selected < 0) selected = 0;
752
753
754 }
755
756
757 else if (cmd == 'd' && selected >= 0 && selected < num) {
758
759
760 dBodyDisable (obj[selected].body);
761
762
763 }
764
765
766 else if (cmd == 'e' && selected >= 0 && selected < num) {
767
768
769 dBodyEnable (obj[selected].body);
770
771
772 }
773
774
775}
776
777
778
779
780
781
782
783
784// draw a geom
785
786
787
788
789
790void drawGeom (dGeomID g, const dReal *pos, const dReal *R)
791
792
793{
794
795
796 if (!g) return;
797
798
799 if (!pos) pos = dGeomGetPosition (g);
800
801
802 if (!R) R = dGeomGetRotation (g);
803
804
805
806
807
808 int type = dGeomGetClass (g);
809
810
811 if (type == dBoxClass) {
812
813
814 dVector3 sides;
815
816
817 dGeomBoxGetLengths (g,sides);
818
819
820 dsDrawBox (pos,R,sides);
821
822
823 }
824
825
826 else if (type == dSphereClass) {
827
828
829 dsDrawSphere (pos,R,dGeomSphereGetRadius (g));
830
831
832 }
833
834
835 else if (type == dCCylinderClass) {
836
837
838 dReal radius,length;
839
840
841 dGeomCCylinderGetParams (g,&radius,&length);
842
843
844 dsDrawCappedCylinder (pos,R,length,radius);
845
846
847 }
848
849
850 else if (type == dGeomTransformClass) {
851
852
853 dGeomID g2 = dGeomTransformGetGeom (g);
854
855
856 const dReal *pos2 = dGeomGetPosition (g2);
857
858
859 const dReal *R2 = dGeomGetRotation (g2);
860
861
862 dVector3 actual_pos;
863
864
865 dMatrix3 actual_R;
866
867
868 dMULTIPLY0_331 (actual_pos,R,pos2);
869
870
871 actual_pos[0] += pos[0];
872
873
874 actual_pos[1] += pos[1];
875
876
877 actual_pos[2] += pos[2];
878
879
880 dMULTIPLY0_333 (actual_R,R,R2);
881
882
883 drawGeom (g2,actual_pos,actual_R);
884
885
886 }
887
888
889}
890
891
892
893
894
895
896
897
898// simulation loop
899
900
901
902
903
904static void simLoop (int pause)
905
906
907{
908
909
910 dsSetColor (0,0,2);
911
912
913 dSpaceCollide (space,0,&nearCallback);
914
915
916 if (!pause) dWorldStep (world,0.05);
917
918
919
920
921
922 // remove all contact joints
923
924
925 dJointGroupEmpty (contactgroup);
926
927
928
929
930
931 dsSetColor (1,1,0);
932
933
934 dsSetTexture (DS_WOOD);
935
936
937 for (int i=0; i<num; i++) {
938
939
940 int color_changed = 0;
941
942
943 if (i==selected) {
944
945
946 dsSetColor (0,0.7,1);
947
948
949 color_changed = 1;
950
951
952 }
953
954
955 else if (! dBodyIsEnabled (obj[i].body)) {
956
957
958 dsSetColor (1,0,0);
959
960
961 color_changed = 1;
962
963
964 }
965
966
967 for (int j=0; j < GPB; j++) drawGeom (obj[i].geom[j],0,0);
968
969
970 if (color_changed) dsSetColor (1,1,0);
971
972
973 }
974
975
976
977
978
979 {for (int i = 0; i < RayCount; i++){
980
981
982 dVector3 Origin, Direction;
983
984
985 dGeomRayGet(Rays[i], Origin, Direction);
986
987
988
989
990
991 dReal Length = dGeomRayGetLength(Rays[i]);
992
993
994
995
996
997 dVector3 End;
998
999
1000 End[0] = Origin[0] + (Direction[0] * Length);
1001
1002
1003 End[1] = Origin[1] + (Direction[1] * Length);
1004
1005
1006 End[2] = Origin[2] + (Direction[2] * Length);
1007
1008
1009 End[3] = Origin[3] + (Direction[3] * Length);
1010
1011
1012
1013
1014
1015 dsDrawLine(Origin, End);
1016
1017
1018 }}
1019
1020
1021}
1022
1023
1024
1025
1026
1027
1028
1029
1030int main (int argc, char **argv)
1031
1032
1033{
1034
1035
1036 // setup pointers to drawstuff callback functions
1037
1038
1039 dsFunctions fn;
1040
1041
1042 fn.version = DS_VERSION;
1043
1044
1045 fn.start = &start;
1046
1047
1048 fn.step = &simLoop;
1049
1050
1051 fn.command = &command;
1052
1053
1054 fn.stop = 0;
1055
1056
1057 fn.path_to_textures = "../../drawstuff/textures";
1058
1059
1060 if(argc==2)
1061 {
1062 fn.path_to_textures = argv[1];
1063 }
1064
1065
1066
1067 // create world
1068
1069
1070
1071
1072
1073 world = dWorldCreate();
1074
1075
1076 space = dHashSpaceCreate();
1077
1078
1079 contactgroup = dJointGroupCreate (0);
1080
1081
1082 dWorldSetGravity (world,0,0,-0.5);
1083
1084
1085 dWorldSetCFM (world,1e-5);
1086
1087
1088 dCreatePlane (space,0,0,1,0);
1089
1090
1091 memset (obj,0,sizeof(obj));
1092
1093
1094
1095
1096
1097 dVector3 Origin, Direction;
1098
1099
1100
1101
1102
1103 RayCount = 5;
1104
1105
1106 Rays = new dGeomID[RayCount];
1107
1108
1109
1110
1111
1112 /* Ray 0 */
1113
1114
1115 Origin[0] = 1;
1116
1117
1118 Origin[1] = 1;
1119
1120
1121 Origin[2] = 1.5;
1122
1123
1124 Origin[3] = 0;
1125
1126
1127
1128
1129
1130 Direction[0] = 0.0f;
1131
1132
1133 Direction[1] = 0.0f;
1134
1135
1136 Direction[2] = -1;
1137
1138
1139 Direction[3] = 0;
1140
1141
1142
1143
1144
1145 dNormalize3(Direction);
1146
1147
1148
1149
1150
1151 Rays[0] = dGeomCreateRay(space, 5.0f);
1152
1153
1154 dGeomRaySet(Rays[0], Origin, Direction);
1155
1156
1157
1158
1159
1160 /* Ray 1 */
1161
1162
1163 Origin[0] = 0;
1164
1165
1166 Origin[1] = 10;
1167
1168
1169 Origin[2] = 0.25;
1170
1171
1172 Origin[3] = 0;
1173
1174
1175
1176
1177
1178 Direction[0] = 0.0f;
1179
1180
1181 Direction[1] = -1.0f;
1182
1183
1184 Direction[2] = 0.0f;
1185
1186
1187 Direction[3] = 0;
1188
1189
1190
1191
1192
1193 dNormalize3(Direction);
1194
1195
1196
1197
1198
1199 Rays[1] = dGeomCreateRay(space, 20.0f);
1200
1201
1202 dGeomRaySet(Rays[1], Origin, Direction);
1203
1204
1205
1206
1207
1208 /* Ray 2 */
1209
1210
1211 Origin[0] = -10;
1212
1213
1214 Origin[1] = 0;
1215
1216
1217 Origin[2] = 0.20;
1218
1219
1220 Origin[3] = 0;
1221
1222
1223
1224
1225
1226 Direction[0] = 1.0f;
1227
1228
1229 Direction[1] = 0.0f;
1230
1231
1232 Direction[2] = 0.0f;
1233
1234
1235 Direction[3] = 0;
1236
1237
1238
1239
1240
1241 dNormalize3(Direction);
1242
1243
1244
1245
1246
1247 Rays[2] = dGeomCreateRay(space, 20.0f);
1248
1249
1250 dGeomRaySet(Rays[2], Origin, Direction);
1251
1252
1253
1254
1255
1256 /* Ray 3 */
1257
1258
1259 Origin[0] = -9;
1260
1261
1262 Origin[1] = 11;
1263
1264
1265 Origin[2] = 0.15;
1266
1267
1268 Origin[3] = 0;
1269
1270
1271
1272
1273
1274 Direction[0] = 1.0f;
1275
1276
1277 Direction[1] = -1.0f;
1278
1279
1280 Direction[2] = 0.0f;
1281
1282
1283 Direction[3] = 0;
1284
1285
1286
1287
1288
1289 dNormalize3(Direction);
1290
1291
1292
1293
1294
1295 Rays[3] = dGeomCreateRay(space, 20.0f);
1296
1297
1298 dGeomRaySet(Rays[3], Origin, Direction);
1299
1300
1301
1302
1303
1304 /* Ray 4 */
1305
1306
1307 Origin[0] = -0.1;
1308
1309
1310 Origin[1] = 0.3;
1311
1312
1313 Origin[2] = 0.30;
1314
1315
1316 Origin[3] = 0;
1317
1318
1319
1320
1321
1322 Direction[0] = 0.3f;
1323
1324
1325 Direction[1] = 0.5f;
1326
1327
1328 Direction[2] = 1.0f;
1329
1330
1331 Direction[3] = 0;
1332
1333
1334
1335
1336
1337 Rays[4] = dGeomCreateRay(space, 5.0f);
1338
1339
1340 dGeomRaySet(Rays[4], Origin, Direction);
1341
1342
1343
1344
1345
1346 // run simulation
1347
1348
1349 dsSimulationLoop (argc,argv,352,288,&fn);
1350
1351
1352
1353
1354
1355 dJointGroupDestroy (contactgroup);
1356
1357
1358 dSpaceDestroy (space);
1359
1360
1361 dWorldDestroy (world);
1362
1363
1364
1365
1366
1367 return 0;
1368
1369
1370}
1371
1372
diff --git a/libraries/ode-0.9/contrib/dRay/dRay.cpp b/libraries/ode-0.9/contrib/dRay/dRay.cpp
deleted file mode 100644
index e3a426e..0000000
--- a/libraries/ode-0.9/contrib/dRay/dRay.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
1#include "Include\dRay.h"
2#include "dxRay.h"
3
4int dRayClass = -1;
5
6void dAABBRay(dxGeom* Ray, dReal AABB[6]){
7 dVector3 Start, End;
8 dGeomRayGet(Ray, Start, End);
9 dReal Length = dGeomRayGetLength(Ray);
10
11 End[0] = Start[0] + End[0] * Length;
12 End[1] = Start[1] + End[1] * Length;
13 End[2] = Start[2] + End[2] * Length;
14 End[3] = Start[3] + End[3] * Length;
15
16 if (Start[0] < End[0]){
17 AABB[0] = Start[0];
18 AABB[1] = End[0];
19 }
20 else{
21 AABB[0] = End[0];
22 AABB[1] = Start[0];
23 }
24
25 if (Start[1] < End[1]){
26 AABB[2] = Start[1];
27 AABB[3] = End[1];
28 }
29 else{
30 AABB[2] = End[1];
31 AABB[3] = Start[1];
32 }
33
34 if (Start[2] < End[2]){
35 AABB[4] = Start[2];
36 AABB[5] = End[2];
37 }
38 else{
39 AABB[4] = End[2];
40 AABB[5] = Start[2];
41 }
42 // Should we tweak the box to have a minimum size for axis aligned lines? How small should it be?
43}
44
45dColliderFn* dRayColliderFn(int num){
46 if (num == dPlaneClass) return (dColliderFn*)&dCollidePR;
47 if (num == dSphereClass) return (dColliderFn*)&dCollideSR;
48 if (num == dBoxClass) return (dColliderFn*)&dCollideBR;
49 if (num == dCCylinderClass) return (dColliderFn*)&dCollideCCR;
50 return 0;
51}
52
53dxGeom* dGeomCreateRay(dSpaceID space, dReal Length){
54 if (dRayClass == -1){
55 dGeomClass c;
56 c.bytes = sizeof(dxRay);
57 c.collider = &dRayColliderFn;
58 c.aabb = &dAABBRay;
59 c.aabb_test = 0;
60 c.dtor = 0;
61
62 dRayClass = dCreateGeomClass(&c);
63 }
64
65 dxGeom* g = dCreateGeom(dRayClass);
66 if (space) dSpaceAdd(space, g);
67
68 dGeomRaySetLength(g, Length);
69 return g;
70}
71
72void dGeomRaySetLength(dxGeom* g, dReal Length){
73 ((dxRay*)dGeomGetClassData(g))->Length = Length;
74}
75
76dReal dGeomRayGetLength(dxGeom* g){
77 return ((dxRay*)dGeomGetClassData(g))->Length;
78}
79
80void dGeomRaySet(dxGeom* g, dVector3 Origin, dVector3 Direction){
81 dGeomSetPosition(g, Origin[0], Origin[1], Origin[2]);
82
83 dVector3 Up, Right;
84 dPlaneSpace(Direction, Up, Right);
85
86 Origin[3] = Up[3] = Right[3] = REAL(0.0);
87
88 dMatrix3 Rotation;
89 Rotation[0 * 4 + 0] = Right[0];
90 Rotation[1 * 4 + 0] = Right[1];
91 Rotation[2 * 4 + 0] = Right[2];
92 Rotation[3 * 4 + 0] = Right[3];
93
94 Rotation[0 * 4 + 1] = Up[0];
95 Rotation[1 * 4 + 1] = Up[1];
96 Rotation[2 * 4 + 1] = Up[2];
97 Rotation[3 * 4 + 1] = Up[3];
98
99 Rotation[0 * 4 + 2] = Direction[0];
100 Rotation[1 * 4 + 2] = Direction[1];
101 Rotation[2 * 4 + 2] = Direction[2];
102 Rotation[3 * 4 + 2] = Direction[3];
103
104 dGeomSetRotation(g, Rotation);
105}
106
107void dGeomRayGet(dxGeom* g, dVector3 Origin, dVector3 Direction){
108 const dReal* Position = dGeomGetPosition(g);
109 Origin[0] = Position[0];
110 Origin[1] = Position[1];
111 Origin[2] = Position[2];
112 Origin[3] = Position[3];
113
114 const dReal* Rotation = dGeomGetRotation(g);
115 Direction[0] = Rotation[0 * 4 + 2];
116 Direction[1] = Rotation[1 * 4 + 2];
117 Direction[2] = Rotation[2 * 4 + 2];
118 Direction[3] = Rotation[3 * 4 + 2];
119} \ No newline at end of file
diff --git a/libraries/ode-0.9/contrib/dRay/dRay_Box.cpp b/libraries/ode-0.9/contrib/dRay/dRay_Box.cpp
deleted file mode 100644
index d2a0d9c..0000000
--- a/libraries/ode-0.9/contrib/dRay/dRay_Box.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
1// Ripped from Magic Software
2
3#include "Include\dRay.h"
4#include "dxRay.h"
5
6bool Clip(dReal Denom, dReal Numer, dReal& T0, dReal& T1){
7 // Return value is 'true' if line segment intersects the current test
8 // plane. Otherwise 'false' is returned in which case the line segment
9 // is entirely clipped.
10
11 if (Denom > REAL(0.0)){
12 if (Numer > Denom * T1){
13 return false;
14 }
15
16 if (Numer > Denom * T0){
17 T0 = Numer / Denom;
18 }
19 return true;
20 }
21 else if (Denom < REAL(0.0)){
22 if (Numer > Denom * T0){
23 return false;
24 }
25
26 if (Numer > Denom * T1){
27 T1 = Numer / Denom;
28 }
29 return true;
30 }
31 else return Numer <= REAL(0.0);
32}
33
34bool FindIntersection(const dVector3 Origin, const dVector3 Direction, const dVector3 Extents, dReal& T0, dReal& T1){
35 dReal SaveT0 = T0;
36 dReal SaveT1 = T1;
37
38 bool NotEntirelyClipped =
39 Clip(+Direction[0], -Origin[0] - Extents[0], T0, T1) &&
40 Clip(-Direction[0], +Origin[0] - Extents[0], T0, T1) &&
41 Clip(+Direction[1], -Origin[1] - Extents[1], T0, T1) &&
42 Clip(-Direction[1], +Origin[1] - Extents[1], T0, T1) &&
43 Clip(+Direction[2], -Origin[2] - Extents[2], T0, T1) &&
44 Clip(-Direction[2], +Origin[2] - Extents[2], T0, T1);
45
46 return NotEntirelyClipped && (T0 != SaveT0 || T1 != SaveT1);
47}
48
49int dCollideBR(dxGeom* RayGeom, dxGeom* BoxGeom, int Flags, dContactGeom* Contacts, int Stride){
50 const dVector3& Position = *(const dVector3*)dGeomGetPosition(BoxGeom);
51 const dMatrix3& Rotation = *(const dMatrix3*)dGeomGetRotation(BoxGeom);
52 dVector3 Extents;
53 dGeomBoxGetLengths(BoxGeom, Extents);
54 Extents[0] /= 2;
55 Extents[1] /= 2;
56 Extents[2] /= 2;
57 Extents[3] /= 2;
58
59 dVector3 Origin, Direction;
60 dGeomRayGet(RayGeom, Origin, Direction);
61 dReal Length = dGeomRayGetLength(RayGeom);
62
63 dVector3 Diff;
64 Diff[0] = Origin[0] - Position[0];
65 Diff[1] = Origin[1] - Position[1];
66 Diff[2] = Origin[2] - Position[2];
67 Diff[3] = Origin[3] - Position[3];
68
69 Direction[0] *= Length;
70 Direction[1] *= Length;
71 Direction[2] *= Length;
72 Direction[3] *= Length;
73
74 dVector3 Rot[3];
75 Decompose(Rotation, Rot);
76
77 dVector3 TransOrigin;
78 TransOrigin[0] = dDOT(Diff, Rot[0]);
79 TransOrigin[1] = dDOT(Diff, Rot[1]);
80 TransOrigin[2] = dDOT(Diff, Rot[2]);
81 TransOrigin[3] = REAL(0.0);
82
83 dVector3 TransDirection;
84 TransDirection[0] = dDOT(Direction, Rot[0]);
85 TransDirection[1] = dDOT(Direction, Rot[1]);
86 TransDirection[2] = dDOT(Direction, Rot[2]);
87 TransDirection[3] = REAL(0.0);
88
89 dReal T[2];
90 T[0] = 0.0f;
91 T[1] = dInfinity;
92
93 bool Intersect = FindIntersection(TransOrigin, TransDirection, Extents, T[0], T[1]);
94
95 if (Intersect){
96 if (T[0] > REAL(0.0)){
97 dContactGeom* Contact0 = CONTACT(Flags, Contacts, 0, Stride);
98 Contact0->pos[0] = Origin[0] + T[0] * Direction[0];
99 Contact0->pos[1] = Origin[1] + T[0] * Direction[1];
100 Contact0->pos[2] = Origin[2] + T[0] * Direction[2];
101 Contact0->pos[3] = Origin[3] + T[0] * Direction[3];
102 //Contact0->normal = 0;
103 Contact0->depth = 0.0f;
104 Contact0->g1 = RayGeom;
105 Contact0->g2 = BoxGeom;
106
107 dContactGeom* Contact1 = CONTACT(Flags, Contacts, 1, Stride);
108 Contact1->pos[0] = Origin[0] + T[1] * Direction[0];
109 Contact1->pos[1] = Origin[1] + T[1] * Direction[1];
110 Contact1->pos[2] = Origin[2] + T[1] * Direction[2];
111 Contact1->pos[3] = Origin[3] + T[1] * Direction[3];
112 //Contact1->normal = 0;
113 Contact1->depth = 0.0f;
114 Contact1->g1 = RayGeom;
115 Contact1->g2 = BoxGeom;
116
117 return 2;
118 }
119 else{
120 dContactGeom* Contact = CONTACT(Flags, Contacts, 0, Stride);
121 Contact->pos[0] = Origin[0] + T[1] * Direction[0];
122 Contact->pos[1] = Origin[1] + T[1] * Direction[1];
123 Contact->pos[2] = Origin[2] + T[1] * Direction[2];
124 Contact->pos[3] = Origin[3] + T[1] * Direction[3];
125 //Contact->normal = 0;
126 Contact->depth = 0.0f;
127 Contact->g1 = RayGeom;
128 Contact->g2 = BoxGeom;
129
130 return 1;
131 }
132 }
133 else return 0;
134} \ No newline at end of file
diff --git a/libraries/ode-0.9/contrib/dRay/dRay_CCylinder.cpp b/libraries/ode-0.9/contrib/dRay/dRay_CCylinder.cpp
deleted file mode 100644
index b9ea0c0..0000000
--- a/libraries/ode-0.9/contrib/dRay/dRay_CCylinder.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
1// Ripped from Magic Software
2
3#include "Include\dRay.h"
4#include "dxRay.h"
5
6int Find(const dVector3 Origin, dVector3 Direction, dReal Length, const dVector3 CCPos, const dMatrix3 CCRot, dReal CCRadius, dReal CCLength, dReal T[2]){
7 dVector3 U, V, W;
8 Decompose(CCRot, U, V, W);
9
10 dVector3 CCOrigin;
11 CCOrigin[0] = CCPos[0] - (W[0] * CCLength / 2);
12 CCOrigin[1] = CCPos[1] - (W[1] * CCLength / 2);
13 CCOrigin[2] = CCPos[2] - (W[2] * CCLength / 2);
14 CCOrigin[3] = CCPos[3] - (W[3] * CCLength / 2);
15
16 dVector3 D;
17 D[0] = dDOT(U, Direction);
18 D[1] = dDOT(V, Direction);
19 D[2] = dDOT(W, Direction);
20
21 dReal DMag = Length;
22 dReal InvDMag = REAL(1.0) / DMag;
23
24 dVector3 Diff;
25 Diff[0] = Origin[0] - CCOrigin[0];
26 Diff[1] = Origin[1] - CCOrigin[1];
27 Diff[2] = Origin[2] - CCOrigin[2];
28 Diff[3] = Origin[3] - CCOrigin[3];
29
30 dVector3 P;
31 P[0] = dDOT(U, Diff);
32 P[1] = dDOT(V, Diff);
33 P[2] = dDOT(W, Diff);
34
35 dReal CCRadiusSq = CCRadius * CCRadius;
36
37 dReal Epsilon = 1e-12f;
38
39 if (dFabs(D[2]) >= REAL(1.0) - Epsilon){ // line is parallel to capsule axis
40 dReal Discr = CCRadiusSq - P[0] * P[0] - P[1] * P[1];
41
42 if (Discr >= REAL(0.0)){
43 dReal Root = dSqrt(Discr);
44 T[0] = (-P[2] + Root) * InvDMag;
45 T[1] = (CCLength - P[2] + Root) * InvDMag;
46 return 2;
47 }
48 else return 0;
49 }
50
51 // test intersection with infinite cylinder
52 dReal A = D[0] * D[0] + D[1] * D[1];
53 dReal B = P[0] * D[0] + P[1] * D[1];
54 dReal C = P[0] * P[0] + P[1] * P[1] - CCRadiusSq;
55 dReal Discr = B * B - A * C;
56 if (Discr < REAL(0.0)){ // line does not intersect infinite cylinder
57 return 0;
58 }
59
60 int Count = 0;
61
62 if (Discr > REAL(0.0)){ // line intersects infinite cylinder in two places
63 dReal Root = dSqrt(Discr);
64 dReal Inv = REAL(1.0) / A;
65
66 dReal TTemp = (-B - Root) * Inv;
67
68 dReal Tmp = P[2] + TTemp * D[2];
69 if (REAL(0.0) <= Tmp && Tmp <= CCLength){
70 T[Count++] = TTemp * InvDMag;
71 }
72
73
74 TTemp = (-B + Root) * Inv;
75 Tmp = P[2] + TTemp * D[2];
76 if (REAL(0.0) <= Tmp && Tmp <= CCLength){
77 T[Count++] = TTemp * InvDMag;
78 }
79
80 if (Count == 2){ // line intersects capsule wall in two places
81 return 2;
82 }
83 }
84 else{ // line is tangent to infinite cylinder
85 dReal TTemp = -B / A;
86 dReal Tmp = P[2] + TTemp * D[2];
87 if (REAL(0.0) <= Tmp && Tmp <= CCLength){
88 T[0] = TTemp * InvDMag;
89 return 1;
90 }
91 }
92
93 // test intersection with bottom hemisphere
94 // fA = 1
95 B += P[2] * D[2];
96 C += P[2] * P[2];
97 Discr = B * B - C;
98 if (Discr > REAL(0.0)){
99 dReal Root = dSqrt(Discr);
100 dReal TTemp = -B - Root;
101 dReal Tmp = P[2] + TTemp * D[2];
102 if (Tmp <= REAL(0.0)){
103 T[Count++] = TTemp * InvDMag;
104 if (Count == 2){
105 return 2;
106 }
107 }
108
109 TTemp = -B + Root;
110 Tmp = P[2] + TTemp * D[2];
111 if (Tmp <= REAL(0.0)){
112 T[Count++] = TTemp * InvDMag;
113 if (Count == 2){
114 return 2;
115 }
116 }
117 }
118 else if (Discr == REAL(0.0)){
119 dReal TTemp = -B;
120 dReal Tmp = P[2] + TTemp * D[2];
121 if (Tmp <= REAL(0.0)){
122 T[Count++] = TTemp * InvDMag;
123 if (Count == 2){
124 return 2;
125 }
126 }
127 }
128
129 // test intersection with top hemisphere
130 // fA = 1
131 B -= D[2] * CCLength;
132 C += CCLength * (CCLength - REAL(2.0) * P[2]);
133
134 Discr = B * B - C;
135 if (Discr > REAL(0.0)){
136 dReal Root = dSqrt(Discr);
137 dReal TTemp = -B - Root;
138 dReal Tmp = P[2] + TTemp * D[2];
139 if (Tmp >= CCLength){
140
141 T[Count++] = TTemp * InvDMag;
142 if (Count == 2){
143 return 2;
144 }
145 }
146
147 TTemp = -B + Root;
148 Tmp = P[2] + TTemp * D[2];
149 if (Tmp >= CCLength){
150 T[Count++] = TTemp * InvDMag;
151 if (Count == 2){
152 return 2;
153 }
154 }
155 }
156 else if (Discr == REAL(0.0)){
157 dReal TTemp = -B;
158 dReal Tmp = P[2] + TTemp * D[2];
159 if (Tmp >= CCLength){
160 T[Count++] = TTemp * InvDMag;
161 if (Count == 2){
162 return 2;
163 }
164 }
165 }
166 return Count;
167}
168
169int dCollideCCR(dxGeom* RayGeom, dxGeom* CCGeom, int Flags, dContactGeom* Contacts, int Stride){
170 const dVector3& CCPos = *(const dVector3*)dGeomGetPosition(CCGeom);
171 const dMatrix3& CCRot = *(const dMatrix3*)dGeomGetRotation(CCGeom);
172
173 dReal CCRadius, CCLength;
174 dGeomCCylinderGetParams(CCGeom, &CCRadius, &CCLength);
175
176 dVector3 Origin, Direction;
177 dGeomRayGet(RayGeom, Origin, Direction);
178 dReal Length = dGeomRayGetLength(RayGeom);
179
180 dReal T[2];
181 int Count = Find(Origin, Direction, Length, CCPos, CCRot, CCRadius, CCLength, T);
182 int ContactCount = 0;
183 for (int i = 0; i < Count; i++){
184 if (T[i] >= 0.0){
185 dContactGeom* Contact = CONTACT(Flags, Contacts, ContactCount, Stride);
186 Contact->pos[0] = Origin[0] + T[i] * Direction[0] * Length;
187 Contact->pos[1] = Origin[1] + T[i] * Direction[1] * Length;
188 Contact->pos[2] = Origin[2] + T[i] * Direction[2] * Length;
189 Contact->pos[3] = Origin[3] + T[i] * Direction[3] * Length;
190 //Contact->normal = 0;
191 Contact->depth = 0.0f;
192 Contact->g1 = RayGeom;
193 Contact->g2 = CCGeom;
194
195 ContactCount++;
196 }
197 }
198 return ContactCount;
199} \ No newline at end of file
diff --git a/libraries/ode-0.9/contrib/dRay/dRay_Plane.cpp b/libraries/ode-0.9/contrib/dRay/dRay_Plane.cpp
deleted file mode 100644
index cf03c5b..0000000
--- a/libraries/ode-0.9/contrib/dRay/dRay_Plane.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
1// Ripped from Paul Bourke
2
3#include "Include\dRay.h"
4#include "dxRay.h"
5
6int dCollidePR(dxGeom* RayGeom, dxGeom* PlaneGeom, int Flags, dContactGeom* Contact, int Stride){
7 dVector3 Plane;
8 dGeomPlaneGetParams(PlaneGeom, Plane);
9
10 dVector3 Origin, Direction;
11 dGeomRayGet(RayGeom, Origin, Direction);
12
13 dReal Length = dGeomRayGetLength(RayGeom);
14
15 dReal Denom = Plane[0] * Direction[0] + Plane[1] * Direction[1] + Plane[2] * Direction[2];
16 if (dFabs(Denom) < 0.00001f){
17 return 0; // Ray never hits
18 }
19
20 float T = -(Plane[3] + Plane[0] * Origin[0] + Plane[1] * Origin[1] + Plane[2] * Origin[2]) / Denom;
21
22 if (T < 0 || T > Length){
23 return 0; // Ray hits but not within boundaries
24 }
25
26 Contact->pos[0] = Origin[0] + T * Direction[0];
27 Contact->pos[1] = Origin[1] + T * Direction[1];
28 Contact->pos[2] = Origin[2] + T * Direction[2];
29 Contact->pos[3] = REAL(0.0);
30 //Contact->normal = 0;
31 Contact->depth = 0.0f;
32 Contact->g1 = RayGeom;
33 Contact->g2 = PlaneGeom;
34 return 1;
35} \ No newline at end of file
diff --git a/libraries/ode-0.9/contrib/dRay/dRay_Sphere.cpp b/libraries/ode-0.9/contrib/dRay/dRay_Sphere.cpp
deleted file mode 100644
index 8e1ac39..0000000
--- a/libraries/ode-0.9/contrib/dRay/dRay_Sphere.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
1// Ripped from Magic Software
2
3#include "Include\dRay.h"
4#include "dxRay.h"
5
6int dCollideSR(dxGeom* RayGeom, dxGeom* SphereGeom, int Flags, dContactGeom* Contacts, int Stride){
7 const dVector3& Position = *(const dVector3*)dGeomGetPosition(SphereGeom);
8 dReal Radius = dGeomSphereGetRadius(SphereGeom);
9
10 dVector3 Origin, Direction;
11 dGeomRayGet(RayGeom, Origin, Direction);
12 dReal Length = dGeomRayGetLength(RayGeom);
13
14 dVector3 Diff;
15 Diff[0] = Origin[0] - Position[0];
16 Diff[1] = Origin[1] - Position[1];
17 Diff[2] = Origin[2] - Position[2];
18 Diff[3] = Origin[3] - Position[3];
19
20 Direction[0] *= Length;
21 Direction[1] *= Length;
22 Direction[2] *= Length;
23 Direction[3] *= Length;
24
25 dReal A = Length * Length;
26 dReal B = dDOT(Diff, Direction);
27 dReal C = dDOT(Diff, Diff) - (Radius * Radius);
28
29 dReal Discr = B * B - A * C;
30 if (Discr < REAL(0.0)){
31 return 0;
32 }
33 else if (Discr > REAL(0.0)){
34 dReal T[2];
35 dReal Root = dSqrt(Discr);
36 dReal InvA = REAL(1.0) / A;
37 T[0] = (-B - Root) * InvA;
38 T[1] = (-B + Root) * InvA;
39
40 if (T[0] >= REAL(0.0)){
41 dContactGeom* Contact0 = CONTACT(Flags, Contacts, 0, Stride);
42 Contact0->pos[0] = Origin[0] + T[0] * Direction[0];
43 Contact0->pos[1] = Origin[1] + T[0] * Direction[1];
44 Contact0->pos[2] = Origin[2] + T[0] * Direction[2];
45 Contact0->pos[3] = Origin[3] + T[0] * Direction[3];
46 //Contact0->normal = 0;
47 Contact0->depth = 0.0f;
48 Contact0->g1 = RayGeom;
49 Contact0->g2 = SphereGeom;
50
51 dContactGeom* Contact1 = CONTACT(Flags, Contacts, 1, Stride);
52 Contact1->pos[0] = Origin[0] + T[1] * Direction[0];
53 Contact1->pos[1] = Origin[1] + T[1] * Direction[1];
54 Contact1->pos[2] = Origin[2] + T[1] * Direction[2];
55 Contact1->pos[3] = Origin[3] + T[1] * Direction[3];
56 //Contact1->normal = 0;
57 Contact1->depth = 0.0f;
58 Contact1->g1 = RayGeom;
59 Contact1->g2 = SphereGeom;
60
61 return 2;
62 }
63 else if (T[1] >= REAL(0.0)){
64 dContactGeom* Contact = CONTACT(Flags, Contacts, 1, Stride);
65 Contact->pos[0] = Origin[0] + T[1] * Direction[0];
66 Contact->pos[1] = Origin[1] + T[1] * Direction[1];
67 Contact->pos[2] = Origin[2] + T[1] * Direction[2];
68 Contact->pos[3] = Origin[3] + T[1] * Direction[3];
69 //Contact->normal = 0;
70 Contact->depth = 0.0f;
71 Contact->g1 = RayGeom;
72 Contact->g2 = SphereGeom;
73
74 return 1;
75 }
76 else return 0;
77 }
78 else{
79 dReal T;
80 T = -B / A;
81 if (T >= REAL(0.0)){
82 dContactGeom* Contact = CONTACT(Flags, Contacts, 0, Stride);
83 Contact->pos[0] = Origin[0] + T * Direction[0];
84 Contact->pos[1] = Origin[1] + T * Direction[1];
85 Contact->pos[2] = Origin[2] + T * Direction[2];
86 Contact->pos[3] = Origin[3] + T * Direction[3];
87 //Contact->normal = 0;
88 Contact->depth = 0.0f;
89 Contact->g1 = RayGeom;
90 Contact->g2 = SphereGeom;
91 return 1;
92 }
93 else return 0;
94 }
95} \ No newline at end of file
diff --git a/libraries/ode-0.9/contrib/dRay/dxRay.h b/libraries/ode-0.9/contrib/dRay/dxRay.h
deleted file mode 100644
index 0fd1d2d..0000000
--- a/libraries/ode-0.9/contrib/dRay/dxRay.h
+++ /dev/null
@@ -1,32 +0,0 @@
1struct dxRay{
2 dReal Length;
3};
4
5inline void Decompose(const dMatrix3 Matrix, dVector3 Right, dVector3 Up, dVector3 Direction){
6 Right[0] = Matrix[0 * 4 + 0];
7 Right[1] = Matrix[1 * 4 + 0];
8 Right[2] = Matrix[2 * 4 + 0];
9 Right[3] = Matrix[3 * 4 + 0];
10 Up[0] = Matrix[0 * 4 + 1];
11 Up[1] = Matrix[1 * 4 + 1];
12 Up[2] = Matrix[2 * 4 + 1];
13 Up[3] = Matrix[3 * 4 + 1];
14 Direction[0] = Matrix[0 * 4 + 2];
15 Direction[1] = Matrix[1 * 4 + 2];
16 Direction[2] = Matrix[2 * 4 + 2];
17 Direction[3] = Matrix[3 * 4 + 2];
18}
19
20inline void Decompose(const dMatrix3 Matrix, dVector3 Vectors[3]){
21 Decompose(Matrix, Vectors[0], Vectors[1], Vectors[2]);
22}
23
24inline dContactGeom* CONTACT(int Flags, dContactGeom* Contacts, int Index, int Stride){
25 dIASSERT(Index >= 0 && Index < (Flags & 0x0ffff));
26 return ((dContactGeom*)(((char*)Contacts) + (Index * Stride)));
27}
28
29int dCollidePR(dxGeom* RayGeom, dxGeom* PlaneGeom, int Flags, dContactGeom* Contacts, int Stride);
30int dCollideSR(dxGeom* RayGeom, dxGeom* SphereGeom, int Flags, dContactGeom* Contacts, int Stride);
31int dCollideBR(dxGeom* RayGeom, dxGeom* BoxGeom, int Flags, dContactGeom* Contacts, int Stride);
32int dCollideCCR(dxGeom* RayGeom, dxGeom* CCylinderGeom, int Flags, dContactGeom* Contacts, int Stride); \ No newline at end of file