diff options
author | dan miller | 2007-10-19 05:24:38 +0000 |
---|---|---|
committer | dan miller | 2007-10-19 05:24:38 +0000 |
commit | f205de7847da7ae1c10212d82e7042d0100b4ce0 (patch) | |
tree | 9acc9608a6880502aaeda43af52c33e278e95b9c /libraries/ode-0.9/ode/src/collision_std.h | |
parent | trying to fix my screwup part deux (diff) | |
download | opensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.zip opensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.gz opensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.bz2 opensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.xz |
from the start... checking in ode-0.9
Diffstat (limited to 'libraries/ode-0.9/ode/src/collision_std.h')
-rw-r--r-- | libraries/ode-0.9/ode/src/collision_std.h | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/libraries/ode-0.9/ode/src/collision_std.h b/libraries/ode-0.9/ode/src/collision_std.h new file mode 100644 index 0000000..d203ad0 --- /dev/null +++ b/libraries/ode-0.9/ode/src/collision_std.h | |||
@@ -0,0 +1,172 @@ | |||
1 | /************************************************************************* | ||
2 | * * | ||
3 | * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * | ||
4 | * All rights reserved. Email: russ@q12.org Web: www.q12.org * | ||
5 | * * | ||
6 | * This library is free software; you can redistribute it and/or * | ||
7 | * modify it under the terms of EITHER: * | ||
8 | * (1) The GNU Lesser General Public License as published by the Free * | ||
9 | * Software Foundation; either version 2.1 of the License, or (at * | ||
10 | * your option) any later version. The text of the GNU Lesser * | ||
11 | * General Public License is included with this library in the * | ||
12 | * file LICENSE.TXT. * | ||
13 | * (2) The BSD-style license that is included with this library in * | ||
14 | * the file LICENSE-BSD.TXT. * | ||
15 | * * | ||
16 | * This library is distributed in the hope that it will be useful, * | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * | ||
19 | * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | ||
20 | * * | ||
21 | *************************************************************************/ | ||
22 | |||
23 | /* | ||
24 | |||
25 | the standard ODE geometry primitives. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef _ODE_COLLISION_STD_H_ | ||
30 | #define _ODE_COLLISION_STD_H_ | ||
31 | |||
32 | #include <set> | ||
33 | #include <ode/common.h> | ||
34 | #include "collision_kernel.h" | ||
35 | |||
36 | |||
37 | // primitive collision functions - these have the dColliderFn interface, i.e. | ||
38 | // the same interface as dCollide(). the first and second geom arguments must | ||
39 | // have the specified types. | ||
40 | |||
41 | int dCollideSphereSphere (dxGeom *o1, dxGeom *o2, int flags, | ||
42 | dContactGeom *contact, int skip); | ||
43 | int dCollideSphereBox (dxGeom *o1, dxGeom *o2, int flags, | ||
44 | dContactGeom *contact, int skip); | ||
45 | int dCollideSpherePlane (dxGeom *o1, dxGeom *o2, int flags, | ||
46 | dContactGeom *contact, int skip); | ||
47 | int dCollideBoxBox (dxGeom *o1, dxGeom *o2, int flags, | ||
48 | dContactGeom *contact, int skip); | ||
49 | int dCollideBoxPlane (dxGeom *o1, dxGeom *o2, | ||
50 | int flags, dContactGeom *contact, int skip); | ||
51 | int dCollideCapsuleSphere (dxGeom *o1, dxGeom *o2, int flags, | ||
52 | dContactGeom *contact, int skip); | ||
53 | int dCollideCapsuleBox (dxGeom *o1, dxGeom *o2, int flags, | ||
54 | dContactGeom *contact, int skip); | ||
55 | int dCollideCapsuleCapsule (dxGeom *o1, dxGeom *o2, | ||
56 | int flags, dContactGeom *contact, int skip); | ||
57 | int dCollideCapsulePlane (dxGeom *o1, dxGeom *o2, int flags, | ||
58 | dContactGeom *contact, int skip); | ||
59 | int dCollideRaySphere (dxGeom *o1, dxGeom *o2, int flags, | ||
60 | dContactGeom *contact, int skip); | ||
61 | int dCollideRayBox (dxGeom *o1, dxGeom *o2, int flags, | ||
62 | dContactGeom *contact, int skip); | ||
63 | int dCollideRayCapsule (dxGeom *o1, dxGeom *o2, | ||
64 | int flags, dContactGeom *contact, int skip); | ||
65 | int dCollideRayPlane (dxGeom *o1, dxGeom *o2, int flags, | ||
66 | dContactGeom *contact, int skip); | ||
67 | int dCollideRayCylinder (dxGeom *o1, dxGeom *o2, int flags, | ||
68 | dContactGeom *contact, int skip); | ||
69 | |||
70 | // Cylinder - Box/Sphere by (C) CroTeam | ||
71 | // Ported by Nguyen Binh | ||
72 | int dCollideCylinderBox(dxGeom *o1, dxGeom *o2, | ||
73 | int flags, dContactGeom *contact, int skip); | ||
74 | int dCollideCylinderSphere(dxGeom *gCylinder, dxGeom *gSphere, | ||
75 | int flags, dContactGeom *contact, int skip); | ||
76 | int dCollideCylinderPlane(dxGeom *gCylinder, dxGeom *gPlane, | ||
77 | int flags, dContactGeom *contact, int skip); | ||
78 | |||
79 | //--> Convex Collision | ||
80 | int dCollideConvexPlane (dxGeom *o1, dxGeom *o2, int flags, | ||
81 | dContactGeom *contact, int skip); | ||
82 | int dCollideSphereConvex (dxGeom *o1, dxGeom *o2, int flags, | ||
83 | dContactGeom *contact, int skip); | ||
84 | int dCollideConvexBox (dxGeom *o1, dxGeom *o2, int flags, | ||
85 | dContactGeom *contact, int skip); | ||
86 | int dCollideConvexCapsule (dxGeom *o1, dxGeom *o2, | ||
87 | int flags, dContactGeom *contact, int skip); | ||
88 | int dCollideConvexConvex (dxGeom *o1, dxGeom *o2, int flags, | ||
89 | dContactGeom *contact, int skip); | ||
90 | int dCollideRayConvex (dxGeom *o1, dxGeom *o2, int flags, | ||
91 | dContactGeom *contact, int skip); | ||
92 | //<-- Convex Collision | ||
93 | |||
94 | // dHeightfield | ||
95 | int dCollideHeightfield( dxGeom *o1, dxGeom *o2, | ||
96 | int flags, dContactGeom *contact, int skip ); | ||
97 | |||
98 | //**************************************************************************** | ||
99 | // the basic geometry objects | ||
100 | |||
101 | struct dxSphere : public dxGeom { | ||
102 | dReal radius; // sphere radius | ||
103 | dxSphere (dSpaceID space, dReal _radius); | ||
104 | void computeAABB(); | ||
105 | }; | ||
106 | |||
107 | |||
108 | struct dxBox : public dxGeom { | ||
109 | dVector3 side; // side lengths (x,y,z) | ||
110 | dxBox (dSpaceID space, dReal lx, dReal ly, dReal lz); | ||
111 | void computeAABB(); | ||
112 | }; | ||
113 | |||
114 | |||
115 | struct dxCapsule : public dxGeom { | ||
116 | dReal radius,lz; // radius, length along z axis | ||
117 | dxCapsule (dSpaceID space, dReal _radius, dReal _length); | ||
118 | void computeAABB(); | ||
119 | }; | ||
120 | |||
121 | |||
122 | struct dxCylinder : public dxGeom { | ||
123 | dReal radius,lz; // radius, length along z axis | ||
124 | dxCylinder (dSpaceID space, dReal _radius, dReal _length); | ||
125 | void computeAABB(); | ||
126 | }; | ||
127 | |||
128 | |||
129 | struct dxPlane : public dxGeom { | ||
130 | dReal p[4]; | ||
131 | dxPlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d); | ||
132 | void computeAABB(); | ||
133 | }; | ||
134 | |||
135 | |||
136 | struct dxRay : public dxGeom { | ||
137 | dReal length; | ||
138 | dxRay (dSpaceID space, dReal _length); | ||
139 | void computeAABB(); | ||
140 | }; | ||
141 | |||
142 | typedef std::pair<unsigned int,unsigned int> edge; /*!< Used to descrive a convex hull edge, an edge is a pair or indices into the hull's points */ | ||
143 | struct dxConvex : public dxGeom | ||
144 | { | ||
145 | |||
146 | dReal *planes; /*!< An array of planes in the form: | ||
147 | normal X, normal Y, normal Z,Distance | ||
148 | */ | ||
149 | dReal *points; /*!< An array of points X,Y,Z */ | ||
150 | unsigned int *polygons; /*! An array of indices to the points of each polygon, it should be the number of vertices followed by that amount of indices to "points" in counter clockwise order*/ | ||
151 | unsigned int planecount; /*!< Amount of planes in planes */ | ||
152 | unsigned int pointcount;/*!< Amount of points in points */ | ||
153 | dReal saabb[6];/*!< Static AABB */ | ||
154 | std::set<edge> edges; | ||
155 | dxConvex(dSpaceID space, | ||
156 | dReal *planes, | ||
157 | unsigned int planecount, | ||
158 | dReal *points, | ||
159 | unsigned int pointcount, | ||
160 | unsigned int *polygons); | ||
161 | ~dxConvex() | ||
162 | { | ||
163 | //fprintf(stdout,"dxConvex Destroy\n"); | ||
164 | } | ||
165 | void computeAABB(); | ||
166 | private: | ||
167 | // For Internal Use Only | ||
168 | void FillEdges(); | ||
169 | }; | ||
170 | |||
171 | |||
172 | #endif | ||