aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/include/ode/collision.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/include/ode/collision.h
parentadding ode source to /libraries (diff)
downloadopensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.zip
opensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.tar.gz
opensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.tar.bz2
opensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.tar.xz
resubmitting ode
Diffstat (limited to 'libraries/ode-0.9/include/ode/collision.h')
-rw-r--r--libraries/ode-0.9/include/ode/collision.h1386
1 files changed, 1386 insertions, 0 deletions
diff --git a/libraries/ode-0.9/include/ode/collision.h b/libraries/ode-0.9/include/ode/collision.h
new file mode 100644
index 0000000..c40bc4a
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/collision.h
@@ -0,0 +1,1386 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001-2003 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#ifndef _ODE_COLLISION_H_
24#define _ODE_COLLISION_H_
25
26#include <ode/common.h>
27#include <ode/collision_space.h>
28#include <ode/contact.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/**
35 * @defgroup collide Collision Detection
36 *
37 * ODE has two main components: a dynamics simulation engine and a collision
38 * detection engine. The collision engine is given information about the
39 * shape of each body. At each time step it figures out which bodies touch
40 * each other and passes the resulting contact point information to the user.
41 * The user in turn creates contact joints between bodies.
42 *
43 * Using ODE's collision detection is optional - an alternative collision
44 * detection system can be used as long as it can supply the right kinds of
45 * contact information.
46 */
47
48
49/* ************************************************************************ */
50/* general functions */
51
52/**
53 * @brief Destroy a geom, removing it from any space.
54 *
55 * Destroy a geom, removing it from any space it is in first. This one
56 * function destroys a geom of any type, but to create a geom you must call
57 * a creation function for that type.
58 *
59 * When a space is destroyed, if its cleanup mode is 1 (the default) then all
60 * the geoms in that space are automatically destroyed as well.
61 *
62 * @param geom the geom to be destroyed.
63 * @ingroup collide
64 */
65ODE_API void dGeomDestroy (dGeomID geom);
66
67
68/**
69 * @brief Set the user-defined data pointer stored in the geom.
70 *
71 * @param geom the geom to hold the data
72 * @param data the data pointer to be stored
73 * @ingroup collide
74 */
75ODE_API void dGeomSetData (dGeomID geom, void* data);
76
77
78/**
79 * @brief Get the user-defined data pointer stored in the geom.
80 *
81 * @param geom the geom containing the data
82 * @ingroup collide
83 */
84ODE_API void *dGeomGetData (dGeomID geom);
85
86
87/**
88 * @brief Set the body associated with a placeable geom.
89 *
90 * Setting a body on a geom automatically combines the position vector and
91 * rotation matrix of the body and geom, so that setting the position or
92 * orientation of one will set the value for both objects. Setting a body
93 * ID of zero gives the geom its own position and rotation, independent
94 * from any body. If the geom was previously connected to a body then its
95 * new independent position/rotation is set to the current position/rotation
96 * of the body.
97 *
98 * Calling these functions on a non-placeable geom results in a runtime
99 * error in the debug build of ODE.
100 *
101 * @param geom the geom to connect
102 * @param body the body to attach to the geom
103 * @ingroup collide
104 */
105ODE_API void dGeomSetBody (dGeomID geom, dBodyID body);
106
107
108/**
109 * @brief Get the body associated with a placeable geom.
110 * @param geom the geom to query.
111 * @sa dGeomSetBody
112 * @ingroup collide
113 */
114ODE_API dBodyID dGeomGetBody (dGeomID geom);
115
116
117/**
118 * @brief Set the position vector of a placeable geom.
119 *
120 * If the geom is attached to a body, the body's position will also be changed.
121 * Calling this function on a non-placeable geom results in a runtime error in
122 * the debug build of ODE.
123 *
124 * @param geom the geom to set.
125 * @param x the new X coordinate.
126 * @param y the new Y coordinate.
127 * @param z the new Z coordinate.
128 * @sa dBodySetPosition
129 * @ingroup collide
130 */
131ODE_API void dGeomSetPosition (dGeomID geom, dReal x, dReal y, dReal z);
132
133
134/**
135 * @brief Set the rotation matrix of a placeable geom.
136 *
137 * If the geom is attached to a body, the body's rotation will also be changed.
138 * Calling this function on a non-placeable geom results in a runtime error in
139 * the debug build of ODE.
140 *
141 * @param geom the geom to set.
142 * @param R the new rotation matrix.
143 * @sa dBodySetRotation
144 * @ingroup collide
145 */
146ODE_API void dGeomSetRotation (dGeomID geom, const dMatrix3 R);
147
148
149/**
150 * @brief Set the rotation of a placeable geom.
151 *
152 * If the geom is attached to a body, the body's rotation will also be changed.
153 *
154 * Calling this function on a non-placeable geom results in a runtime error in
155 * the debug build of ODE.
156 *
157 * @param geom the geom to set.
158 * @param Q the new rotation.
159 * @sa dBodySetQuaternion
160 * @ingroup collide
161 */
162ODE_API void dGeomSetQuaternion (dGeomID geom, const dQuaternion Q);
163
164
165/**
166 * @brief Get the position vector of a placeable geom.
167 *
168 * If the geom is attached to a body, the body's position will be returned.
169 *
170 * Calling this function on a non-placeable geom results in a runtime error in
171 * the debug build of ODE.
172 *
173 * @param geom the geom to query.
174 * @returns A pointer to the geom's position vector.
175 * @remarks The returned value is a pointer to the geom's internal
176 * data structure. It is valid until any changes are made
177 * to the geom.
178 * @sa dBodyGetPosition
179 * @ingroup collide
180 */
181ODE_API const dReal * dGeomGetPosition (dGeomID geom);
182
183
184/**
185 * @brief Copy the position of a geom into a vector.
186 * @ingroup collide
187 * @param geom the geom to query
188 * @param pos a copy of the geom position
189 * @sa dGeomGetPosition
190 */
191ODE_API void dGeomCopyPosition (dGeomID geom, dVector3 pos);
192
193
194/**
195 * @brief Get the rotation matrix of a placeable geom.
196 *
197 * If the geom is attached to a body, the body's rotation will be returned.
198 *
199 * Calling this function on a non-placeable geom results in a runtime error in
200 * the debug build of ODE.
201 *
202 * @param geom the geom to query.
203 * @returns A pointer to the geom's rotation matrix.
204 * @remarks The returned value is a pointer to the geom's internal
205 * data structure. It is valid until any changes are made
206 * to the geom.
207 * @sa dBodyGetRotation
208 * @ingroup collide
209 */
210ODE_API const dReal * dGeomGetRotation (dGeomID geom);
211
212
213/**
214 * @brief Get the rotation matrix of a placeable geom.
215 *
216 * If the geom is attached to a body, the body's rotation will be returned.
217 *
218 * Calling this function on a non-placeable geom results in a runtime error in
219 * the debug build of ODE.
220 *
221 * @param geom the geom to query.
222 * @param R a copy of the geom rotation
223 * @sa dGeomGetRotation
224 * @ingroup collide
225 */
226ODE_API void dGeomCopyRotation(dGeomID geom, dMatrix3 R);
227
228
229/**
230 * @brief Get the rotation quaternion of a placeable geom.
231 *
232 * If the geom is attached to a body, the body's quaternion will be returned.
233 *
234 * Calling this function on a non-placeable geom results in a runtime error in
235 * the debug build of ODE.
236 *
237 * @param geom the geom to query.
238 * @param result a copy of the rotation quaternion.
239 * @sa dBodyGetQuaternion
240 * @ingroup collide
241 */
242ODE_API void dGeomGetQuaternion (dGeomID geom, dQuaternion result);
243
244
245/**
246 * @brief Return the axis-aligned bounding box.
247 *
248 * Return in aabb an axis aligned bounding box that surrounds the given geom.
249 * The aabb array has elements (minx, maxx, miny, maxy, minz, maxz). If the
250 * geom is a space, a bounding box that surrounds all contained geoms is
251 * returned.
252 *
253 * This function may return a pre-computed cached bounding box, if it can
254 * determine that the geom has not moved since the last time the bounding
255 * box was computed.
256 *
257 * @param geom the geom to query
258 * @param aabb the returned bounding box
259 * @ingroup collide
260 */
261ODE_API void dGeomGetAABB (dGeomID geom, dReal aabb[6]);
262
263
264/**
265 * @brief Determing if a geom is a space.
266 * @param geom the geom to query
267 * @returns Non-zero if the geom is a space, zero otherwise.
268 * @ingroup collide
269 */
270ODE_API int dGeomIsSpace (dGeomID geom);
271
272
273/**
274 * @brief Query for the space containing a particular geom.
275 * @param geom the geom to query
276 * @returns The space that contains the geom, or NULL if the geom is
277 * not contained by a space.
278 * @ingroup collide
279 */
280ODE_API dSpaceID dGeomGetSpace (dGeomID);
281
282
283/**
284 * @brief Given a geom, this returns its class.
285 *
286 * The ODE classes are:
287 * @li dSphereClass
288 * @li dBoxClass
289 * @li dCylinderClass
290 * @li dPlaneClass
291 * @li dRayClass
292 * @li dConvexClass
293 * @li dGeomTransformClass
294 * @li dTriMeshClass
295 * @li dSimpleSpaceClass
296 * @li dHashSpaceClass
297 * @li dQuadTreeSpaceClass
298 * @li dFirstUserClass
299 * @li dLastUserClass
300 *
301 * User-defined class will return their own number.
302 *
303 * @param geom the geom to query
304 * @returns The geom class ID.
305 * @ingroup collide
306 */
307ODE_API int dGeomGetClass (dGeomID geom);
308
309
310/**
311 * @brief Set the "category" bitfield for the given geom.
312 *
313 * The category bitfield is used by spaces to govern which geoms will
314 * interact with each other. The bitfield is guaranteed to be at least
315 * 32 bits wide. The default category values for newly created geoms
316 * have all bits set.
317 *
318 * @param geom the geom to set
319 * @param bits the new bitfield value
320 * @ingroup collide
321 */
322ODE_API void dGeomSetCategoryBits (dGeomID geom, unsigned long bits);
323
324
325/**
326 * @brief Set the "collide" bitfield for the given geom.
327 *
328 * The collide bitfield is used by spaces to govern which geoms will
329 * interact with each other. The bitfield is guaranteed to be at least
330 * 32 bits wide. The default category values for newly created geoms
331 * have all bits set.
332 *
333 * @param geom the geom to set
334 * @param bits the new bitfield value
335 * @ingroup collide
336 */
337ODE_API void dGeomSetCollideBits (dGeomID geom, unsigned long bits);
338
339
340/**
341 * @brief Get the "category" bitfield for the given geom.
342 *
343 * @param geom the geom to set
344 * @param bits the new bitfield value
345 * @sa dGeomSetCategoryBits
346 * @ingroup collide
347 */
348ODE_API unsigned long dGeomGetCategoryBits (dGeomID);
349
350
351/**
352 * @brief Get the "collide" bitfield for the given geom.
353 *
354 * @param geom the geom to set
355 * @param bits the new bitfield value
356 * @sa dGeomSetCollideBits
357 * @ingroup collide
358 */
359ODE_API unsigned long dGeomGetCollideBits (dGeomID);
360
361
362/**
363 * @brief Enable a geom.
364 *
365 * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2,
366 * although they can still be members of a space. New geoms are created in
367 * the enabled state.
368 *
369 * @param geom the geom to enable
370 * @sa dGeomDisable
371 * @sa dGeomIsEnabled
372 * @ingroup collide
373 */
374ODE_API void dGeomEnable (dGeomID geom);
375
376
377/**
378 * @brief Disable a geom.
379 *
380 * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2,
381 * although they can still be members of a space. New geoms are created in
382 * the enabled state.
383 *
384 * @param geom the geom to disable
385 * @sa dGeomDisable
386 * @sa dGeomIsEnabled
387 * @ingroup collide
388 */
389ODE_API void dGeomDisable (dGeomID geom);
390
391
392/**
393 * @brief Check to see if a geom is enabled.
394 *
395 * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2,
396 * although they can still be members of a space. New geoms are created in
397 * the enabled state.
398 *
399 * @param geom the geom to query
400 * @returns Non-zero if the geom is enabled, zero otherwise.
401 * @sa dGeomDisable
402 * @sa dGeomIsEnabled
403 * @ingroup collide
404 */
405ODE_API int dGeomIsEnabled (dGeomID geom);
406
407/* ************************************************************************ */
408/* geom offset from body */
409
410/**
411 * @brief Set the local offset position of a geom from its body.
412 *
413 * Sets the geom's positional offset in local coordinates.
414 * After this call, the geom will be at a new position determined from the
415 * body's position and the offset.
416 * The geom must be attached to a body.
417 * If the geom did not have an offset, it is automatically created.
418 *
419 * @param geom the geom to set.
420 * @param x the new X coordinate.
421 * @param y the new Y coordinate.
422 * @param z the new Z coordinate.
423 * @ingroup collide
424 */
425ODE_API void dGeomSetOffsetPosition (dGeomID geom, dReal x, dReal y, dReal z);
426
427
428/**
429 * @brief Set the local offset rotation matrix of a geom from its body.
430 *
431 * Sets the geom's rotational offset in local coordinates.
432 * After this call, the geom will be at a new position determined from the
433 * body's position and the offset.
434 * The geom must be attached to a body.
435 * If the geom did not have an offset, it is automatically created.
436 *
437 * @param geom the geom to set.
438 * @param R the new rotation matrix.
439 * @ingroup collide
440 */
441ODE_API void dGeomSetOffsetRotation (dGeomID geom, const dMatrix3 R);
442
443
444/**
445 * @brief Set the local offset rotation of a geom from its body.
446 *
447 * Sets the geom's rotational offset in local coordinates.
448 * After this call, the geom will be at a new position determined from the
449 * body's position and the offset.
450 * The geom must be attached to a body.
451 * If the geom did not have an offset, it is automatically created.
452 *
453 * @param geom the geom to set.
454 * @param Q the new rotation.
455 * @ingroup collide
456 */
457ODE_API void dGeomSetOffsetQuaternion (dGeomID geom, const dQuaternion Q);
458
459
460/**
461 * @brief Set the offset position of a geom from its body.
462 *
463 * Sets the geom's positional offset to move it to the new world
464 * coordinates.
465 * After this call, the geom will be at the world position passed in,
466 * and the offset will be the difference from the current body position.
467 * The geom must be attached to a body.
468 * If the geom did not have an offset, it is automatically created.
469 *
470 * @param geom the geom to set.
471 * @param x the new X coordinate.
472 * @param y the new Y coordinate.
473 * @param z the new Z coordinate.
474 * @ingroup collide
475 */
476ODE_API void dGeomSetOffsetWorldPosition (dGeomID geom, dReal x, dReal y, dReal z);
477
478
479/**
480 * @brief Set the offset rotation of a geom from its body.
481 *
482 * Sets the geom's rotational offset to orient it to the new world
483 * rotation matrix.
484 * After this call, the geom will be at the world orientation passed in,
485 * and the offset will be the difference from the current body orientation.
486 * The geom must be attached to a body.
487 * If the geom did not have an offset, it is automatically created.
488 *
489 * @param geom the geom to set.
490 * @param R the new rotation matrix.
491 * @ingroup collide
492 */
493ODE_API void dGeomSetOffsetWorldRotation (dGeomID geom, const dMatrix3 R);
494
495
496/**
497 * @brief Set the offset rotation of a geom from its body.
498 *
499 * Sets the geom's rotational offset to orient it to the new world
500 * rotation matrix.
501 * After this call, the geom will be at the world orientation passed in,
502 * and the offset will be the difference from the current body orientation.
503 * The geom must be attached to a body.
504 * If the geom did not have an offset, it is automatically created.
505 *
506 * @param geom the geom to set.
507 * @param Q the new rotation.
508 * @ingroup collide
509 */
510ODE_API void dGeomSetOffsetWorldQuaternion (dGeomID geom, const dQuaternion);
511
512
513/**
514 * @brief Clear any offset from the geom.
515 *
516 * If the geom has an offset, it is eliminated and the geom is
517 * repositioned at the body's position. If the geom has no offset,
518 * this function does nothing.
519 * This is more efficient than calling dGeomSetOffsetPosition(zero)
520 * and dGeomSetOffsetRotation(identiy), because this function actually
521 * eliminates the offset, rather than leaving it as the identity transform.
522 *
523 * @param geom the geom to have its offset destroyed.
524 * @ingroup collide
525 */
526ODE_API void dGeomClearOffset(dGeomID geom);
527
528
529/**
530 * @brief Check to see whether the geom has an offset.
531 *
532 * This function will return non-zero if the offset has been created.
533 * Note that there is a difference between a geom with no offset,
534 * and a geom with an offset that is the identity transform.
535 * In the latter case, although the observed behaviour is identical,
536 * there is a unnecessary computation involved because the geom will
537 * be applying the transform whenever it needs to recalculate its world
538 * position.
539 *
540 * @param geom the geom to query.
541 * @returns Non-zero if the geom has an offset, zero otherwise.
542 * @ingroup collide
543 */
544ODE_API int dGeomIsOffset(dGeomID geom);
545
546
547/**
548 * @brief Get the offset position vector of a geom.
549 *
550 * Returns the positional offset of the geom in local coordinates.
551 * If the geom has no offset, this function returns the zero vector.
552 *
553 * @param geom the geom to query.
554 * @returns A pointer to the geom's offset vector.
555 * @remarks The returned value is a pointer to the geom's internal
556 * data structure. It is valid until any changes are made
557 * to the geom.
558 * @ingroup collide
559 */
560ODE_API const dReal * dGeomGetOffsetPosition (dGeomID geom);
561
562
563/**
564 * @brief Copy the offset position vector of a geom.
565 *
566 * Returns the positional offset of the geom in local coordinates.
567 * If the geom has no offset, this function returns the zero vector.
568 *
569 * @param geom the geom to query.
570 * @param pos returns the offset position
571 * @ingroup collide
572 */
573ODE_API void dGeomCopyOffsetPosition (dGeomID geom, dVector3 pos);
574
575
576/**
577 * @brief Get the offset rotation matrix of a geom.
578 *
579 * Returns the rotational offset of the geom in local coordinates.
580 * If the geom has no offset, this function returns the identity
581 * matrix.
582 *
583 * @param geom the geom to query.
584 * @returns A pointer to the geom's offset rotation matrix.
585 * @remarks The returned value is a pointer to the geom's internal
586 * data structure. It is valid until any changes are made
587 * to the geom.
588 * @ingroup collide
589 */
590ODE_API const dReal * dGeomGetOffsetRotation (dGeomID geom);
591
592
593/**
594 * @brief Copy the offset rotation matrix of a geom.
595 *
596 * Returns the rotational offset of the geom in local coordinates.
597 * If the geom has no offset, this function returns the identity
598 * matrix.
599 *
600 * @param geom the geom to query.
601 * @param R returns the rotation matrix.
602 * @ingroup collide
603 */
604ODE_API void dGeomCopyOffsetRotation (dGeomID geom, dMatrix3 R);
605
606
607/**
608 * @brief Get the offset rotation quaternion of a geom.
609 *
610 * Returns the rotation offset of the geom as a quaternion.
611 * If the geom has no offset, the identity quaternion is returned.
612 *
613 * @param geom the geom to query.
614 * @param result a copy of the rotation quaternion.
615 * @ingroup collide
616 */
617ODE_API void dGeomGetOffsetQuaternion (dGeomID geom, dQuaternion result);
618
619
620/* ************************************************************************ */
621/* collision detection */
622
623/*
624 * Just generate any contacts (disables any contact refining).
625 */
626#define CONTACTS_UNIMPORTANT 0x80000000
627
628/**
629 *
630 * @brief Given two geoms o1 and o2 that potentially intersect,
631 * generate contact information for them.
632 *
633 * Internally, this just calls the correct class-specific collision
634 * functions for o1 and o2.
635 *
636 * @param o1 The first geom to test.
637 * @param o2 The second geom to test.
638 *
639 * @param flags The flags specify how contacts should be generated if
640 * the geoms touch. The lower 16 bits of flags is an integer that
641 * specifies the maximum number of contact points to generate. You must
642 * ask for at least one contact.
643 * Additionally, following bits may be set:
644 * CONTACTS_UNIMPORTANT -- just generate any contacts (skip contact refining).
645 * All other bits in flags must be set to zero. In the future the other bits
646 * may be used to select from different contact generation strategies.
647 *
648 * @param contact Points to an array of dContactGeom structures. The array
649 * must be able to hold at least the maximum number of contacts. These
650 * dContactGeom structures may be embedded within larger structures in the
651 * array -- the skip parameter is the byte offset from one dContactGeom to
652 * the next in the array. If skip is sizeof(dContactGeom) then contact
653 * points to a normal (C-style) array. It is an error for skip to be smaller
654 * than sizeof(dContactGeom).
655 *
656 * @returns If the geoms intersect, this function returns the number of contact
657 * points generated (and updates the contact array), otherwise it returns 0
658 * (and the contact array is not touched).
659 *
660 * @remarks If a space is passed as o1 or o2 then this function will collide
661 * all objects contained in o1 with all objects contained in o2, and return
662 * the resulting contact points. This method for colliding spaces with geoms
663 * (or spaces with spaces) provides no user control over the individual
664 * collisions. To get that control, use dSpaceCollide or dSpaceCollide2 instead.
665 *
666 * @remarks If o1 and o2 are the same geom then this function will do nothing
667 * and return 0. Technically speaking an object intersects with itself, but it
668 * is not useful to find contact points in this case.
669 *
670 * @remarks This function does not care if o1 and o2 are in the same space or not
671 * (or indeed if they are in any space at all).
672 *
673 * @ingroup collide
674 */
675ODE_API int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact,
676 int skip);
677
678/**
679 * @brief Determines which pairs of geoms in a space may potentially intersect,
680 * and calls the callback function for each candidate pair.
681 *
682 * @param space The space to test.
683 *
684 * @param data Passed from dSpaceCollide directly to the callback
685 * function. Its meaning is user defined. The o1 and o2 arguments are the
686 * geoms that may be near each other.
687 *
688 * @param callback A callback function is of type @ref dNearCallback.
689 *
690 * @remarks Other spaces that are contained within the colliding space are
691 * not treated specially, i.e. they are not recursed into. The callback
692 * function may be passed these contained spaces as one or both geom
693 * arguments.
694 *
695 * @remarks dSpaceCollide() is guaranteed to pass all intersecting geom
696 * pairs to the callback function, but may also pass close but
697 * non-intersecting pairs. The number of these calls depends on the
698 * internal algorithms used by the space. Thus you should not expect
699 * that dCollide will return contacts for every pair passed to the
700 * callback.
701 *
702 * @sa dSpaceCollide2
703 * @ingroup collide
704 */
705ODE_API void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback);
706
707
708/**
709 * @brief Determines which geoms from one space may potentially intersect with
710 * geoms from another space, and calls the callback function for each candidate
711 * pair.
712 *
713 * @param space1 The first space to test.
714 *
715 * @param space2 The second space to test.
716 *
717 * @param data Passed from dSpaceCollide directly to the callback
718 * function. Its meaning is user defined. The o1 and o2 arguments are the
719 * geoms that may be near each other.
720 *
721 * @param callback A callback function is of type @ref dNearCallback.
722 *
723 * @remarks This function can also test a single non-space geom against a
724 * space. This function is useful when there is a collision hierarchy, i.e.
725 * when there are spaces that contain other spaces.
726 *
727 * @remarks Other spaces that are contained within the colliding space are
728 * not treated specially, i.e. they are not recursed into. The callback
729 * function may be passed these contained spaces as one or both geom
730 * arguments.
731 *
732 * @remarks dSpaceCollide2() is guaranteed to pass all intersecting geom
733 * pairs to the callback function, but may also pass close but
734 * non-intersecting pairs. The number of these calls depends on the
735 * internal algorithms used by the space. Thus you should not expect
736 * that dCollide will return contacts for every pair passed to the
737 * callback.
738 *
739 * @sa dSpaceCollide
740 * @ingroup collide
741 */
742ODE_API void dSpaceCollide2 (dGeomID space1, dGeomID space2, void *data, dNearCallback *callback);
743
744
745/* ************************************************************************ */
746/* standard classes */
747
748/* the maximum number of user classes that are supported */
749enum {
750 dMaxUserClasses = 4
751};
752
753/* class numbers - each geometry object needs a unique number */
754enum {
755 dSphereClass = 0,
756 dBoxClass,
757 dCapsuleClass,
758 dCylinderClass,
759 dPlaneClass,
760 dRayClass,
761 dConvexClass,
762 dGeomTransformClass,
763 dTriMeshClass,
764 dHeightfieldClass,
765
766 dFirstSpaceClass,
767 dSimpleSpaceClass = dFirstSpaceClass,
768 dHashSpaceClass,
769 dQuadTreeSpaceClass,
770 dLastSpaceClass = dQuadTreeSpaceClass,
771
772 dFirstUserClass,
773 dLastUserClass = dFirstUserClass + dMaxUserClasses - 1,
774 dGeomNumClasses
775};
776
777
778/**
779 * @defgroup collide_sphere Sphere Class
780 * @ingroup collide
781 */
782
783/**
784 * @brief Create a sphere geom of the given radius, and return its ID.
785 *
786 * @param space a space to contain the new geom. May be null.
787 * @param radius the radius of the sphere.
788 *
789 * @returns A new sphere geom.
790 *
791 * @remarks The point of reference for a sphere is its center.
792 *
793 * @sa dGeomDestroy
794 * @sa dGeomSphereSetRadius
795 * @ingroup collide_sphere
796 */
797ODE_API dGeomID dCreateSphere (dSpaceID space, dReal radius);
798
799
800/**
801 * @brief Set the radius of a sphere geom.
802 *
803 * @param sphere the sphere to set.
804 * @param radius the new radius.
805 *
806 * @sa dGeomSphereGetRadius
807 * @ingroup collide_sphere
808 */
809ODE_API void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
810
811
812/**
813 * @brief Retrieves the radius of a sphere geom.
814 *
815 * @param sphere the sphere to query.
816 *
817 * @sa dGeomSphereSetRadius
818 * @ingroup collide_sphere
819 */
820ODE_API dReal dGeomSphereGetRadius (dGeomID sphere);
821
822
823/**
824 * @brief Calculate the depth of the a given point within a sphere.
825 *
826 * @param sphere the sphere to query.
827 * @param x the X coordinate of the point.
828 * @param y the Y coordinate of the point.
829 * @param z the Z coordinate of the point.
830 *
831 * @returns The depth of the point. Points inside the sphere will have a
832 * positive depth, points outside it will have a negative depth, and points
833 * on the surface will have a depth of zero.
834 *
835 * @ingroup collide_sphere
836 */
837ODE_API dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
838
839
840//--> Convex Functions
841ODE_API dGeomID dCreateConvex (dSpaceID space,
842 dReal *_planes,
843 unsigned int _planecount,
844 dReal *_points,
845 unsigned int _pointcount,unsigned int *_polygons);
846
847ODE_API void dGeomSetConvex (dGeomID g,
848 dReal *_planes,
849 unsigned int _count,
850 dReal *_points,
851 unsigned int _pointcount,unsigned int *_polygons);
852//<-- Convex Functions
853
854/**
855 * @defgroup collide_box Box Class
856 * @ingroup collide
857 */
858
859/**
860 * @brief Create a box geom with the provided side lengths.
861 *
862 * @param space a space to contain the new geom. May be null.
863 * @param lx the length of the box along the X axis
864 * @param ly the length of the box along the Y axis
865 * @param lz the length of the box along the Z axis
866 *
867 * @returns A new box geom.
868 *
869 * @remarks The point of reference for a box is its center.
870 *
871 * @sa dGeomDestroy
872 * @sa dGeomBoxSetLengths
873 * @ingroup collide_box
874 */
875ODE_API dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
876
877
878/**
879 * @brief Set the side lengths of the given box.
880 *
881 * @param box the box to set
882 * @param lx the length of the box along the X axis
883 * @param ly the length of the box along the Y axis
884 * @param lz the length of the box along the Z axis
885 *
886 * @sa dGeomBoxGetLengths
887 * @ingroup collide_box
888 */
889ODE_API void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
890
891
892/**
893 * @brief Get the side lengths of a box.
894 *
895 * @param box the box to query
896 * @param result the returned side lengths
897 *
898 * @sa dGeomBoxSetLengths
899 * @ingroup collide_box
900 */
901ODE_API void dGeomBoxGetLengths (dGeomID box, dVector3 result);
902
903
904/**
905 * @brief Return the depth of a point in a box.
906 *
907 * @param box the box to query
908 * @param x the X coordinate of the point to test.
909 * @param y the Y coordinate of the point to test.
910 * @param z the Z coordinate of the point to test.
911 *
912 * @returns The depth of the point. Points inside the box will have a
913 * positive depth, points outside it will have a negative depth, and points
914 * on the surface will have a depth of zero.
915 */
916ODE_API dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z);
917
918
919ODE_API dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
920ODE_API void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
921ODE_API void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
922ODE_API dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
923
924ODE_API dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length);
925ODE_API void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal length);
926ODE_API void dGeomCapsuleGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
927ODE_API dReal dGeomCapsulePointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
928
929// For now we want to have a backwards compatible C-API, note: C++ API is not.
930#define dCreateCCylinder dCreateCapsule
931#define dGeomCCylinderSetParams dGeomCapsuleSetParams
932#define dGeomCCylinderGetParams dGeomCapsuleGetParams
933#define dGeomCCylinderPointDepth dGeomCapsulePointDepth
934#define dCCylinderClass dCapsuleClass
935
936ODE_API dGeomID dCreateCylinder (dSpaceID space, dReal radius, dReal length);
937ODE_API void dGeomCylinderSetParams (dGeomID cylinder, dReal radius, dReal length);
938ODE_API void dGeomCylinderGetParams (dGeomID cylinder, dReal *radius, dReal *length);
939
940ODE_API dGeomID dCreateRay (dSpaceID space, dReal length);
941ODE_API void dGeomRaySetLength (dGeomID ray, dReal length);
942ODE_API dReal dGeomRayGetLength (dGeomID ray);
943ODE_API void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
944 dReal dx, dReal dy, dReal dz);
945ODE_API void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir);
946
947/*
948 * Set/get ray flags that influence ray collision detection.
949 * These flags are currently only noticed by the trimesh collider, because
950 * they can make a major differences there.
951 */
952ODE_API void dGeomRaySetParams (dGeomID g, int FirstContact, int BackfaceCull);
953ODE_API void dGeomRayGetParams (dGeomID g, int *FirstContact, int *BackfaceCull);
954ODE_API void dGeomRaySetClosestHit (dGeomID g, int closestHit);
955ODE_API int dGeomRayGetClosestHit (dGeomID g);
956
957#include "collision_trimesh.h"
958
959ODE_API dGeomID dCreateGeomTransform (dSpaceID space);
960ODE_API void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
961ODE_API dGeomID dGeomTransformGetGeom (dGeomID g);
962ODE_API void dGeomTransformSetCleanup (dGeomID g, int mode);
963ODE_API int dGeomTransformGetCleanup (dGeomID g);
964ODE_API void dGeomTransformSetInfo (dGeomID g, int mode);
965ODE_API int dGeomTransformGetInfo (dGeomID g);
966
967
968/* ************************************************************************ */
969/* heightfield functions */
970
971
972// Data storage for heightfield data.
973struct dxHeightfieldData;
974typedef struct dxHeightfieldData* dHeightfieldDataID;
975
976
977/**
978 * @brief Callback prototype
979 *
980 * Used by the callback heightfield data type to sample a height for a
981 * given cell position.
982 *
983 * @param p_user_data User data specified when creating the dHeightfieldDataID
984 * @param x The index of a sample in the local x axis. It is a value
985 * in the range zero to ( nWidthSamples - 1 ).
986 * @param x The index of a sample in the local z axis. It is a value
987 * in the range zero to ( nDepthSamples - 1 ).
988 *
989 * @return The sample height which is then scaled and offset using the
990 * values specified when the heightfield data was created.
991 *
992 * @ingroup collide
993 */
994typedef dReal dHeightfieldGetHeight( void* p_user_data, int x, int z );
995
996
997
998/**
999 * @brief Creates a heightfield geom.
1000 *
1001 * Uses the information in the given dHeightfieldDataID to construct
1002 * a geom representing a heightfield in a collision space.
1003 *
1004 * @param space The space to add the geom to.
1005 * @param data The dHeightfieldDataID created by dGeomHeightfieldDataCreate and
1006 * setup by dGeomHeightfieldDataBuildCallback, dGeomHeightfieldDataBuildByte,
1007 * dGeomHeightfieldDataBuildShort or dGeomHeightfieldDataBuildFloat.
1008 * @param bPlaceable If non-zero this geom can be transformed in the world using the
1009 * usual functions such as dGeomSetPosition and dGeomSetRotation. If the geom is
1010 * not set as placeable, then it uses a fixed orientation where the global y axis
1011 * represents the dynamic 'height' of the heightfield.
1012 *
1013 * @return A geom id to reference this geom in other calls.
1014 *
1015 * @ingroup collide
1016 */
1017ODE_API dGeomID dCreateHeightfield( dSpaceID space,
1018 dHeightfieldDataID data, int bPlaceable );
1019
1020
1021/**
1022 * @brief Creates a new empty dHeightfieldDataID.
1023 *
1024 * Allocates a new dHeightfieldDataID and returns it. You must call
1025 * dGeomHeightfieldDataDestroy to destroy it after the geom has been removed.
1026 * The dHeightfieldDataID value is used when specifying a data format type.
1027 *
1028 * @return A dHeightfieldDataID for use with dGeomHeightfieldDataBuildCallback,
1029 * dGeomHeightfieldDataBuildByte, dGeomHeightfieldDataBuildShort or
1030 * dGeomHeightfieldDataBuildFloat.
1031 * @ingroup collide
1032 */
1033ODE_API dHeightfieldDataID dGeomHeightfieldDataCreate();
1034
1035
1036/**
1037 * @brief Destroys a dHeightfieldDataID.
1038 *
1039 * Deallocates a given dHeightfieldDataID and all managed resources.
1040 *
1041 * @param d A dHeightfieldDataID created by dGeomHeightfieldDataCreate
1042 * @ingroup collide
1043 */
1044ODE_API void dGeomHeightfieldDataDestroy( dHeightfieldDataID d );
1045
1046
1047
1048/**
1049 * @brief Configures a dHeightfieldDataID to use a callback to
1050 * retrieve height data.
1051 *
1052 * Before a dHeightfieldDataID can be used by a geom it must be
1053 * configured to specify the format of the height data.
1054 * This call specifies that the heightfield data is computed by
1055 * the user and it should use the given callback when determining
1056 * the height of a given element of it's shape.
1057 *
1058 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1059 *
1060 * @param width Specifies the total 'width' of the heightfield along
1061 * the geom's local x axis.
1062 * @param depth Specifies the total 'depth' of the heightfield along
1063 * the geom's local z axis.
1064 *
1065 * @param widthSamples Specifies the number of vertices to sample
1066 * along the width of the heightfield. Each vertex has a corresponding
1067 * height value which forms the overall shape.
1068 * Naturally this value must be at least two or more.
1069 * @param depthSamples Specifies the number of vertices to sample
1070 * along the depth of the heightfield.
1071 *
1072 * @param scale A uniform scale applied to all raw height data.
1073 * @param offset An offset applied to the scaled height data.
1074 *
1075 * @param thickness A value subtracted from the lowest height
1076 * value which in effect adds an additional cuboid to the base of the
1077 * heightfield. This is used to prevent geoms from looping under the
1078 * desired terrain and not registering as a collision. Note that the
1079 * thickness is not affected by the scale or offset parameters.
1080 *
1081 * @param bWrap If non-zero the heightfield will infinitely tile in both
1082 * directions along the local x and z axes. If zero the heightfield is
1083 * bounded from zero to width in the local x axis, and zero to depth in
1084 * the local z axis.
1085 *
1086 * @ingroup collide
1087 */
1088ODE_API void dGeomHeightfieldDataBuildCallback( dHeightfieldDataID d,
1089 void* pUserData, dHeightfieldGetHeight* pCallback,
1090 dReal width, dReal depth, int widthSamples, int depthSamples,
1091 dReal scale, dReal offset, dReal thickness, int bWrap );
1092
1093/**
1094 * @brief Configures a dHeightfieldDataID to use height data in byte format.
1095 *
1096 * Before a dHeightfieldDataID can be used by a geom it must be
1097 * configured to specify the format of the height data.
1098 * This call specifies that the heightfield data is stored as a rectangular
1099 * array of bytes (8 bit unsigned) representing the height at each sample point.
1100 *
1101 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1102 *
1103 * @param pHeightData A pointer to the height data.
1104 * @param bCopyHeightData When non-zero the height data is copied to an
1105 * internal store. When zero the height data is accessed by reference and
1106 * so must persist throughout the lifetime of the heightfield.
1107 *
1108 * @param width Specifies the total 'width' of the heightfield along
1109 * the geom's local x axis.
1110 * @param depth Specifies the total 'depth' of the heightfield along
1111 * the geom's local z axis.
1112 *
1113 * @param widthSamples Specifies the number of vertices to sample
1114 * along the width of the heightfield. Each vertex has a corresponding
1115 * height value which forms the overall shape.
1116 * Naturally this value must be at least two or more.
1117 * @param depthSamples Specifies the number of vertices to sample
1118 * along the depth of the heightfield.
1119 *
1120 * @param scale A uniform scale applied to all raw height data.
1121 * @param offset An offset applied to the scaled height data.
1122 *
1123 * @param thickness A value subtracted from the lowest height
1124 * value which in effect adds an additional cuboid to the base of the
1125 * heightfield. This is used to prevent geoms from looping under the
1126 * desired terrain and not registering as a collision. Note that the
1127 * thickness is not affected by the scale or offset parameters.
1128 *
1129 * @param bWrap If non-zero the heightfield will infinitely tile in both
1130 * directions along the local x and z axes. If zero the heightfield is
1131 * bounded from zero to width in the local x axis, and zero to depth in
1132 * the local z axis.
1133 *
1134 * @ingroup collide
1135 */
1136ODE_API void dGeomHeightfieldDataBuildByte( dHeightfieldDataID d,
1137 const unsigned char* pHeightData, int bCopyHeightData,
1138 dReal width, dReal depth, int widthSamples, int depthSamples,
1139 dReal scale, dReal offset, dReal thickness, int bWrap );
1140
1141/**
1142 * @brief Configures a dHeightfieldDataID to use height data in short format.
1143 *
1144 * Before a dHeightfieldDataID can be used by a geom it must be
1145 * configured to specify the format of the height data.
1146 * This call specifies that the heightfield data is stored as a rectangular
1147 * array of shorts (16 bit signed) representing the height at each sample point.
1148 *
1149 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1150 *
1151 * @param pHeightData A pointer to the height data.
1152 * @param bCopyHeightData When non-zero the height data is copied to an
1153 * internal store. When zero the height data is accessed by reference and
1154 * so must persist throughout the lifetime of the heightfield.
1155 *
1156 * @param width Specifies the total 'width' of the heightfield along
1157 * the geom's local x axis.
1158 * @param depth Specifies the total 'depth' of the heightfield along
1159 * the geom's local z axis.
1160 *
1161 * @param widthSamples Specifies the number of vertices to sample
1162 * along the width of the heightfield. Each vertex has a corresponding
1163 * height value which forms the overall shape.
1164 * Naturally this value must be at least two or more.
1165 * @param depthSamples Specifies the number of vertices to sample
1166 * along the depth of the heightfield.
1167 *
1168 * @param scale A uniform scale applied to all raw height data.
1169 * @param offset An offset applied to the scaled height data.
1170 *
1171 * @param thickness A value subtracted from the lowest height
1172 * value which in effect adds an additional cuboid to the base of the
1173 * heightfield. This is used to prevent geoms from looping under the
1174 * desired terrain and not registering as a collision. Note that the
1175 * thickness is not affected by the scale or offset parameters.
1176 *
1177 * @param bWrap If non-zero the heightfield will infinitely tile in both
1178 * directions along the local x and z axes. If zero the heightfield is
1179 * bounded from zero to width in the local x axis, and zero to depth in
1180 * the local z axis.
1181 *
1182 * @ingroup collide
1183 */
1184ODE_API void dGeomHeightfieldDataBuildShort( dHeightfieldDataID d,
1185 const short* pHeightData, int bCopyHeightData,
1186 dReal width, dReal depth, int widthSamples, int depthSamples,
1187 dReal scale, dReal offset, dReal thickness, int bWrap );
1188
1189/**
1190 * @brief Configures a dHeightfieldDataID to use height data in
1191 * single precision floating point format.
1192 *
1193 * Before a dHeightfieldDataID can be used by a geom it must be
1194 * configured to specify the format of the height data.
1195 * This call specifies that the heightfield data is stored as a rectangular
1196 * array of single precision floats representing the height at each
1197 * sample point.
1198 *
1199 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1200 *
1201 * @param pHeightData A pointer to the height data.
1202 * @param bCopyHeightData When non-zero the height data is copied to an
1203 * internal store. When zero the height data is accessed by reference and
1204 * so must persist throughout the lifetime of the heightfield.
1205 *
1206 * @param width Specifies the total 'width' of the heightfield along
1207 * the geom's local x axis.
1208 * @param depth Specifies the total 'depth' of the heightfield along
1209 * the geom's local z axis.
1210 *
1211 * @param widthSamples Specifies the number of vertices to sample
1212 * along the width of the heightfield. Each vertex has a corresponding
1213 * height value which forms the overall shape.
1214 * Naturally this value must be at least two or more.
1215 * @param depthSamples Specifies the number of vertices to sample
1216 * along the depth of the heightfield.
1217 *
1218 * @param scale A uniform scale applied to all raw height data.
1219 * @param offset An offset applied to the scaled height data.
1220 *
1221 * @param thickness A value subtracted from the lowest height
1222 * value which in effect adds an additional cuboid to the base of the
1223 * heightfield. This is used to prevent geoms from looping under the
1224 * desired terrain and not registering as a collision. Note that the
1225 * thickness is not affected by the scale or offset parameters.
1226 *
1227 * @param bWrap If non-zero the heightfield will infinitely tile in both
1228 * directions along the local x and z axes. If zero the heightfield is
1229 * bounded from zero to width in the local x axis, and zero to depth in
1230 * the local z axis.
1231 *
1232 * @ingroup collide
1233 */
1234ODE_API void dGeomHeightfieldDataBuildSingle( dHeightfieldDataID d,
1235 const float* pHeightData, int bCopyHeightData,
1236 dReal width, dReal depth, int widthSamples, int depthSamples,
1237 dReal scale, dReal offset, dReal thickness, int bWrap );
1238
1239/**
1240 * @brief Configures a dHeightfieldDataID to use height data in
1241 * double precision floating point format.
1242 *
1243 * Before a dHeightfieldDataID can be used by a geom it must be
1244 * configured to specify the format of the height data.
1245 * This call specifies that the heightfield data is stored as a rectangular
1246 * array of double precision floats representing the height at each
1247 * sample point.
1248 *
1249 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1250 *
1251 * @param pHeightData A pointer to the height data.
1252 * @param bCopyHeightData When non-zero the height data is copied to an
1253 * internal store. When zero the height data is accessed by reference and
1254 * so must persist throughout the lifetime of the heightfield.
1255 *
1256 * @param width Specifies the total 'width' of the heightfield along
1257 * the geom's local x axis.
1258 * @param depth Specifies the total 'depth' of the heightfield along
1259 * the geom's local z axis.
1260 *
1261 * @param widthSamples Specifies the number of vertices to sample
1262 * along the width of the heightfield. Each vertex has a corresponding
1263 * height value which forms the overall shape.
1264 * Naturally this value must be at least two or more.
1265 * @param depthSamples Specifies the number of vertices to sample
1266 * along the depth of the heightfield.
1267 *
1268 * @param scale A uniform scale applied to all raw height data.
1269 * @param offset An offset applied to the scaled height data.
1270 *
1271 * @param thickness A value subtracted from the lowest height
1272 * value which in effect adds an additional cuboid to the base of the
1273 * heightfield. This is used to prevent geoms from looping under the
1274 * desired terrain and not registering as a collision. Note that the
1275 * thickness is not affected by the scale or offset parameters.
1276 *
1277 * @param bWrap If non-zero the heightfield will infinitely tile in both
1278 * directions along the local x and z axes. If zero the heightfield is
1279 * bounded from zero to width in the local x axis, and zero to depth in
1280 * the local z axis.
1281 *
1282 * @ingroup collide
1283 */
1284ODE_API void dGeomHeightfieldDataBuildDouble( dHeightfieldDataID d,
1285 const double* pHeightData, int bCopyHeightData,
1286 dReal width, dReal depth, int widthSamples, int depthSamples,
1287 dReal scale, dReal offset, dReal thickness, int bWrap );
1288
1289/**
1290 * @brief Manually set the minimum and maximum height bounds.
1291 *
1292 * This call allows you to set explicit min / max values after initial
1293 * creation typically for callback heightfields which default to +/- infinity,
1294 * or those whose data has changed. This must be set prior to binding with a
1295 * geom, as the the AABB is not recomputed after it's first generation.
1296 *
1297 * @remarks The minimum and maximum values are used to compute the AABB
1298 * for the heightfield which is used for early rejection of collisions.
1299 * A close fit will yield a more efficient collision check.
1300 *
1301 * @param d A dHeightfieldDataID created by dGeomHeightfieldDataCreate
1302 * @param min_height The new minimum height value. Scale, offset and thickness is then applied.
1303 * @param max_height The new maximum height value. Scale and offset is then applied.
1304 * @ingroup collide
1305 */
1306ODE_API void dGeomHeightfieldDataSetBounds( dHeightfieldDataID d,
1307 dReal minHeight, dReal maxHeight );
1308
1309
1310/**
1311 * @brief Assigns a dHeightfieldDataID to a heightfield geom.
1312 *
1313 * Associates the given dHeightfieldDataID with a heightfield geom.
1314 * This is done without affecting the GEOM_PLACEABLE flag.
1315 *
1316 * @param g A geom created by dCreateHeightfield
1317 * @param d A dHeightfieldDataID created by dGeomHeightfieldDataCreate
1318 * @ingroup collide
1319 */
1320ODE_API void dGeomHeightfieldSetHeightfieldData( dGeomID g, dHeightfieldDataID d );
1321
1322
1323/**
1324 * @brief Gets the dHeightfieldDataID bound to a heightfield geom.
1325 *
1326 * Returns the dHeightfieldDataID associated with a heightfield geom.
1327 *
1328 * @param g A geom created by dCreateHeightfield
1329 * @return The dHeightfieldDataID which may be NULL if none was assigned.
1330 * @ingroup collide
1331 */
1332ODE_API dHeightfieldDataID dGeomHeightfieldGetHeightfieldData( dGeomID g );
1333
1334
1335
1336/* ************************************************************************ */
1337/* utility functions */
1338
1339ODE_API void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
1340 const dVector3 b1, const dVector3 b2,
1341 dVector3 cp1, dVector3 cp2);
1342
1343ODE_API int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1,
1344 const dVector3 side1, const dVector3 _p2,
1345 const dMatrix3 R2, const dVector3 side2);
1346
1347// The meaning of flags parameter is the same as in dCollide()
1348ODE_API int dBoxBox (const dVector3 p1, const dMatrix3 R1,
1349 const dVector3 side1, const dVector3 p2,
1350 const dMatrix3 R2, const dVector3 side2,
1351 dVector3 normal, dReal *depth, int *return_code,
1352 int flags, dContactGeom *contact, int skip);
1353
1354ODE_API void dInfiniteAABB (dGeomID geom, dReal aabb[6]);
1355ODE_API void dInitODE(void);
1356ODE_API void dCloseODE(void);
1357
1358/* ************************************************************************ */
1359/* custom classes */
1360
1361typedef void dGetAABBFn (dGeomID, dReal aabb[6]);
1362typedef int dColliderFn (dGeomID o1, dGeomID o2,
1363 int flags, dContactGeom *contact, int skip);
1364typedef dColliderFn * dGetColliderFnFn (int num);
1365typedef void dGeomDtorFn (dGeomID o);
1366typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);
1367
1368typedef struct dGeomClass {
1369 int bytes;
1370 dGetColliderFnFn *collider;
1371 dGetAABBFn *aabb;
1372 dAABBTestFn *aabb_test;
1373 dGeomDtorFn *dtor;
1374} dGeomClass;
1375
1376ODE_API int dCreateGeomClass (const dGeomClass *classptr);
1377ODE_API void * dGeomGetClassData (dGeomID);
1378ODE_API dGeomID dCreateGeom (int classnum);
1379
1380/* ************************************************************************ */
1381
1382#ifdef __cplusplus
1383}
1384#endif
1385
1386#endif