26 #ifndef _ODE_ODECPP_COLLISION_H_
27 #define _ODE_ODECPP_COLLISION_H_
37 void operator= (dGeom &);
64 void setData (
void *data)
74 void setPosition (dReal x, dReal y, dReal z)
76 const dReal * getPosition()
const
79 void setRotation (
const dMatrix3 R)
81 const dReal * getRotation()
const
84 void setQuaternion (
const dQuaternion quat)
86 void getQuaternion (dQuaternion quat)
const
89 void getAABB (dReal aabb[6])
const
95 void setCategoryBits (
unsigned long bits)
97 void setCollideBits (
unsigned long bits)
99 unsigned long getCategoryBits()
101 unsigned long getCollideBits()
111 void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result)
const
113 void getRelPointPos (
const dVector3 p, dVector3 result)
const
114 { getRelPointPos (p[0], p[1], p[2], result); }
116 void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result)
const
118 void getPosRelPoint (
const dVector3 p, dVector3 result)
const
119 { getPosRelPoint (p[0], p[1], p[2], result); }
121 void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result)
const
123 void vectorToWorld (
const dVector3 p, dVector3 result)
const
124 { vectorToWorld (p[0], p[1], p[2], result); }
126 void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result)
const
128 void vectorFromWorld (
const dVector3 p, dVector3 result)
const
129 { vectorFromWorld (p[0], p[1], p[2], result); }
136 class dSpace :
public dGeom {
139 void operator= (dSpace &);
145 dSpace () { _id = 0; }
153 void setCleanup (
int mode)
154 { dSpaceSetCleanup (
id(), mode); }
156 {
return dSpaceGetCleanup (
id()); }
159 { dSpaceAdd (
id(), x); }
161 { dSpaceRemove (
id(), x); }
163 {
return dSpaceQuery (
id(),x); }
166 {
return dSpaceGetNumGeoms (
id()); }
168 {
return dSpaceGetGeom (
id(),i); }
175 class dSimpleSpace :
public dSpace {
177 dSimpleSpace (dSimpleSpace &);
178 void operator= (dSimpleSpace &);
182 { _id = (
dGeomID) dSimpleSpaceCreate (0); }
183 dSimpleSpace (dSpace &space)
184 { _id = (
dGeomID) dSimpleSpaceCreate (space.id()); }
186 { _id = (
dGeomID) dSimpleSpaceCreate (space); }
190 class dHashSpace :
public dSpace {
192 dHashSpace (dHashSpace &);
193 void operator= (dHashSpace &);
197 { _id = (
dGeomID) dHashSpaceCreate (0); }
198 dHashSpace (dSpace &space)
199 { _id = (
dGeomID) dHashSpaceCreate (space.id()); }
201 { _id = (
dGeomID) dHashSpaceCreate (space); }
203 void setLevels (
int minlevel,
int maxlevel)
204 { dHashSpaceSetLevels (
id(),minlevel,maxlevel); }
208 class dQuadTreeSpace :
public dSpace {
210 dQuadTreeSpace (dQuadTreeSpace &);
211 void operator= (dQuadTreeSpace &);
214 dQuadTreeSpace (
const dVector3 center,
const dVector3 extents,
int depth)
215 { _id = (
dGeomID) dQuadTreeSpaceCreate (0,center,extents,depth); }
216 dQuadTreeSpace (dSpace &space,
const dVector3 center,
const dVector3 extents,
int depth)
217 { _id = (
dGeomID) dQuadTreeSpaceCreate (space.id(),center,extents,depth); }
218 dQuadTreeSpace (
dSpaceID space,
const dVector3 center,
const dVector3 extents,
int depth)
219 { _id = (
dGeomID) dQuadTreeSpaceCreate (space,center,extents,depth); }
223 class dSphere :
public dGeom {
226 void operator= (dSphere &);
230 dSphere (dReal radius)
232 dSphere (dSpace &space, dReal radius)
234 dSphere (
dSpaceID space, dReal radius)
237 void create (
dSpaceID space, dReal radius) {
242 void setRadius (dReal radius)
244 dReal getRadius()
const
249 class dBox :
public dGeom {
252 void operator= (dBox &);
256 dBox (dReal lx, dReal ly, dReal lz)
258 dBox (dSpace &space, dReal lx, dReal ly, dReal lz)
260 dBox (
dSpaceID space, dReal lx, dReal ly, dReal lz)
263 void create (
dSpaceID space, dReal lx, dReal ly, dReal lz) {
268 void setLengths (dReal lx, dReal ly, dReal lz)
270 void getLengths (dVector3 result)
const
275 class dPlane :
public dGeom {
278 void operator= (dPlane &);
282 dPlane (dReal a, dReal b, dReal c, dReal d)
283 { _id = dCreatePlane (0,a,b,c,d); }
284 dPlane (dSpace &space, dReal a, dReal b, dReal c, dReal d)
285 { _id = dCreatePlane (space.id(),a,b,c,d); }
286 dPlane (
dSpaceID space, dReal a, dReal b, dReal c, dReal d)
287 { _id = dCreatePlane (space,a,b,c,d); }
289 void create (
dSpaceID space, dReal a, dReal b, dReal c, dReal d) {
291 _id = dCreatePlane (space,a,b,c,d);
294 void setParams (dReal a, dReal b, dReal c, dReal d)
295 { dGeomPlaneSetParams (_id, a, b, c, d); }
296 void getParams (dVector4 result)
const
297 { dGeomPlaneGetParams (_id,result); }
301 class dCapsule :
public dGeom {
303 dCapsule (dCapsule &);
304 void operator= (dCapsule &);
308 dCapsule (dReal radius, dReal length)
309 { _id = dCreateCapsule (0,radius,length); }
310 dCapsule (dSpace &space, dReal radius, dReal length)
311 { _id = dCreateCapsule (space.id(),radius,length); }
312 dCapsule (
dSpaceID space, dReal radius, dReal length)
313 { _id = dCreateCapsule (space,radius,length); }
315 void create (
dSpaceID space, dReal radius, dReal length) {
317 _id = dCreateCapsule (space,radius,length);
320 void setParams (dReal radius, dReal length)
321 { dGeomCapsuleSetParams (_id, radius, length); }
322 void getParams (dReal *radius, dReal *length)
const
323 { dGeomCapsuleGetParams (_id,radius,length); }
327 class dCylinder :
public dGeom {
329 dCylinder (dCylinder &);
330 void operator= (dCylinder &);
334 dCylinder (dReal radius, dReal length)
335 { _id = dCreateCylinder (0,radius,length); }
336 dCylinder (dSpace &space, dReal radius, dReal length)
337 { _id = dCreateCylinder (space.id(),radius,length); }
338 dCylinder (
dSpaceID space, dReal radius, dReal length)
339 { _id = dCreateCylinder (space,radius,length); }
341 void create (
dSpaceID space, dReal radius, dReal length) {
343 _id = dCreateCylinder (space,radius,length);
346 void setParams (dReal radius, dReal length)
347 { dGeomCylinderSetParams (_id, radius, length); }
348 void getParams (dReal *radius, dReal *length)
const
349 { dGeomCylinderGetParams (_id,radius,length); }
353 class dRay :
public dGeom {
356 void operator= (dRay &);
361 { _id = dCreateRay (0,length); }
362 dRay (dSpace &space, dReal length)
363 { _id = dCreateRay (space.id(),length); }
365 { _id = dCreateRay (space,length); }
367 void create (
dSpaceID space, dReal length) {
369 _id = dCreateRay (space,length);
372 void setLength (dReal length)
373 { dGeomRaySetLength (_id, length); }
375 {
return dGeomRayGetLength (_id); }
377 void set (dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz)
378 { dGeomRaySet (_id, px, py, pz, dx, dy, dz); }
379 void get (dVector3 start, dVector3 dir)
380 { dGeomRayGet (_id, start, dir); }
382 void setParams (
int firstContact,
int backfaceCull)
383 { dGeomRaySetParams (_id, firstContact, backfaceCull); }
384 void getParams (
int *firstContact,
int *backfaceCull)
385 { dGeomRayGetParams (_id, firstContact, backfaceCull); }
386 void setClosestHit (
int closestHit)
387 { dGeomRaySetClosestHit (_id, closestHit); }
389 {
return dGeomRayGetClosestHit (_id); }
393 class dGeomTransform :
public dGeom {
395 dGeomTransform (dGeomTransform &);
396 void operator= (dGeomTransform &);
400 dGeomTransform (dSpace &space)
401 { _id = dCreateGeomTransform (space.id()); }
403 { _id = dCreateGeomTransform (space); }
407 _id = dCreateGeomTransform (space);
411 { dGeomTransformSetGeom (_id, geom); }
413 {
return dGeomTransformGetGeom (_id); }
415 void setCleanup (
int mode)
416 { dGeomTransformSetCleanup (_id,mode); }
418 {
return dGeomTransformGetCleanup (_id); }
420 void setInfo (
int mode)
421 { dGeomTransformSetInfo (_id,mode); }
423 {
return dGeomTransformGetInfo (_id); }
ODE_API void dGeomSetCategoryBits(dGeomID geom, unsigned long bits)
Set the "category" bitfield for the given geom.
ODE_API int dGeomIsEnabled(dGeomID geom)
Check to see if a geom is enabled.
ODE_API void dGeomVectorFromWorld(dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result)
Convert from world to geom-local coordinates.
Definition: collision_kernel.cpp:851
ODE_API void dSpaceCollide2(dGeomID space1, dGeomID space2, void *data, dNearCallback *callback)
Determines which geoms from one space may potentially intersect with geoms from another space...
ODE_API void dGeomSetCollideBits(dGeomID geom, unsigned long bits)
Set the "collide" bitfield for the given geom.
ODE_API dBodyID dGeomGetBody(dGeomID geom)
Get the body associated with a placeable geom.
ODE_API void dGeomSetPosition(dGeomID geom, dReal x, dReal y, dReal z)
Set the position vector of a placeable geom.
ODE_API dReal dGeomSphereGetRadius(dGeomID sphere)
Retrieves the radius of a sphere geom.
Definition: sphere.cpp:87
ODE_API void dGeomSetBody(dGeomID geom, dBodyID body)
Set the body associated with a placeable geom.
ODE_API dSpaceID dGeomGetSpace(dGeomID)
Query for the space containing a particular geom.
ODE_API unsigned long dGeomGetCategoryBits(dGeomID)
Get the "category" bitfield for the given geom.
ODE_API void dGeomSetQuaternion(dGeomID geom, const dQuaternion Q)
Set the rotation of a placeable geom.
ODE_API const dReal * dGeomGetRotation(dGeomID geom)
Get the rotation matrix of a placeable geom.
ODE_API void dGeomSphereSetRadius(dGeomID sphere, dReal radius)
Set the radius of a sphere geom.
Definition: sphere.cpp:76
ODE_API void dSpaceCollide(dSpaceID space, void *data, dNearCallback *callback)
Determines which pairs of geoms in a space may potentially intersect, and calls the callback function...
Definition: ode/src/objects.h:131
void dNearCallback(void *data, dGeomID o1, dGeomID o2)
User callback for geom-geom collision testing.
Definition: collision_space.h:49
ODE_API void dGeomDisable(dGeomID geom)
Disable a geom.
ODE_API int dGeomIsSpace(dGeomID geom)
Determing if a geom is a space.
ODE_API void dGeomVectorToWorld(dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result)
Convert from geom-local to world coordinates.
Definition: collision_kernel.cpp:830
ODE_API void dGeomGetAABB(dGeomID geom, dReal aabb[6])
Return the axis-aligned bounding box.
ODE_API void dGeomBoxSetLengths(dGeomID box, dReal lx, dReal ly, dReal lz)
Set the side lengths of the given box.
Definition: box.cpp:86
ODE_API void dGeomEnable(dGeomID geom)
Enable a geom.
ODE_API unsigned long dGeomGetCollideBits(dGeomID)
Get the "collide" bitfield for the given geom.
ODE_API void dGeomDestroy(dGeomID geom)
Destroy a geom, removing it from any space.
ODE_API void dGeomBoxGetLengths(dGeomID box, dVector3 result)
Get the side lengths of a box.
Definition: box.cpp:99
Definition: collision_kernel.h:96
Definition: collision_kernel.h:202
ODE_API void dGeomSetRotation(dGeomID geom, const dMatrix3 R)
Set the rotation matrix of a placeable geom.
ODE_API dGeomID dCreateSphere(dSpaceID space, dReal radius)
Create a sphere geom of the given radius, and return its ID.
Definition: sphere.cpp:70
ODE_API const dReal * dGeomGetPosition(dGeomID geom)
Get the position vector of a placeable geom.
ODE_API void dGeomGetPosRelPoint(dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result)
takes a point in global coordinates and returns the point's position in geom-relative coordinates...
Definition: collision_kernel.cpp:809
ODE_API void * dGeomGetData(dGeomID geom)
Get the user-defined data pointer stored in the geom.
ODE_API void dGeomSetData(dGeomID geom, void *data)
Set the user-defined data pointer stored in the geom.
ODE_API int dGeomGetClass(dGeomID geom)
Given a geom, this returns its class.
ODE_API void dGeomGetQuaternion(dGeomID geom, dQuaternion result)
Get the rotation quaternion of a placeable geom.
ODE_API void dGeomGetRelPointPos(dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result)
Get world position of a relative point on geom.
Definition: collision_kernel.cpp:784
ODE_API dGeomID dCreateBox(dSpaceID space, dReal lx, dReal ly, dReal lz)
Create a box geom with the provided side lengths.
Definition: box.cpp:80