aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/ode/src/collision_std.h
diff options
context:
space:
mode:
authordan miller2007-10-19 05:15:33 +0000
committerdan miller2007-10-19 05:15:33 +0000
commit79eca25c945a535a7a0325999034bae17da92412 (patch)
tree40ff433d94859d629aac933d5ec73b382f62ba1a /libraries/ode-0.9/ode/src/collision_std.h
parentadding ode source to /libraries (diff)
downloadopensim-SC-79eca25c945a535a7a0325999034bae17da92412.zip
opensim-SC-79eca25c945a535a7a0325999034bae17da92412.tar.gz
opensim-SC-79eca25c945a535a7a0325999034bae17da92412.tar.bz2
opensim-SC-79eca25c945a535a7a0325999034bae17da92412.tar.xz
resubmitting ode
Diffstat (limited to 'libraries/ode-0.9/ode/src/collision_std.h')
-rw-r--r--libraries/ode-0.9/ode/src/collision_std.h172
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
25the 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
41int dCollideSphereSphere (dxGeom *o1, dxGeom *o2, int flags,
42 dContactGeom *contact, int skip);
43int dCollideSphereBox (dxGeom *o1, dxGeom *o2, int flags,
44 dContactGeom *contact, int skip);
45int dCollideSpherePlane (dxGeom *o1, dxGeom *o2, int flags,
46 dContactGeom *contact, int skip);
47int dCollideBoxBox (dxGeom *o1, dxGeom *o2, int flags,
48 dContactGeom *contact, int skip);
49int dCollideBoxPlane (dxGeom *o1, dxGeom *o2,
50 int flags, dContactGeom *contact, int skip);
51int dCollideCapsuleSphere (dxGeom *o1, dxGeom *o2, int flags,
52 dContactGeom *contact, int skip);
53int dCollideCapsuleBox (dxGeom *o1, dxGeom *o2, int flags,
54 dContactGeom *contact, int skip);
55int dCollideCapsuleCapsule (dxGeom *o1, dxGeom *o2,
56 int flags, dContactGeom *contact, int skip);
57int dCollideCapsulePlane (dxGeom *o1, dxGeom *o2, int flags,
58 dContactGeom *contact, int skip);
59int dCollideRaySphere (dxGeom *o1, dxGeom *o2, int flags,
60 dContactGeom *contact, int skip);
61int dCollideRayBox (dxGeom *o1, dxGeom *o2, int flags,
62 dContactGeom *contact, int skip);
63int dCollideRayCapsule (dxGeom *o1, dxGeom *o2,
64 int flags, dContactGeom *contact, int skip);
65int dCollideRayPlane (dxGeom *o1, dxGeom *o2, int flags,
66 dContactGeom *contact, int skip);
67int 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
72int dCollideCylinderBox(dxGeom *o1, dxGeom *o2,
73 int flags, dContactGeom *contact, int skip);
74int dCollideCylinderSphere(dxGeom *gCylinder, dxGeom *gSphere,
75 int flags, dContactGeom *contact, int skip);
76int dCollideCylinderPlane(dxGeom *gCylinder, dxGeom *gPlane,
77 int flags, dContactGeom *contact, int skip);
78
79//--> Convex Collision
80int dCollideConvexPlane (dxGeom *o1, dxGeom *o2, int flags,
81 dContactGeom *contact, int skip);
82int dCollideSphereConvex (dxGeom *o1, dxGeom *o2, int flags,
83 dContactGeom *contact, int skip);
84int dCollideConvexBox (dxGeom *o1, dxGeom *o2, int flags,
85 dContactGeom *contact, int skip);
86int dCollideConvexCapsule (dxGeom *o1, dxGeom *o2,
87 int flags, dContactGeom *contact, int skip);
88int dCollideConvexConvex (dxGeom *o1, dxGeom *o2, int flags,
89 dContactGeom *contact, int skip);
90int dCollideRayConvex (dxGeom *o1, dxGeom *o2, int flags,
91 dContactGeom *contact, int skip);
92//<-- Convex Collision
93
94// dHeightfield
95int dCollideHeightfield( dxGeom *o1, dxGeom *o2,
96 int flags, dContactGeom *contact, int skip );
97
98//****************************************************************************
99// the basic geometry objects
100
101struct dxSphere : public dxGeom {
102 dReal radius; // sphere radius
103 dxSphere (dSpaceID space, dReal _radius);
104 void computeAABB();
105};
106
107
108struct 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
115struct 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
122struct 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
129struct 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
136struct dxRay : public dxGeom {
137 dReal length;
138 dxRay (dSpaceID space, dReal _length);
139 void computeAABB();
140};
141
142typedef 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 */
143struct 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