|
31 | 31 | extern "C" { |
32 | 32 | #endif |
33 | 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 | + |
34 | 49 | /* ************************************************************************ */ |
35 | 50 | /* general functions */ |
36 | 51 |
|
37 | | -void dGeomDestroy (dGeomID); |
38 | | -void dGeomSetData (dGeomID, void *); |
39 | | -void *dGeomGetData (dGeomID); |
40 | | -void dGeomSetBody (dGeomID, dBodyID); |
41 | | -dBodyID dGeomGetBody (dGeomID); |
42 | | -void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z); |
43 | | -void dGeomSetRotation (dGeomID, const dMatrix3 R); |
44 | | -void dGeomSetQuaternion (dGeomID, const dQuaternion); |
45 | | -const dReal * dGeomGetPosition (dGeomID); |
46 | | -const dReal * dGeomGetRotation (dGeomID); |
47 | | -void dGeomGetQuaternion (dGeomID, dQuaternion result); |
48 | | -void dGeomGetAABB (dGeomID, dReal aabb[6]); |
49 | | -int dGeomIsSpace (dGeomID); |
| 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 | + */ |
| 65 | +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 | + */ |
| 75 | +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 | + */ |
| 84 | +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 | + */ |
| 105 | +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 | + */ |
| 114 | +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 | + */ |
| 131 | +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 | + */ |
| 146 | +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 | + */ |
| 162 | +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 | + */ |
| 181 | +const dReal * dGeomGetPosition (dGeomID geom); |
| 182 | + |
| 183 | + |
| 184 | +/** |
| 185 | + * @brief Get the rotation matrix of a placeable geom. |
| 186 | + * |
| 187 | + * If the geom is attached to a body, the body's rotation will be returned. |
| 188 | + * |
| 189 | + * Calling this function on a non-placeable geom results in a runtime error in |
| 190 | + * the debug build of ODE. |
| 191 | + * |
| 192 | + * @param geom the geom to query. |
| 193 | + * @returns A pointer to the geom's rotation matrix. |
| 194 | + * @remarks The returned value is a pointer to the geom's internal |
| 195 | + * data structure. It is valid until any changes are made |
| 196 | + * to the geom. |
| 197 | + * @sa dBodyGetRotation |
| 198 | + * @ingroup collide |
| 199 | + */ |
| 200 | +const dReal * dGeomGetRotation (dGeomID geom); |
| 201 | + |
| 202 | + |
| 203 | +/** |
| 204 | + * @brief Get the rotation quaternion of a placeable geom. |
| 205 | + * |
| 206 | + * If the geom is attached to a body, the body's quaternion will be returned. |
| 207 | + * |
| 208 | + * Calling this function on a non-placeable geom results in a runtime error in |
| 209 | + * the debug build of ODE. |
| 210 | + * |
| 211 | + * @param geom the geom to query. |
| 212 | + * @param result a copy of the rotation quaternion. |
| 213 | + * @sa dBodyGetQuaternion |
| 214 | + * @ingroup collide |
| 215 | + */ |
| 216 | +void dGeomGetQuaternion (dGeomID geom, dQuaternion result); |
| 217 | + |
| 218 | + |
| 219 | +/** |
| 220 | + * @brief Return the axis-aligned bounding box. |
| 221 | + * |
| 222 | + * Return in aabb an axis aligned bounding box that surrounds the given geom. |
| 223 | + * The aabb array has elements (minx, maxx, miny, maxy, minz, maxz). If the |
| 224 | + * geom is a space, a bounding box that surrounds all contained geoms is |
| 225 | + * returned. |
| 226 | + * |
| 227 | + * This function may return a pre-computed cached bounding box, if it can |
| 228 | + * determine that the geom has not moved since the last time the bounding |
| 229 | + * box was computed. |
| 230 | + * |
| 231 | + * @param geom the geom to query |
| 232 | + * @param aabb the returned bounding box |
| 233 | + * @ingroup collide |
| 234 | + */ |
| 235 | +void dGeomGetAABB (dGeomID geom, dReal aabb[6]); |
| 236 | + |
| 237 | + |
| 238 | +/** |
| 239 | + * @brief Determing if a geom is a space. |
| 240 | + * @param geom the geom to query |
| 241 | + * @returns Non-zero if the geom is a space, zero otherwise. |
| 242 | + * @ingroup collide |
| 243 | + */ |
| 244 | +int dGeomIsSpace (dGeomID geom); |
| 245 | + |
| 246 | + |
| 247 | +/** |
| 248 | + * @brief Query for the space containing a particular geom. |
| 249 | + * @param geom the geom to query |
| 250 | + * @returns The space that contains the geom, or NULL if the geom is |
| 251 | + * not contained by a space. |
| 252 | + * @ingroup collide |
| 253 | + */ |
50 | 254 | dSpaceID dGeomGetSpace (dGeomID); |
51 | | -int dGeomGetClass (dGeomID); |
52 | | -void dGeomSetCategoryBits (dGeomID, unsigned long bits); |
53 | | -void dGeomSetCollideBits (dGeomID, unsigned long bits); |
| 255 | + |
| 256 | + |
| 257 | +/** |
| 258 | + * @brief Given a geom, this returns its class. |
| 259 | + * |
| 260 | + * The ODE classes are: |
| 261 | + * @li dSphereClass |
| 262 | + * @li dBoxClass |
| 263 | + * @li dCylinderClass |
| 264 | + * @li dPlaneClass |
| 265 | + * @li dRayClass |
| 266 | + * @li dConvexClass |
| 267 | + * @li dGeomTransformClass |
| 268 | + * @li dTriMeshClass |
| 269 | + * @li dSimpleSpaceClass |
| 270 | + * @li dHashSpaceClass |
| 271 | + * @li dQuadTreeSpaceClass |
| 272 | + * @li dFirstUserClass |
| 273 | + * @li dLastUserClass |
| 274 | + * |
| 275 | + * User-defined class will return their own number. |
| 276 | + * |
| 277 | + * @param geom the geom to query |
| 278 | + * @returns The geom class ID. |
| 279 | + * @ingroup collide |
| 280 | + */ |
| 281 | +int dGeomGetClass (dGeomID geom); |
| 282 | + |
| 283 | + |
| 284 | +/** |
| 285 | + * @brief Set the "category" bitfield for the given geom. |
| 286 | + * |
| 287 | + * The category bitfield is used by spaces to govern which geoms will |
| 288 | + * interact with each other. The bitfield is guaranteed to be at least |
| 289 | + * 32 bits wide. The default category values for newly created geoms |
| 290 | + * have all bits set. |
| 291 | + * |
| 292 | + * @param geom the geom to set |
| 293 | + * @param bits the new bitfield value |
| 294 | + * @ingroup collide |
| 295 | + */ |
| 296 | +void dGeomSetCategoryBits (dGeomID geom, unsigned long bits); |
| 297 | + |
| 298 | + |
| 299 | +/** |
| 300 | + * @brief Set the "collide" bitfield for the given geom. |
| 301 | + * |
| 302 | + * The collide bitfield is used by spaces to govern which geoms will |
| 303 | + * interact with each other. The bitfield is guaranteed to be at least |
| 304 | + * 32 bits wide. The default category values for newly created geoms |
| 305 | + * have all bits set. |
| 306 | + * |
| 307 | + * @param geom the geom to set |
| 308 | + * @param bits the new bitfield value |
| 309 | + * @ingroup collide |
| 310 | + */ |
| 311 | +void dGeomSetCollideBits (dGeomID geom, unsigned long bits); |
| 312 | + |
| 313 | + |
| 314 | +/** |
| 315 | + * @brief Get the "category" bitfield for the given geom. |
| 316 | + * |
| 317 | + * @param geom the geom to set |
| 318 | + * @param bits the new bitfield value |
| 319 | + * @sa dGeomSetCategoryBits |
| 320 | + * @ingroup collide |
| 321 | + */ |
54 | 322 | unsigned long dGeomGetCategoryBits (dGeomID); |
| 323 | + |
| 324 | + |
| 325 | +/** |
| 326 | + * @brief Get the "collide" bitfield for the given geom. |
| 327 | + * |
| 328 | + * @param geom the geom to set |
| 329 | + * @param bits the new bitfield value |
| 330 | + * @sa dGeomSetCollideBits |
| 331 | + * @ingroup collide |
| 332 | + */ |
55 | 333 | unsigned long dGeomGetCollideBits (dGeomID); |
56 | | -void dGeomEnable (dGeomID); |
57 | | -void dGeomDisable (dGeomID); |
58 | | -int dGeomIsEnabled (dGeomID); |
| 334 | + |
| 335 | + |
| 336 | +/** |
| 337 | + * @brief Enable a geom. |
| 338 | + * |
| 339 | + * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, |
| 340 | + * although they can still be members of a space. New geoms are created in |
| 341 | + * the enabled state. |
| 342 | + * |
| 343 | + * @param geom the geom to enable |
| 344 | + * @sa dGeomDisable |
| 345 | + * @sa dGeomIsEnabled |
| 346 | + * @ingroup collide |
| 347 | + */ |
| 348 | +void dGeomEnable (dGeomID geom); |
| 349 | + |
| 350 | + |
| 351 | +/** |
| 352 | + * @brief Disable a geom. |
| 353 | + * |
| 354 | + * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, |
| 355 | + * although they can still be members of a space. New geoms are created in |
| 356 | + * the enabled state. |
| 357 | + * |
| 358 | + * @param geom the geom to disable |
| 359 | + * @sa dGeomDisable |
| 360 | + * @sa dGeomIsEnabled |
| 361 | + * @ingroup collide |
| 362 | + */ |
| 363 | +void dGeomDisable (dGeomID geom); |
| 364 | + |
| 365 | + |
| 366 | +/** |
| 367 | + * @brief Check to see if a geom is enabled. |
| 368 | + * |
| 369 | + * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, |
| 370 | + * although they can still be members of a space. New geoms are created in |
| 371 | + * the enabled state. |
| 372 | + * |
| 373 | + * @param geom the geom to query |
| 374 | + * @returns Non-zero if the geom is enabled, zero otherwise. |
| 375 | + * @sa dGeomDisable |
| 376 | + * @sa dGeomIsEnabled |
| 377 | + * @ingroup collide |
| 378 | + */ |
| 379 | +int dGeomIsEnabled (dGeomID geom); |
| 380 | + |
| 381 | + |
59 | 382 |
|
60 | 383 | /* ************************************************************************ */ |
61 | 384 | /* collision detection */ |
@@ -156,7 +479,7 @@ int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1, |
156 | 479 | const dMatrix3 R2, const dVector3 side2); |
157 | 480 |
|
158 | 481 | void dInfiniteAABB (dGeomID geom, dReal aabb[6]); |
159 | | -void dCloseODE(); |
| 482 | +void dCloseODE(void); |
160 | 483 |
|
161 | 484 | /* ************************************************************************ */ |
162 | 485 | /* custom classes */ |
|
0 commit comments