3 /*************************************************************************
5 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
6 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of EITHER: *
10 * (1) The GNU Lesser General Public License as published by the Free *
11 * Software Foundation; either version 2.1 of the License, or (at *
12 * your option) any later version. The text of the GNU Lesser *
13 * General Public License is included with this library in the *
15 * (2) The BSD-style license that is included with this library in *
16 * the file LICENSE-BSD.TXT. *
18 * This library is distributed in the hope that it will be useful, *
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
21 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
23 *************************************************************************/
25 #ifndef _ODE_OBJECTS_H_
26 #define _ODE_OBJECTS_H_
28 #include <ode/common.h>
30 #include <ode/contact.h>
37 * @defgroup world World
39 * The world object is a container for rigid bodies and joints. Objects in
40 * different worlds can not interact, for example rigid bodies from two
41 * different worlds can not collide.
43 * All the objects in a world exist at the same point in time, thus one
44 * reason to use separate worlds is to simulate systems at different rates.
45 * Most applications will only need one world.
50 * @brief Create a new, empty world and return its ID number.
51 * @return an identifier
54 ODE_API dWorldID dWorldCreate(void);
58 * @brief Destroy a world and everything in it.
60 * This includes all bodies, and all joints that are not part of a joint
61 * group. Joints that are part of a joint group will be deactivated, and
62 * can be destroyed by calling, for example, dJointGroupEmpty().
64 * @param world the identifier for the world the be destroyed.
66 ODE_API void dWorldDestroy (dWorldID world);
70 * @brief Set the world's global gravity vector.
72 * The units are m/s^2, so Earth's gravity vector would be (0,0,-9.81),
73 * assuming that +z is up. The default is no gravity, i.e. (0,0,0).
77 ODE_API void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z);
81 * @brief Get the gravity vector for a given world.
84 ODE_API void dWorldGetGravity (dWorldID, dVector3 gravity);
88 * @brief Set the global ERP value, that controls how much error
89 * correction is performed in each time step.
91 * @param dWorldID the identifier of the world.
92 * @param erp Typical values are in the range 0.1--0.8. The default is 0.2.
94 ODE_API void dWorldSetERP (dWorldID, dReal erp);
97 * @brief Get the error reduction parameter.
101 ODE_API dReal dWorldGetERP (dWorldID);
105 * @brief Set the global CFM (constraint force mixing) value.
107 * @param cfm Typical values are in the range @m{10^{-9}} -- 1.
108 * The default is 10^-5 if single precision is being used, or 10^-10
109 * if double precision is being used.
111 ODE_API void dWorldSetCFM (dWorldID, dReal cfm);
114 * @brief Get the constraint force mixing value.
118 ODE_API dReal dWorldGetCFM (dWorldID);
122 * @brief Set the world to use shared working memory along with another world.
124 * The worlds allocate working memory internally for simulation stepping. This
125 * memory is cached among the calls to @c dWordStep and @c dWorldQuickStep.
126 * Similarly, several worlds can be set up to share this memory caches thus
127 * reducing overall memory usage by cost of making worlds inappropriate for
128 * simultaneous simulation in multiple threads.
130 * If null value is passed for @a from_world parameter the world is detached from
131 * sharing and returns to defaults for working memory, reservation policy and
132 * memory manager as if just created. This can also be used to enable use of shared
133 * memory for a world that has already had working memory allocated privately.
134 * Normally using shared memory after a world has its private working memory allocated
137 * Allocation policy used can only increase world's internal reserved memory size
138 * and never decreases it. @c dWorldCleanupWorkingMemory can be used to release
139 * working memory for a world in case if number of objects/joint decreases
140 * significantly in it.
142 * With sharing working memory worlds also automatically share memory reservation
143 * policy and memory manager. Thus, these parameters need to be customized for
144 * initial world to be used as sharing source only.
146 * Failure result status means a memory allocation failure.
148 * @param w The world to use the shared memory with.
149 * @param from_world Null or the world the shared memory is to be used from.
150 * @returns 1 for success and 0 for failure.
153 * @see dWorldCleanupWorkingMemory
154 * @see dWorldSetStepMemoryReservationPolicy
155 * @see dWorldSetStepMemoryManager
157 ODE_API int dWorldUseSharedWorkingMemory(dWorldID w, dWorldID from_world/*=NULL*/);
160 * @brief Release internal working memory allocated for world
162 * The worlds allocate working memory internally for simulation stepping. This
163 * function can be used to free world's internal memory cache in case if number of
164 * objects/joints in the world decreases significantly. By default, internal
165 * allocation policy is used to only increase cache size as necessary and never
168 * If a world shares its working memory with other worlds the cache deletion
169 * affects all the linked worlds. However the shared status itself remains intact.
171 * The function call does affect neither memory reservation policy nor memory manager.
173 * @param w The world to release working memory for.
176 * @see dWorldUseSharedWorkingMemory
177 * @see dWorldSetStepMemoryReservationPolicy
178 * @see dWorldSetStepMemoryManager
180 ODE_API void dWorldCleanupWorkingMemory(dWorldID w);
182 #define dWORLDSTEP_RESERVEFACTOR_DEFAULT 1.2f
183 #define dWORLDSTEP_RESERVESIZE_DEFAULT 65536U
186 * @struct dWorldStepReserveInfo
187 * @brief Memory reservation policy descriptor structure for world stepping functions.
189 * @c struct_size should be assigned the size of the structure.
191 * @c reserve_factor is a quotient that is multiplied by required memory size
192 * to allocate extra reserve whenever reallocation is needed.
194 * @c reserve_minimum is a minimum size that is checked against whenever reallocation
195 * is needed to allocate expected working memory minimum at once without extra
196 * reallocations as number of bodies/joints grows.
199 * @see dWorldSetStepMemoryReservationPolicy
203 unsigned struct_size;
204 float reserve_factor; // Use float as precision does not matter here
205 unsigned reserve_minimum;
207 } dWorldStepReserveInfo;
210 * @brief Set memory reservation policy for world to be used with simulation stepping functions
212 * The function allows to customize reservation policy to be used for internal
213 * memory which is allocated to aid simulation for a world. By default, values
214 * of @c dWORLDSTEP_RESERVEFACTOR_DEFAULT and @c dWORLDSTEP_RESERVESIZE_DEFAULT
217 * Passing @a policyinfo argument as NULL results in reservation policy being
218 * reset to defaults as if the world has been just created. The content of
219 * @a policyinfo structure is copied internally and does not need to remain valid
220 * after the call returns.
222 * If the world uses working memory sharing, changing memory reservation policy
223 * affects all the worlds linked together.
225 * Failure result status means a memory allocation failure.
227 * @param w The world to change memory reservation policy for.
228 * @param policyinfo Null or a pointer to policy descriptor structure.
229 * @returns 1 for success and 0 for failure.
232 * @see dWorldUseSharedWorkingMemory
234 ODE_API int dWorldSetStepMemoryReservationPolicy(dWorldID w, const dWorldStepReserveInfo *policyinfo/*=NULL*/);
237 * @struct dWorldStepMemoryFunctionsInfo
238 * @brief World stepping memory manager descriptor structure
240 * This structure is intended to define the functions of memory manager to be used
241 * with world stepping functions.
243 * @c struct_size should be assigned the size of the structure
245 * @c alloc_block is a function to allocate memory block of given size.
247 * @c shrink_block is a function to shrink existing memory block to a smaller size.
248 * It must preserve the contents of block head while shrinking. The new block size
249 * is guaranteed to be always less than the existing one.
251 * @c free_block is a function to delete existing memory block.
254 * @see dWorldSetStepMemoryManager
258 unsigned struct_size;
259 void *(*alloc_block)(size_t block_size);
260 void *(*shrink_block)(void *block_pointer, size_t block_current_size, size_t block_smaller_size);
261 void (*free_block)(void *block_pointer, size_t block_current_size);
263 } dWorldStepMemoryFunctionsInfo;
266 * @brief Set memory manager for world to be used with simulation stepping functions
268 * The function allows to customize memory manager to be used for internal
269 * memory allocation during simulation for a world. By default, @c dAlloc/@c dRealloc/@c dFree
270 * based memory manager is used.
272 * Passing @a memfuncs argument as NULL results in memory manager being
273 * reset to default one as if the world has been just created. The content of
274 * @a memfuncs structure is copied internally and does not need to remain valid
275 * after the call returns.
277 * If the world uses working memory sharing, changing memory manager
278 * affects all the worlds linked together.
280 * Failure result status means a memory allocation failure.
282 * @param w The world to change memory reservation policy for.
283 * @param memfuncs Null or a pointer to memory manager descriptor structure.
284 * @returns 1 for success and 0 for failure.
287 * @see dWorldUseSharedWorkingMemory
289 ODE_API int dWorldSetStepMemoryManager(dWorldID w, const dWorldStepMemoryFunctionsInfo *memfuncs);
292 * @brief Step the world.
294 * This uses a "big matrix" method that takes time on the order of m^3
295 * and memory on the order of m^2, where m is the total number of constraint
296 * rows. For large systems this will use a lot of memory and can be very slow,
297 * but this is currently the most accurate method.
299 * Failure result status means that the memory allocation has failed for operation.
300 * In such a case all the objects remain in unchanged state and simulation can be
301 * retried as soon as more memory is available.
303 * @param w The world to be stepped
304 * @param stepsize The number of seconds that the simulation has to advance.
305 * @returns 1 for success and 0 for failure
309 ODE_API int dWorldStep (dWorldID w, dReal stepsize);
312 * @brief Quick-step the world.
314 * This uses an iterative method that takes time on the order of m*N
315 * and memory on the order of m, where m is the total number of constraint
316 * rows N is the number of iterations.
317 * For large systems this is a lot faster than dWorldStep(),
318 * but it is less accurate.
320 * QuickStep is great for stacks of objects especially when the
321 * auto-disable feature is used as well.
322 * However, it has poor accuracy for near-singular systems.
323 * Near-singular systems can occur when using high-friction contacts, motors,
324 * or certain articulated structures. For example, a robot with multiple legs
325 * sitting on the ground may be near-singular.
327 * There are ways to help overcome QuickStep's inaccuracy problems:
330 * \li Reduce the number of contacts in your system (e.g. use the minimum
331 * number of contacts for the feet of a robot or creature).
332 * \li Don't use excessive friction in the contacts.
333 * \li Use contact slip if appropriate
334 * \li Avoid kinematic loops (however, kinematic loops are inevitable in
336 * \li Don't use excessive motor strength.
337 * \liUse force-based motors instead of velocity-based motors.
339 * Increasing the number of QuickStep iterations may help a little bit, but
340 * it is not going to help much if your system is really near singular.
342 * Failure result status means that the memory allocation has failed for operation.
343 * In such a case all the objects remain in unchanged state and simulation can be
344 * retried as soon as more memory is available.
346 * @param w The world to be stepped
347 * @param stepsize The number of seconds that the simulation has to advance.
348 * @returns 1 for success and 0 for failure
352 ODE_API int dWorldQuickStep (dWorldID w, dReal stepsize);
356 * @brief Converts an impulse to a force.
359 * If you want to apply a linear or angular impulse to a rigid body,
360 * instead of a force or a torque, then you can use this function to convert
361 * the desired impulse into a force/torque vector before calling the
362 * BodyAdd... function.
363 * The current algorithm simply scales the impulse by 1/stepsize,
364 * where stepsize is the step size for the next step that will be taken.
365 * This function is given a dWorldID because, in the future, the force
366 * computation may depend on integrator parameters that are set as
367 * properties of the world.
369 ODE_API void dWorldImpulseToForce
371 dWorldID, dReal stepsize,
372 dReal ix, dReal iy, dReal iz, dVector3 force
377 * @brief Set the number of iterations that the QuickStep method performs per
381 * More iterations will give a more accurate solution, but will take
383 * @param num The default is 20 iterations.
385 ODE_API void dWorldSetQuickStepNumIterations (dWorldID, int num);
389 * @brief Get the number of iterations that the QuickStep method performs per
392 * @return nr of iterations
394 ODE_API int dWorldGetQuickStepNumIterations (dWorldID);
397 * @brief Set the SOR over-relaxation parameter
399 * @param over_relaxation value to use by SOR
401 ODE_API void dWorldSetQuickStepW (dWorldID, dReal over_relaxation);
404 * @brief Get the SOR over-relaxation parameter
406 * @returns the over-relaxation setting
408 ODE_API dReal dWorldGetQuickStepW (dWorldID);
410 /* World contact parameter functions */
413 * @brief Set the maximum correcting velocity that contacts are allowed
416 * @param vel The default value is infinity (i.e. no limit).
418 * Reducing this value can help prevent "popping" of deeply embedded objects.
420 ODE_API void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel);
423 * @brief Get the maximum correcting velocity that contacts are allowed
427 ODE_API dReal dWorldGetContactMaxCorrectingVel (dWorldID);
430 * @brief Set the depth of the surface layer around all geometry objects.
433 * Contacts are allowed to sink into the surface layer up to the given
434 * depth before coming to rest.
435 * @param depth The default value is zero.
437 * Increasing this to some small value (e.g. 0.001) can help prevent
438 * jittering problems due to contacts being repeatedly made and broken.
440 ODE_API void dWorldSetContactSurfaceLayer (dWorldID, dReal depth);
443 * @brief Get the depth of the surface layer around all geometry objects.
447 ODE_API dReal dWorldGetContactSurfaceLayer (dWorldID);
451 * @defgroup disable Automatic Enabling and Disabling
452 * @ingroup world bodies
454 * Every body can be enabled or disabled. Enabled bodies participate in the
455 * simulation, while disabled bodies are turned off and do not get updated
456 * during a simulation step. New bodies are always created in the enabled state.
458 * A disabled body that is connected through a joint to an enabled body will be
459 * automatically re-enabled at the next simulation step.
461 * Disabled bodies do not consume CPU time, therefore to speed up the simulation
462 * bodies should be disabled when they come to rest. This can be done automatically
463 * with the auto-disable feature.
465 * If a body has its auto-disable flag turned on, it will automatically disable
467 * @li It has been idle for a given number of simulation steps.
468 * @li It has also been idle for a given amount of simulation time.
470 * A body is considered to be idle when the magnitudes of both its
471 * linear average velocity and angular average velocity are below given thresholds.
472 * The sample size for the average defaults to one and can be disabled by setting
475 * Thus, every body has six auto-disable parameters: an enabled flag, a idle step
476 * count, an idle time, linear/angular average velocity thresholds, and the
477 * average samples count.
479 * Newly created bodies get these parameters from world.
483 * @brief Get auto disable linear threshold for newly created bodies.
485 * @return the threshold
487 ODE_API dReal dWorldGetAutoDisableLinearThreshold (dWorldID);
490 * @brief Set auto disable linear threshold for newly created bodies.
491 * @param linear_threshold default is 0.01
494 ODE_API void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold);
497 * @brief Get auto disable angular threshold for newly created bodies.
499 * @return the threshold
501 ODE_API dReal dWorldGetAutoDisableAngularThreshold (dWorldID);
504 * @brief Set auto disable angular threshold for newly created bodies.
505 * @param linear_threshold default is 0.01
508 ODE_API void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold);
511 * @brief Get auto disable linear average threshold for newly created bodies.
513 * @return the threshold
515 ODE_API dReal dWorldGetAutoDisableLinearAverageThreshold (dWorldID);
518 * @brief Set auto disable linear average threshold for newly created bodies.
519 * @param linear_average_threshold default is 0.01
522 ODE_API void dWorldSetAutoDisableLinearAverageThreshold (dWorldID, dReal linear_average_threshold);
525 * @brief Get auto disable angular average threshold for newly created bodies.
527 * @return the threshold
529 ODE_API dReal dWorldGetAutoDisableAngularAverageThreshold (dWorldID);
532 * @brief Set auto disable angular average threshold for newly created bodies.
533 * @param linear_average_threshold default is 0.01
536 ODE_API void dWorldSetAutoDisableAngularAverageThreshold (dWorldID, dReal angular_average_threshold);
539 * @brief Get auto disable sample count for newly created bodies.
541 * @return number of samples used
543 ODE_API int dWorldGetAutoDisableAverageSamplesCount (dWorldID);
546 * @brief Set auto disable average sample count for newly created bodies.
548 * @param average_samples_count Default is 1, meaning only instantaneous velocity is used.
549 * Set to zero to disable sampling and thus prevent any body from auto-disabling.
551 ODE_API void dWorldSetAutoDisableAverageSamplesCount (dWorldID, unsigned int average_samples_count );
554 * @brief Get auto disable steps for newly created bodies.
556 * @return nr of steps
558 ODE_API int dWorldGetAutoDisableSteps (dWorldID);
561 * @brief Set auto disable steps for newly created bodies.
563 * @param steps default is 10
565 ODE_API void dWorldSetAutoDisableSteps (dWorldID, int steps);
568 * @brief Get auto disable time for newly created bodies.
570 * @return nr of seconds
572 ODE_API dReal dWorldGetAutoDisableTime (dWorldID);
575 * @brief Set auto disable time for newly created bodies.
577 * @param time default is 0 seconds
579 ODE_API void dWorldSetAutoDisableTime (dWorldID, dReal time);
582 * @brief Get auto disable flag for newly created bodies.
586 ODE_API int dWorldGetAutoDisableFlag (dWorldID);
589 * @brief Set auto disable flag for newly created bodies.
591 * @param do_auto_disable default is false.
593 ODE_API void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable);
597 * @defgroup damping Damping
598 * @ingroup bodies world
600 * Damping serves two purposes: reduce simulation instability, and to allow
601 * the bodies to come to rest (and possibly auto-disabling them).
603 * Bodies are constructed using the world's current damping parameters. Setting
604 * the scales to 0 disables the damping.
606 * Here is how it is done: after every time step linear and angular
607 * velocities are tested against the corresponding thresholds. If they
608 * are above, they are multiplied by (1 - scale). So a negative scale value
609 * will actually increase the speed, and values greater than one will
610 * make the object oscillate every step; both can make the simulation unstable.
612 * To disable damping just set the damping scale to zero.
614 * You can also limit the maximum angular velocity. In contrast to the damping
615 * functions, the angular velocity is affected before the body is moved.
616 * This means that it will introduce errors in joints that are forcing the body
617 * to rotate too fast. Some bodies have naturally high angular velocities
618 * (like cars' wheels), so you may want to give them a very high (like the default,
621 * @note The velocities are damped after the stepper function has moved the
622 * object. Otherwise the damping could introduce errors in joints. First the
623 * joint constraints are processed by the stepper (moving the body), then
624 * the damping is applied.
626 * @note The damping happens right after the moved callback is called; this way
627 * it still possible use the exact velocities the body has acquired during the
628 * step. You can even use the callback to create your own customized damping.
632 * @brief Get the world's linear damping threshold.
635 ODE_API dReal dWorldGetLinearDampingThreshold (dWorldID w);
638 * @brief Set the world's linear damping threshold.
639 * @param threshold The damping won't be applied if the linear speed is
640 * below this threshold. Default is 0.01.
643 ODE_API void dWorldSetLinearDampingThreshold(dWorldID w, dReal threshold);
646 * @brief Get the world's angular damping threshold.
649 ODE_API dReal dWorldGetAngularDampingThreshold (dWorldID w);
652 * @brief Set the world's angular damping threshold.
653 * @param threshold The damping won't be applied if the angular speed is
654 * below this threshold. Default is 0.01.
657 ODE_API void dWorldSetAngularDampingThreshold(dWorldID w, dReal threshold);
660 * @brief Get the world's linear damping scale.
663 ODE_API dReal dWorldGetLinearDamping (dWorldID w);
666 * @brief Set the world's linear damping scale.
667 * @param scale The linear damping scale that is to be applied to bodies.
668 * Default is 0 (no damping). Should be in the interval [0, 1].
671 ODE_API void dWorldSetLinearDamping (dWorldID w, dReal scale);
674 * @brief Get the world's angular damping scale.
677 ODE_API dReal dWorldGetAngularDamping (dWorldID w);
680 * @brief Set the world's angular damping scale.
681 * @param scale The angular damping scale that is to be applied to bodies.
682 * Default is 0 (no damping). Should be in the interval [0, 1].
685 ODE_API void dWorldSetAngularDamping(dWorldID w, dReal scale);
688 * @brief Convenience function to set body linear and angular scales.
689 * @param linear_scale The linear damping scale that is to be applied to bodies.
690 * @param angular_scale The angular damping scale that is to be applied to bodies.
693 ODE_API void dWorldSetDamping(dWorldID w,
695 dReal angular_scale);
698 * @brief Get the default maximum angular speed.
700 * @sa dBodyGetMaxAngularSpeed()
702 ODE_API dReal dWorldGetMaxAngularSpeed (dWorldID w);
706 * @brief Set the default maximum angular speed for new bodies.
708 * @sa dBodySetMaxAngularSpeed()
710 ODE_API void dWorldSetMaxAngularSpeed (dWorldID w, dReal max_speed);
715 * @defgroup bodies Rigid Bodies
717 * A rigid body has various properties from the point of view of the
718 * simulation. Some properties change over time:
720 * @li Position vector (x,y,z) of the body's point of reference.
721 * Currently the point of reference must correspond to the body's center of mass.
722 * @li Linear velocity of the point of reference, a vector (vx,vy,vz).
723 * @li Orientation of a body, represented by a quaternion (qs,qx,qy,qz) or
724 * a 3x3 rotation matrix.
725 * @li Angular velocity vector (wx,wy,wz) which describes how the orientation
728 * Other body properties are usually constant over time:
730 * @li Mass of the body.
731 * @li Position of the center of mass with respect to the point of reference.
732 * In the current implementation the center of mass and the point of
733 * reference must coincide.
734 * @li Inertia matrix. This is a 3x3 matrix that describes how the body's mass
735 * is distributed around the center of mass. Conceptually each body has an
736 * x-y-z coordinate frame embedded in it that moves and rotates with the body.
738 * The origin of this coordinate frame is the body's point of reference. Some values
739 * in ODE (vectors, matrices etc) are relative to the body coordinate frame, and others
740 * are relative to the global coordinate frame.
742 * Note that the shape of a rigid body is not a dynamical property (except insofar as
743 * it influences the various mass properties). It is only collision detection that cares
744 * about the detailed shape of the body.
749 * @brief Get auto disable linear average threshold.
750 * @ingroup bodies disable
751 * @return the threshold
753 ODE_API dReal dBodyGetAutoDisableLinearThreshold (dBodyID);
756 * @brief Set auto disable linear average threshold.
757 * @ingroup bodies disable
758 * @return the threshold
760 ODE_API void dBodySetAutoDisableLinearThreshold (dBodyID, dReal linear_average_threshold);
763 * @brief Get auto disable angular average threshold.
764 * @ingroup bodies disable
765 * @return the threshold
767 ODE_API dReal dBodyGetAutoDisableAngularThreshold (dBodyID);
770 * @brief Set auto disable angular average threshold.
771 * @ingroup bodies disable
772 * @return the threshold
774 ODE_API void dBodySetAutoDisableAngularThreshold (dBodyID, dReal angular_average_threshold);
777 * @brief Get auto disable average size (samples count).
778 * @ingroup bodies disable
779 * @return the nr of steps/size.
781 ODE_API int dBodyGetAutoDisableAverageSamplesCount (dBodyID);
784 * @brief Set auto disable average buffer size (average steps).
785 * @ingroup bodies disable
786 * @param average_samples_count the nr of samples to review.
788 ODE_API void dBodySetAutoDisableAverageSamplesCount (dBodyID, unsigned int average_samples_count);
792 * @brief Get auto steps a body must be thought of as idle to disable
793 * @ingroup bodies disable
794 * @return the nr of steps
796 ODE_API int dBodyGetAutoDisableSteps (dBodyID);
799 * @brief Set auto disable steps.
800 * @ingroup bodies disable
801 * @param steps the nr of steps.
803 ODE_API void dBodySetAutoDisableSteps (dBodyID, int steps);
806 * @brief Get auto disable time.
807 * @ingroup bodies disable
808 * @return nr of seconds
810 ODE_API dReal dBodyGetAutoDisableTime (dBodyID);
813 * @brief Set auto disable time.
814 * @ingroup bodies disable
815 * @param time nr of seconds.
817 ODE_API void dBodySetAutoDisableTime (dBodyID, dReal time);
820 * @brief Get auto disable flag.
821 * @ingroup bodies disable
824 ODE_API int dBodyGetAutoDisableFlag (dBodyID);
827 * @brief Set auto disable flag.
828 * @ingroup bodies disable
829 * @param do_auto_disable 0 or 1
831 ODE_API void dBodySetAutoDisableFlag (dBodyID, int do_auto_disable);
834 * @brief Set auto disable defaults.
836 * Set the values for the body to those set as default for the world.
837 * @ingroup bodies disable
839 ODE_API void dBodySetAutoDisableDefaults (dBodyID);
843 * @brief Retrieves the world attached to te given body.
848 ODE_API dWorldID dBodyGetWorld (dBodyID);
851 * @brief Create a body in given world.
853 * Default mass parameters are at position (0,0,0).
856 ODE_API dBodyID dBodyCreate (dWorldID);
859 * @brief Destroy a body.
861 * All joints that are attached to this body will be put into limbo:
862 * i.e. unattached and not affecting the simulation, but they will NOT be
866 ODE_API void dBodyDestroy (dBodyID);
869 * @brief Set the body's user-data pointer.
871 * @param data arbitraty pointer
873 ODE_API void dBodySetData (dBodyID, void *data);
876 * @brief Get the body's user-data pointer.
878 * @return a pointer to the user's data.
880 ODE_API void *dBodyGetData (dBodyID);
883 * @brief Set position of a body.
885 * After setting, the outcome of the simulation is undefined
886 * if the new configuration is inconsistent with the joints/constraints
890 ODE_API void dBodySetPosition (dBodyID, dReal x, dReal y, dReal z);
893 * @brief Set the orientation of a body.
896 * After setting, the outcome of the simulation is undefined
897 * if the new configuration is inconsistent with the joints/constraints
900 ODE_API void dBodySetRotation (dBodyID, const dMatrix3 R);
903 * @brief Set the orientation of a body.
906 * After setting, the outcome of the simulation is undefined
907 * if the new configuration is inconsistent with the joints/constraints
910 ODE_API void dBodySetQuaternion (dBodyID, const dQuaternion q);
913 * @brief Set the linear velocity of a body.
916 ODE_API void dBodySetLinearVel (dBodyID, dReal x, dReal y, dReal z);
919 * @brief Set the angular velocity of a body.
922 ODE_API void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z);
925 * @brief Get the position of a body.
928 * When getting, the returned values are pointers to internal data structures,
929 * so the vectors are valid until any changes are made to the rigid body
931 * @sa dBodyCopyPosition
933 ODE_API const dReal * dBodyGetPosition (dBodyID);
937 * @brief Copy the position of a body into a vector.
939 * @param body the body to query
940 * @param pos a copy of the body position
941 * @sa dBodyGetPosition
943 ODE_API void dBodyCopyPosition (dBodyID body, dVector3 pos);
947 * @brief Get the rotation of a body.
949 * @return pointer to a 4x3 rotation matrix.
951 ODE_API const dReal * dBodyGetRotation (dBodyID);
955 * @brief Copy the rotation of a body.
957 * @param body the body to query
958 * @param R a copy of the rotation matrix
959 * @sa dBodyGetRotation
961 ODE_API void dBodyCopyRotation (dBodyID, dMatrix3 R);
965 * @brief Get the rotation of a body.
967 * @return pointer to 4 scalars that represent the quaternion.
969 ODE_API const dReal * dBodyGetQuaternion (dBodyID);
973 * @brief Copy the orientation of a body into a quaternion.
975 * @param body the body to query
976 * @param quat a copy of the orientation quaternion
977 * @sa dBodyGetQuaternion
979 ODE_API void dBodyCopyQuaternion(dBodyID body, dQuaternion quat);
983 * @brief Get the linear velocity of a body.
986 ODE_API const dReal * dBodyGetLinearVel (dBodyID);
989 * @brief Get the angular velocity of a body.
992 ODE_API const dReal * dBodyGetAngularVel (dBodyID);
995 * @brief Set the mass of a body.
998 ODE_API void dBodySetMass (dBodyID, const dMass *mass);
1001 * @brief Get the mass of a body.
1004 ODE_API void dBodyGetMass (dBodyID, dMass *mass);
1007 * @brief Add force at centre of mass of body in absolute coordinates.
1010 ODE_API void dBodyAddForce (dBodyID, dReal fx, dReal fy, dReal fz);
1013 * @brief Add torque at centre of mass of body in absolute coordinates.
1016 ODE_API void dBodyAddTorque (dBodyID, dReal fx, dReal fy, dReal fz);
1019 * @brief Add force at centre of mass of body in coordinates relative to body.
1022 ODE_API void dBodyAddRelForce (dBodyID, dReal fx, dReal fy, dReal fz);
1025 * @brief Add torque at centre of mass of body in coordinates relative to body.
1028 ODE_API void dBodyAddRelTorque (dBodyID, dReal fx, dReal fy, dReal fz);
1031 * @brief Add force at specified point in body in global coordinates.
1034 ODE_API void dBodyAddForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
1035 dReal px, dReal py, dReal pz);
1037 * @brief Add force at specified point in body in local coordinates.
1040 ODE_API void dBodyAddForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
1041 dReal px, dReal py, dReal pz);
1043 * @brief Add force at specified point in body in global coordinates.
1046 ODE_API void dBodyAddRelForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
1047 dReal px, dReal py, dReal pz);
1049 * @brief Add force at specified point in body in local coordinates.
1052 ODE_API void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
1053 dReal px, dReal py, dReal pz);
1056 * @brief Return the current accumulated force vector.
1057 * @return points to an array of 3 reals.
1059 * The returned values are pointers to internal data structures, so
1060 * the vectors are only valid until any changes are made to the rigid
1064 ODE_API const dReal * dBodyGetForce (dBodyID);
1067 * @brief Return the current accumulated torque vector.
1068 * @return points to an array of 3 reals.
1070 * The returned values are pointers to internal data structures, so
1071 * the vectors are only valid until any changes are made to the rigid
1075 ODE_API const dReal * dBodyGetTorque (dBodyID);
1078 * @brief Set the body force accumulation vector.
1080 * This is mostly useful to zero the force and torque for deactivated bodies
1081 * before they are reactivated, in the case where the force-adding functions
1082 * were called on them while they were deactivated.
1085 ODE_API void dBodySetForce (dBodyID b, dReal x, dReal y, dReal z);
1088 * @brief Set the body torque accumulation vector.
1090 * This is mostly useful to zero the force and torque for deactivated bodies
1091 * before they are reactivated, in the case where the force-adding functions
1092 * were called on them while they were deactivated.
1095 ODE_API void dBodySetTorque (dBodyID b, dReal x, dReal y, dReal z);
1098 * @brief Get world position of a relative point on body.
1100 * @param result will contain the result.
1102 ODE_API void dBodyGetRelPointPos
1104 dBodyID, dReal px, dReal py, dReal pz,
1109 * @brief Get velocity vector in global coords of a relative point on body.
1111 * @param result will contain the result.
1113 ODE_API void dBodyGetRelPointVel
1115 dBodyID, dReal px, dReal py, dReal pz,
1120 * @brief Get velocity vector in global coords of a globally
1121 * specified point on a body.
1123 * @param result will contain the result.
1125 ODE_API void dBodyGetPointVel
1127 dBodyID, dReal px, dReal py, dReal pz,
1132 * @brief takes a point in global coordinates and returns
1133 * the point's position in body-relative coordinates.
1135 * This is the inverse of dBodyGetRelPointPos()
1137 * @param result will contain the result.
1139 ODE_API void dBodyGetPosRelPoint
1141 dBodyID, dReal px, dReal py, dReal pz,
1146 * @brief Convert from local to world coordinates.
1148 * @param result will contain the result.
1150 ODE_API void dBodyVectorToWorld
1152 dBodyID, dReal px, dReal py, dReal pz,
1157 * @brief Convert from world to local coordinates.
1159 * @param result will contain the result.
1161 ODE_API void dBodyVectorFromWorld
1163 dBodyID, dReal px, dReal py, dReal pz,
1168 * @brief controls the way a body's orientation is updated at each timestep.
1170 * @param mode can be 0 or 1:
1171 * \li 0: An ``infinitesimal'' orientation update is used.
1172 * This is fast to compute, but it can occasionally cause inaccuracies
1173 * for bodies that are rotating at high speed, especially when those
1174 * bodies are joined to other bodies.
1175 * This is the default for every new body that is created.
1176 * \li 1: A ``finite'' orientation update is used.
1177 * This is more costly to compute, but will be more accurate for high
1180 * Note however that high speed rotations can result in many types of
1181 * error in a simulation, and the finite mode will only fix one of those
1184 ODE_API void dBodySetFiniteRotationMode (dBodyID, int mode);
1187 * @brief sets the finite rotation axis for a body.
1190 * This is axis only has meaning when the finite rotation mode is set
1191 * If this axis is zero (0,0,0), full finite rotations are performed on
1193 * If this axis is nonzero, the body is rotated by performing a partial finite
1194 * rotation along the axis direction followed by an infinitesimal rotation
1195 * along an orthogonal direction.
1197 * This can be useful to alleviate certain sources of error caused by quickly
1198 * spinning bodies. For example, if a car wheel is rotating at high speed
1199 * you can call this function with the wheel's hinge axis as the argument to
1200 * try and improve its behavior.
1202 ODE_API void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z);
1205 * @brief Get the way a body's orientation is updated each timestep.
1207 * @return the mode 0 (infitesimal) or 1 (finite).
1209 ODE_API int dBodyGetFiniteRotationMode (dBodyID);
1212 * @brief Get the finite rotation axis.
1213 * @param result will contain the axis.
1216 ODE_API void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result);
1219 * @brief Get the number of joints that are attached to this body.
1221 * @return nr of joints
1223 ODE_API int dBodyGetNumJoints (dBodyID b);
1226 * @brief Return a joint attached to this body, given by index.
1228 * @param index valid range is 0 to n-1 where n is the value returned by
1229 * dBodyGetNumJoints().
1231 ODE_API dJointID dBodyGetJoint (dBodyID, int index);
1237 * @brief Set rigid body to dynamic state (default).
1238 * @param dBodyID identification of body.
1241 ODE_API void dBodySetDynamic (dBodyID);
1244 * @brief Set rigid body to kinematic state.
1245 * When in kinematic state the body isn't simulated as a dynamic
1246 * body (it's "unstoppable", doesn't respond to forces),
1247 * but can still affect dynamic bodies (e.g. in joints).
1248 * Kinematic bodies can be controlled by position and velocity.
1249 * @note A kinematic body has infinite mass. If you set its mass
1250 * to something else, it loses the kinematic state and behaves
1251 * as a normal dynamic body.
1252 * @param dBodyID identification of body.
1255 ODE_API void dBodySetKinematic (dBodyID);
1258 * @brief Check wether a body is in kinematic state.
1260 * @return 1 if a body is kinematic or 0 if it is dynamic.
1262 ODE_API int dBodyIsKinematic (dBodyID);
1265 * @brief Manually enable a body.
1266 * @param dBodyID identification of body.
1269 ODE_API void dBodyEnable (dBodyID);
1272 * @brief Manually disable a body.
1275 * A disabled body that is connected through a joint to an enabled body will
1276 * be automatically re-enabled at the next simulation step.
1278 ODE_API void dBodyDisable (dBodyID);
1281 * @brief Check wether a body is enabled.
1283 * @return 1 if a body is currently enabled or 0 if it is disabled.
1285 ODE_API int dBodyIsEnabled (dBodyID);
1288 * @brief Set whether the body is influenced by the world's gravity or not.
1290 * @param mode when nonzero gravity affects this body.
1292 * Newly created bodies are always influenced by the world's gravity.
1294 ODE_API void dBodySetGravityMode (dBodyID b, int mode);
1297 * @brief Get whether the body is influenced by the world's gravity or not.
1299 * @return nonzero means gravity affects this body.
1301 ODE_API int dBodyGetGravityMode (dBodyID b);
1304 * @brief Set the 'moved' callback of a body.
1306 * Whenever a body has its position or rotation changed during the
1307 * timestep, the callback will be called (with body as the argument).
1308 * Use it to know which body may need an update in an external
1309 * structure (like a 3D engine).
1311 * @param b the body that needs to be watched.
1312 * @param callback the callback to be invoked when the body moves. Set to zero
1316 ODE_API void dBodySetMovedCallback(dBodyID b, void (*callback)(dBodyID));
1320 * @brief Return the first geom associated with the body.
1322 * You can traverse through the geoms by repeatedly calling
1323 * dBodyGetNextGeom().
1325 * @return the first geom attached to this body, or 0.
1328 ODE_API dGeomID dBodyGetFirstGeom (dBodyID b);
1332 * @brief returns the next geom associated with the same body.
1333 * @param g a geom attached to some body.
1334 * @return the next geom attached to the same body, or 0.
1335 * @sa dBodyGetFirstGeom
1338 ODE_API dGeomID dBodyGetNextGeom (dGeomID g);
1342 * @brief Resets the damping settings to the current world's settings.
1343 * @ingroup bodies damping
1345 ODE_API void dBodySetDampingDefaults(dBodyID b);
1348 * @brief Get the body's linear damping scale.
1349 * @ingroup bodies damping
1351 ODE_API dReal dBodyGetLinearDamping (dBodyID b);
1354 * @brief Set the body's linear damping scale.
1355 * @param scale The linear damping scale. Should be in the interval [0, 1].
1356 * @ingroup bodies damping
1357 * @remarks From now on the body will not use the world's linear damping
1358 * scale until dBodySetDampingDefaults() is called.
1359 * @sa dBodySetDampingDefaults()
1361 ODE_API void dBodySetLinearDamping(dBodyID b, dReal scale);
1364 * @brief Get the body's angular damping scale.
1365 * @ingroup bodies damping
1366 * @remarks If the body's angular damping scale was not set, this function
1367 * returns the world's angular damping scale.
1369 ODE_API dReal dBodyGetAngularDamping (dBodyID b);
1372 * @brief Set the body's angular damping scale.
1373 * @param scale The angular damping scale. Should be in the interval [0, 1].
1374 * @ingroup bodies damping
1375 * @remarks From now on the body will not use the world's angular damping
1376 * scale until dBodyResetAngularDamping() is called.
1377 * @sa dBodyResetAngularDamping()
1379 ODE_API void dBodySetAngularDamping(dBodyID b, dReal scale);
1382 * @brief Convenience function to set linear and angular scales at once.
1383 * @param linear_scale The linear damping scale. Should be in the interval [0, 1].
1384 * @param angular_scale The angular damping scale. Should be in the interval [0, 1].
1385 * @ingroup bodies damping
1386 * @sa dBodySetLinearDamping() dBodySetAngularDamping()
1388 ODE_API void dBodySetDamping(dBodyID b, dReal linear_scale, dReal angular_scale);
1391 * @brief Get the body's linear damping threshold.
1392 * @ingroup bodies damping
1394 ODE_API dReal dBodyGetLinearDampingThreshold (dBodyID b);
1397 * @brief Set the body's linear damping threshold.
1398 * @param threshold The linear threshold to be used. Damping
1399 * is only applied if the linear speed is above this limit.
1400 * @ingroup bodies damping
1402 ODE_API void dBodySetLinearDampingThreshold(dBodyID b, dReal threshold);
1405 * @brief Get the body's angular damping threshold.
1406 * @ingroup bodies damping
1408 ODE_API dReal dBodyGetAngularDampingThreshold (dBodyID b);
1411 * @brief Set the body's angular damping threshold.
1412 * @param threshold The angular threshold to be used. Damping is
1413 * only used if the angular speed is above this limit.
1414 * @ingroup bodies damping
1416 ODE_API void dBodySetAngularDampingThreshold(dBodyID b, dReal threshold);
1419 * @brief Get the body's maximum angular speed.
1420 * @ingroup damping bodies
1421 * @sa dWorldGetMaxAngularSpeed()
1423 ODE_API dReal dBodyGetMaxAngularSpeed (dBodyID b);
1426 * @brief Set the body's maximum angular speed.
1427 * @ingroup damping bodies
1428 * @sa dWorldSetMaxAngularSpeed() dBodyResetMaxAngularSpeed()
1429 * The default value is dInfinity, but it's a good idea to limit
1430 * it at less than 500 if the body has the gyroscopic term
1433 ODE_API void dBodySetMaxAngularSpeed(dBodyID b, dReal max_speed);
1438 * @brief Get the body's gyroscopic state.
1440 * @return nonzero if gyroscopic term computation is enabled (default),
1444 ODE_API int dBodyGetGyroscopicMode(dBodyID b);
1448 * @brief Enable/disable the body's gyroscopic term.
1450 * Disabling the gyroscopic term of a body usually improves
1451 * stability. It also helps turning spining objects, like cars'
1454 * @param enabled nonzero (default) to enable gyroscopic term, 0
1458 ODE_API void dBodySetGyroscopicMode(dBodyID b, int enabled);
1464 * @defgroup joints Joints
1466 * In real life a joint is something like a hinge, that is used to connect two
1468 * In ODE a joint is very similar: It is a relationship that is enforced between
1469 * two bodies so that they can only have certain positions and orientations
1470 * relative to each other.
1471 * This relationship is called a constraint -- the words joint and
1472 * constraint are often used interchangeably.
1474 * A joint has a set of parameters that can be set. These include:
1477 * \li dParamLoStop Low stop angle or position. Setting this to
1478 * -dInfinity (the default value) turns off the low stop.
1479 * For rotational joints, this stop must be greater than -pi to be
1481 * \li dParamHiStop High stop angle or position. Setting this to
1482 * dInfinity (the default value) turns off the high stop.
1483 * For rotational joints, this stop must be less than pi to be
1485 * If the high stop is less than the low stop then both stops will
1487 * \li dParamVel Desired motor velocity (this will be an angular or
1489 * \li dParamFMax The maximum force or torque that the motor will use to
1490 * achieve the desired velocity.
1491 * This must always be greater than or equal to zero.
1492 * Setting this to zero (the default value) turns off the motor.
1493 * \li dParamFudgeFactor The current joint stop/motor implementation has
1495 * when the joint is at one stop and the motor is set to move it away
1496 * from the stop, too much force may be applied for one time step,
1497 * causing a ``jumping'' motion.
1498 * This fudge factor is used to scale this excess force.
1499 * It should have a value between zero and one (the default value).
1500 * If the jumping motion is too visible in a joint, the value can be
1502 * Making this value too small can prevent the motor from being able to
1503 * move the joint away from a stop.
1504 * \li dParamBounce The bouncyness of the stops.
1505 * This is a restitution parameter in the range 0..1.
1506 * 0 means the stops are not bouncy at all, 1 means maximum bouncyness.
1507 * \li dParamCFM The constraint force mixing (CFM) value used when not
1509 * \li dParamStopERP The error reduction parameter (ERP) used by the
1511 * \li dParamStopCFM The constraint force mixing (CFM) value used by the
1512 * stops. Together with the ERP value this can be used to get spongy or
1514 * Note that this is intended for unpowered joints, it does not really
1515 * work as expected when a powered joint reaches its limit.
1516 * \li dParamSuspensionERP Suspension error reduction parameter (ERP).
1517 * Currently this is only implemented on the hinge-2 joint.
1518 * \li dParamSuspensionCFM Suspension constraint force mixing (CFM) value.
1519 * Currently this is only implemented on the hinge-2 joint.
1521 * If a particular parameter is not implemented by a given joint, setting it
1522 * will have no effect.
1523 * These parameter names can be optionally followed by a digit (2 or 3)
1524 * to indicate the second or third set of parameters, e.g. for the second axis
1525 * in a hinge-2 joint, or the third axis in an AMotor joint.
1530 * @brief Create a new joint of the ball type.
1533 * The joint is initially in "limbo" (i.e. it has no effect on the simulation)
1534 * because it does not connect to any bodies.
1535 * @param dJointGroupID set to 0 to allocate the joint normally.
1536 * If it is nonzero the joint is allocated in the given joint group.
1538 ODE_API dJointID dJointCreateBall (dWorldID, dJointGroupID);
1541 * @brief Create a new joint of the hinge type.
1543 * @param dJointGroupID set to 0 to allocate the joint normally.
1544 * If it is nonzero the joint is allocated in the given joint group.
1546 ODE_API dJointID dJointCreateHinge (dWorldID, dJointGroupID);
1549 * @brief Create a new joint of the slider type.
1551 * @param dJointGroupID set to 0 to allocate the joint normally.
1552 * If it is nonzero the joint is allocated in the given joint group.
1554 ODE_API dJointID dJointCreateSlider (dWorldID, dJointGroupID);
1557 * @brief Create a new joint of the contact type.
1559 * @param dJointGroupID set to 0 to allocate the joint normally.
1560 * If it is nonzero the joint is allocated in the given joint group.
1562 ODE_API dJointID dJointCreateContact (dWorldID, dJointGroupID, const dContact *);
1565 * @brief Create a new joint of the hinge2 type.
1567 * @param dJointGroupID set to 0 to allocate the joint normally.
1568 * If it is nonzero the joint is allocated in the given joint group.
1570 ODE_API dJointID dJointCreateHinge2 (dWorldID, dJointGroupID);
1573 * @brief Create a new joint of the universal type.
1575 * @param dJointGroupID set to 0 to allocate the joint normally.
1576 * If it is nonzero the joint is allocated in the given joint group.
1578 ODE_API dJointID dJointCreateUniversal (dWorldID, dJointGroupID);
1581 * @brief Create a new joint of the PR (Prismatic and Rotoide) type.
1583 * @param dJointGroupID set to 0 to allocate the joint normally.
1584 * If it is nonzero the joint is allocated in the given joint group.
1586 ODE_API dJointID dJointCreatePR (dWorldID, dJointGroupID);
1589 * @brief Create a new joint of the PU (Prismatic and Universal) type.
1591 * @param dJointGroupID set to 0 to allocate the joint normally.
1592 * If it is nonzero the joint is allocated in the given joint group.
1594 ODE_API dJointID dJointCreatePU (dWorldID, dJointGroupID);
1597 * @brief Create a new joint of the Piston type.
1599 * @param dJointGroupID set to 0 to allocate the joint normally.
1600 * If it is nonzero the joint is allocated in the given
1603 ODE_API dJointID dJointCreatePiston (dWorldID, dJointGroupID);
1606 * @brief Create a new joint of the fixed type.
1608 * @param dJointGroupID set to 0 to allocate the joint normally.
1609 * If it is nonzero the joint is allocated in the given joint group.
1611 ODE_API dJointID dJointCreateFixed (dWorldID, dJointGroupID);
1613 ODE_API dJointID dJointCreateNull (dWorldID, dJointGroupID);
1616 * @brief Create a new joint of the A-motor type.
1618 * @param dJointGroupID set to 0 to allocate the joint normally.
1619 * If it is nonzero the joint is allocated in the given joint group.
1621 ODE_API dJointID dJointCreateAMotor (dWorldID, dJointGroupID);
1624 * @brief Create a new joint of the L-motor type.
1626 * @param dJointGroupID set to 0 to allocate the joint normally.
1627 * If it is nonzero the joint is allocated in the given joint group.
1629 ODE_API dJointID dJointCreateLMotor (dWorldID, dJointGroupID);
1632 * @brief Create a new joint of the plane-2d type.
1634 * @param dJointGroupID set to 0 to allocate the joint normally.
1635 * If it is nonzero the joint is allocated in the given joint group.
1637 ODE_API dJointID dJointCreatePlane2D (dWorldID, dJointGroupID);
1640 * @brief Destroy a joint.
1643 * disconnects it from its attached bodies and removing it from the world.
1644 * However, if the joint is a member of a group then this function has no
1645 * effect - to destroy that joint the group must be emptied or destroyed.
1647 ODE_API void dJointDestroy (dJointID);
1651 * @brief Create a joint group
1653 * @param max_size deprecated. Set to 0.
1655 ODE_API dJointGroupID dJointGroupCreate (int max_size);
1658 * @brief Destroy a joint group.
1661 * All joints in the joint group will be destroyed.
1663 ODE_API void dJointGroupDestroy (dJointGroupID);
1666 * @brief Empty a joint group.
1669 * All joints in the joint group will be destroyed,
1670 * but the joint group itself will not be destroyed.
1672 ODE_API void dJointGroupEmpty (dJointGroupID);
1675 * @brief Return the number of bodies attached to the joint
1678 ODE_API int dJointGetNumBodies(dJointID);
1681 * @brief Attach the joint to some new bodies.
1684 * If the joint is already attached, it will be detached from the old bodies
1686 * To attach this joint to only one body, set body1 or body2 to zero - a zero
1687 * body refers to the static environment.
1688 * Setting both bodies to zero puts the joint into "limbo", i.e. it will
1689 * have no effect on the simulation.
1691 * Some joints, like hinge-2 need to be attached to two bodies to work.
1693 ODE_API void dJointAttach (dJointID, dBodyID body1, dBodyID body2);
1696 * @brief Manually enable a joint.
1697 * @param dJointID identification of joint.
1700 ODE_API void dJointEnable (dJointID);
1703 * @brief Manually disable a joint.
1706 * A disabled joint will not affect the simulation, but will maintain the anchors and
1707 * axes so it can be enabled later.
1709 ODE_API void dJointDisable (dJointID);
1712 * @brief Check wether a joint is enabled.
1714 * @return 1 if a joint is currently enabled or 0 if it is disabled.
1716 ODE_API int dJointIsEnabled (dJointID);
1719 * @brief Set the user-data pointer
1722 ODE_API void dJointSetData (dJointID, void *data);
1725 * @brief Get the user-data pointer
1728 ODE_API void *dJointGetData (dJointID);
1731 * @brief Get the type of the joint
1733 * @return the type, being one of these:
1734 * \li dJointTypeBall
1735 * \li dJointTypeHinge
1736 * \li dJointTypeSlider
1737 * \li dJointTypeContact
1738 * \li dJointTypeUniversal
1739 * \li dJointTypeHinge2
1740 * \li dJointTypeFixed
1741 * \li dJointTypeNull
1742 * \li dJointTypeAMotor
1743 * \li dJointTypeLMotor
1744 * \li dJointTypePlane2D
1747 * \li dJointTypePiston
1749 ODE_API dJointType dJointGetType (dJointID);
1752 * @brief Return the bodies that this joint connects.
1754 * @param index return the first (0) or second (1) body.
1756 * If one of these returned body IDs is zero, the joint connects the other body
1757 * to the static environment.
1758 * If both body IDs are zero, the joint is in ``limbo'' and has no effect on
1761 ODE_API dBodyID dJointGetBody (dJointID, int index);
1764 * @brief Sets the datastructure that is to receive the feedback.
1766 * The feedback can be used by the user, so that it is known how
1767 * much force an individual joint exerts.
1770 ODE_API void dJointSetFeedback (dJointID, dJointFeedback *);
1773 * @brief Gets the datastructure that is to receive the feedback.
1776 ODE_API dJointFeedback *dJointGetFeedback (dJointID);
1779 * @brief Set the joint anchor point.
1782 * The joint will try to keep this point on each body
1783 * together. The input is specified in world coordinates.
1785 ODE_API void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z);
1788 * @brief Set the joint anchor point.
1791 ODE_API void dJointSetBallAnchor2 (dJointID, dReal x, dReal y, dReal z);
1794 * @brief Param setting for Ball joints
1797 ODE_API void dJointSetBallParam (dJointID, int parameter, dReal value);
1800 * @brief Set hinge anchor parameter.
1803 ODE_API void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z);
1805 ODE_API void dJointSetHingeAnchorDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
1808 * @brief Set hinge axis.
1811 ODE_API void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z);
1814 * @brief Set the Hinge axis as if the 2 bodies were already at angle appart.
1817 * This function initialize the Axis and the relative orientation of each body
1818 * as if body1 was rotated around the axis by the angle value. \br
1821 * dJointSetHingeAxis(jId, 1, 0, 0);
1822 * // If you request the position you will have: dJointGetHingeAngle(jId) == 0
1823 * dJointSetHingeAxisDelta(jId, 1, 0, 0, 0.23);
1824 * // If you request the position you will have: dJointGetHingeAngle(jId) == 0.23
1827 * @param j The Hinge joint ID for which the axis will be set
1828 * @param x The X component of the axis in world frame
1829 * @param y The Y component of the axis in world frame
1830 * @param z The Z component of the axis in world frame
1831 * @param angle The angle for the offset of the relative orientation.
1832 * As if body1 was rotated by angle when the Axis was set (see below).
1833 * The rotation is around the new Hinge axis.
1835 * @note Usually the function dJointSetHingeAxis set the current position of body1
1836 * and body2 as the zero angle position. This function set the current position
1837 * as the if the 2 bodies where \b angle appart.
1838 * @warning Calling dJointSetHingeAnchor or dJointSetHingeAxis will reset the "zero"
1841 ODE_API void dJointSetHingeAxisOffset (dJointID j, dReal x, dReal y, dReal z, dReal angle);
1844 * @brief set joint parameter
1847 ODE_API void dJointSetHingeParam (dJointID, int parameter, dReal value);
1850 * @brief Applies the torque about the hinge axis.
1852 * That is, it applies a torque with specified magnitude in the direction
1853 * of the hinge axis, to body 1, and with the same magnitude but in opposite
1854 * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
1857 ODE_API void dJointAddHingeTorque(dJointID joint, dReal torque);
1860 * @brief set the joint axis
1863 ODE_API void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z);
1868 ODE_API void dJointSetSliderAxisDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
1871 * @brief set joint parameter
1874 ODE_API void dJointSetSliderParam (dJointID, int parameter, dReal value);
1877 * @brief Applies the given force in the slider's direction.
1879 * That is, it applies a force with specified magnitude, in the direction of
1880 * slider's axis, to body1, and with the same magnitude but opposite
1881 * direction to body2. This function is just a wrapper for dBodyAddForce().
1884 ODE_API void dJointAddSliderForce(dJointID joint, dReal force);
1890 ODE_API void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z);
1896 ODE_API void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z);
1902 ODE_API void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z);
1905 * @brief set joint parameter
1908 ODE_API void dJointSetHinge2Param (dJointID, int parameter, dReal value);
1911 * @brief Applies torque1 about the hinge2's axis 1, torque2 about the
1913 * @remarks This function is just a wrapper for dBodyAddTorque().
1916 ODE_API void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2);
1922 ODE_API void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z);
1928 ODE_API void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z);
1931 * @brief Set the Universal axis1 as if the 2 bodies were already at
1932 * offset1 and offset2 appart with respect to axis1 and axis2.
1935 * This function initialize the axis1 and the relative orientation of
1936 * each body as if body1 was rotated around the new axis1 by the offset1
1937 * value and as if body2 was rotated around the axis2 by offset2. \br
1940 * dJointSetHuniversalAxis1(jId, 1, 0, 0);
1941 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0
1942 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0
1943 * dJointSetHuniversalAxis1Offset(jId, 1, 0, 0, 0.2, 0.17);
1944 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0.2
1945 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0.17
1948 * @param j The Hinge joint ID for which the axis will be set
1949 * @param x The X component of the axis in world frame
1950 * @param y The Y component of the axis in world frame
1951 * @param z The Z component of the axis in world frame
1952 * @param angle The angle for the offset of the relative orientation.
1953 * As if body1 was rotated by angle when the Axis was set (see below).
1954 * The rotation is around the new Hinge axis.
1956 * @note Usually the function dJointSetHingeAxis set the current position of body1
1957 * and body2 as the zero angle position. This function set the current position
1958 * as the if the 2 bodies where \b offsets appart.
1960 * @note Any previous offsets are erased.
1962 * @warning Calling dJointSetUniversalAnchor, dJointSetUnivesalAxis1,
1963 * dJointSetUniversalAxis2, dJointSetUniversalAxis2Offset
1964 * will reset the "zero" angle position.
1966 ODE_API void dJointSetUniversalAxis1Offset (dJointID, dReal x, dReal y, dReal z,
1967 dReal offset1, dReal offset2);
1973 ODE_API void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z);
1976 * @brief Set the Universal axis2 as if the 2 bodies were already at
1977 * offset1 and offset2 appart with respect to axis1 and axis2.
1980 * This function initialize the axis2 and the relative orientation of
1981 * each body as if body1 was rotated around the axis1 by the offset1
1982 * value and as if body2 was rotated around the new axis2 by offset2. \br
1985 * dJointSetHuniversalAxis2(jId, 0, 1, 0);
1986 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0
1987 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0
1988 * dJointSetHuniversalAxis2Offset(jId, 0, 1, 0, 0.2, 0.17);
1989 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0.2
1990 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0.17
1993 * @param j The Hinge joint ID for which the axis will be set
1994 * @param x The X component of the axis in world frame
1995 * @param y The Y component of the axis in world frame
1996 * @param z The Z component of the axis in world frame
1997 * @param angle The angle for the offset of the relative orientation.
1998 * As if body1 was rotated by angle when the Axis was set (see below).
1999 * The rotation is around the new Hinge axis.
2001 * @note Usually the function dJointSetHingeAxis set the current position of body1
2002 * and body2 as the zero angle position. This function set the current position
2003 * as the if the 2 bodies where \b offsets appart.
2005 * @note Any previous offsets are erased.
2007 * @warning Calling dJointSetUniversalAnchor, dJointSetUnivesalAxis1,
2008 * dJointSetUniversalAxis2, dJointSetUniversalAxis2Offset
2009 * will reset the "zero" angle position.
2013 ODE_API void dJointSetUniversalAxis2Offset (dJointID, dReal x, dReal y, dReal z,
2014 dReal offset1, dReal offset2);
2017 * @brief set joint parameter
2020 ODE_API void dJointSetUniversalParam (dJointID, int parameter, dReal value);
2023 * @brief Applies torque1 about the universal's axis 1, torque2 about the
2024 * universal's axis 2.
2025 * @remarks This function is just a wrapper for dBodyAddTorque().
2028 ODE_API void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2);
2035 ODE_API void dJointSetPRAnchor (dJointID, dReal x, dReal y, dReal z);
2038 * @brief set the axis for the prismatic articulation
2041 ODE_API void dJointSetPRAxis1 (dJointID, dReal x, dReal y, dReal z);
2044 * @brief set the axis for the rotoide articulation
2047 ODE_API void dJointSetPRAxis2 (dJointID, dReal x, dReal y, dReal z);
2050 * @brief set joint parameter
2053 * @note parameterX where X equal 2 refer to parameter for the rotoide articulation
2055 ODE_API void dJointSetPRParam (dJointID, int parameter, dReal value);
2058 * @brief Applies the torque about the rotoide axis of the PR joint
2060 * That is, it applies a torque with specified magnitude in the direction
2061 * of the rotoide axis, to body 1, and with the same magnitude but in opposite
2062 * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
2065 ODE_API void dJointAddPRTorque (dJointID j, dReal torque);
2072 ODE_API void dJointSetPUAnchor (dJointID, dReal x, dReal y, dReal z);
2078 ODE_API_DEPRECATED ODE_API void dJointSetPUAnchorDelta (dJointID, dReal x, dReal y, dReal z,
2079 dReal dx, dReal dy, dReal dz);
2082 * @brief Set the PU anchor as if the 2 bodies were already at [dx, dy, dz] appart.
2085 * This function initialize the anchor and the relative position of each body
2086 * as if the position between body1 and body2 was already the projection of [dx, dy, dz]
2087 * along the Piston axis. (i.e as if the body1 was at its current position - [dx,dy,dy] when the
2093 * dJointGetPUAxis(jId, axis);
2094 * dJointSetPUAnchor(jId, 0, 0, 0);
2095 * // If you request the position you will have: dJointGetPUPosition(jId) == 0
2096 * dJointSetPUAnchorOffset(jId, 0, 0, 0, axis[X]*offset, axis[Y]*offset, axis[Z]*offset);
2097 * // If you request the position you will have: dJointGetPUPosition(jId) == offset
2099 * @param j The PU joint for which the anchor point will be set
2100 * @param x The X position of the anchor point in world frame
2101 * @param y The Y position of the anchor point in world frame
2102 * @param z The Z position of the anchor point in world frame
2103 * @param dx A delta to be substracted to the X position as if the anchor was set
2104 * when body1 was at current_position[X] - dx
2105 * @param dx A delta to be substracted to the Y position as if the anchor was set
2106 * when body1 was at current_position[Y] - dy
2107 * @param dx A delta to be substracted to the Z position as if the anchor was set
2108 * when body1 was at current_position[Z] - dz
2110 ODE_API void dJointSetPUAnchorOffset (dJointID, dReal x, dReal y, dReal z,
2111 dReal dx, dReal dy, dReal dz);
2114 * @brief set the axis for the first axis or the universal articulation
2117 ODE_API void dJointSetPUAxis1 (dJointID, dReal x, dReal y, dReal z);
2120 * @brief set the axis for the second axis or the universal articulation
2123 ODE_API void dJointSetPUAxis2 (dJointID, dReal x, dReal y, dReal z);
2126 * @brief set the axis for the prismatic articulation
2129 ODE_API void dJointSetPUAxis3 (dJointID, dReal x, dReal y, dReal z);
2132 * @brief set the axis for the prismatic articulation
2134 * @note This function was added for convenience it is the same as
2137 ODE_API void dJointSetPUAxisP (dJointID id, dReal x, dReal y, dReal z);
2142 * @brief set joint parameter
2145 * @note parameterX where X equal 2 refer to parameter for second axis of the
2146 * universal articulation
2147 * @note parameterX where X equal 3 refer to parameter for prismatic
2150 ODE_API void dJointSetPUParam (dJointID, int parameter, dReal value);
2153 * @brief Applies the torque about the rotoide axis of the PU joint
2155 * That is, it applies a torque with specified magnitude in the direction
2156 * of the rotoide axis, to body 1, and with the same magnitude but in opposite
2157 * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
2160 ODE_API void dJointAddPUTorque (dJointID j, dReal torque);
2166 * @brief set the joint anchor
2169 ODE_API void dJointSetPistonAnchor (dJointID, dReal x, dReal y, dReal z);
2172 * @brief Set the Piston anchor as if the 2 bodies were already at [dx,dy, dz] appart.
2175 * This function initialize the anchor and the relative position of each body
2176 * as if the position between body1 and body2 was already the projection of [dx, dy, dz]
2177 * along the Piston axis. (i.e as if the body1 was at its current position - [dx,dy,dy] when the
2183 * dJointGetPistonAxis(jId, axis);
2184 * dJointSetPistonAnchor(jId, 0, 0, 0);
2185 * // If you request the position you will have: dJointGetPistonPosition(jId) == 0
2186 * dJointSetPistonAnchorOffset(jId, 0, 0, 0, axis[X]*offset, axis[Y]*offset, axis[Z]*offset);
2187 * // If you request the position you will have: dJointGetPistonPosition(jId) == offset
2189 * @param j The Piston joint for which the anchor point will be set
2190 * @param x The X position of the anchor point in world frame
2191 * @param y The Y position of the anchor point in world frame
2192 * @param z The Z position of the anchor point in world frame
2193 * @param dx A delta to be substracted to the X position as if the anchor was set
2194 * when body1 was at current_position[X] - dx
2195 * @param dx A delta to be substracted to the Y position as if the anchor was set
2196 * when body1 was at current_position[Y] - dy
2197 * @param dx A delta to be substracted to the Z position as if the anchor was set
2198 * when body1 was at current_position[Z] - dz
2200 ODE_API void dJointSetPistonAnchorOffset(dJointID j, dReal x, dReal y, dReal z,
2201 dReal dx, dReal dy, dReal dz);
2204 * @brief set the joint axis
2207 ODE_API void dJointSetPistonAxis (dJointID, dReal x, dReal y, dReal z);
2210 * This function set prismatic axis of the joint and also set the position
2214 * @param j The joint affected by this function
2215 * @param x The x component of the axis
2216 * @param y The y component of the axis
2217 * @param z The z component of the axis
2218 * @param dx The Initial position of the prismatic join in the x direction
2219 * @param dy The Initial position of the prismatic join in the y direction
2220 * @param dz The Initial position of the prismatic join in the z direction
2222 ODE_API_DEPRECATED ODE_API void dJointSetPistonAxisDelta (dJointID j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
2225 * @brief set joint parameter
2228 ODE_API void dJointSetPistonParam (dJointID, int parameter, dReal value);
2231 * @brief Applies the given force in the slider's direction.
2233 * That is, it applies a force with specified magnitude, in the direction of
2234 * prismatic's axis, to body1, and with the same magnitude but opposite
2235 * direction to body2. This function is just a wrapper for dBodyAddForce().
2238 ODE_API void dJointAddPistonForce (dJointID joint, dReal force);
2242 * @brief Call this on the fixed joint after it has been attached to
2243 * remember the current desired relative offset and desired relative
2244 * rotation between the bodies.
2247 ODE_API void dJointSetFixed (dJointID);
2250 * @brief Sets joint parameter
2254 ODE_API void dJointSetFixedParam (dJointID, int parameter, dReal value);
2257 * @brief set the nr of axes
2261 ODE_API void dJointSetAMotorNumAxes (dJointID, int num);
2267 ODE_API void dJointSetAMotorAxis (dJointID, int anum, int rel,
2268 dReal x, dReal y, dReal z);
2271 * @brief Tell the AMotor what the current angle is along axis anum.
2273 * This function should only be called in dAMotorUser mode, because in this
2274 * mode the AMotor has no other way of knowing the joint angles.
2275 * The angle information is needed if stops have been set along the axis,
2276 * but it is not needed for axis motors.
2279 ODE_API void dJointSetAMotorAngle (dJointID, int anum, dReal angle);
2282 * @brief set joint parameter
2285 ODE_API void dJointSetAMotorParam (dJointID, int parameter, dReal value);
2291 ODE_API void dJointSetAMotorMode (dJointID, int mode);
2294 * @brief Applies torque0 about the AMotor's axis 0, torque1 about the
2295 * AMotor's axis 1, and torque2 about the AMotor's axis 2.
2297 * If the motor has fewer than three axes, the higher torques are ignored.
2298 * This function is just a wrapper for dBodyAddTorque().
2301 ODE_API void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3);
2304 * @brief Set the number of axes that will be controlled by the LMotor.
2305 * @param num can range from 0 (which effectively deactivates the joint) to 3.
2308 ODE_API void dJointSetLMotorNumAxes (dJointID, int num);
2311 * @brief Set the AMotor axes.
2312 * @param anum selects the axis to change (0,1 or 2).
2313 * @param rel Each axis can have one of three ``relative orientation'' modes
2314 * \li 0: The axis is anchored to the global frame.
2315 * \li 1: The axis is anchored to the first body.
2316 * \li 2: The axis is anchored to the second body.
2317 * @remarks The axis vector is always specified in global coordinates
2318 * regardless of the setting of rel.
2321 ODE_API void dJointSetLMotorAxis (dJointID, int anum, int rel, dReal x, dReal y, dReal z);
2324 * @brief set joint parameter
2327 ODE_API void dJointSetLMotorParam (dJointID, int parameter, dReal value);
2332 ODE_API void dJointSetPlane2DXParam (dJointID, int parameter, dReal value);
2338 ODE_API void dJointSetPlane2DYParam (dJointID, int parameter, dReal value);
2343 ODE_API void dJointSetPlane2DAngleParam (dJointID, int parameter, dReal value);
2346 * @brief Get the joint anchor point, in world coordinates.
2348 * This returns the point on body 1. If the joint is perfectly satisfied,
2349 * this will be the same as the point on body 2.
2351 ODE_API void dJointGetBallAnchor (dJointID, dVector3 result);
2354 * @brief Get the joint anchor point, in world coordinates.
2356 * This returns the point on body 2. You can think of a ball and socket
2357 * joint as trying to keep the result of dJointGetBallAnchor() and
2358 * dJointGetBallAnchor2() the same. If the joint is perfectly satisfied,
2359 * this function will return the same value as dJointGetBallAnchor() to
2360 * within roundoff errors. dJointGetBallAnchor2() can be used, along with
2361 * dJointGetBallAnchor(), to see how far the joint has come apart.
2363 ODE_API void dJointGetBallAnchor2 (dJointID, dVector3 result);
2366 * @brief get joint parameter
2369 ODE_API dReal dJointGetBallParam (dJointID, int parameter);
2372 * @brief Get the hinge anchor point, in world coordinates.
2374 * This returns the point on body 1. If the joint is perfectly satisfied,
2375 * this will be the same as the point on body 2.
2378 ODE_API void dJointGetHingeAnchor (dJointID, dVector3 result);
2381 * @brief Get the joint anchor point, in world coordinates.
2382 * @return The point on body 2. If the joint is perfectly satisfied,
2383 * this will return the same value as dJointGetHingeAnchor().
2384 * If not, this value will be slightly different.
2385 * This can be used, for example, to see how far the joint has come apart.
2388 ODE_API void dJointGetHingeAnchor2 (dJointID, dVector3 result);
2394 ODE_API void dJointGetHingeAxis (dJointID, dVector3 result);
2397 * @brief get joint parameter
2400 ODE_API dReal dJointGetHingeParam (dJointID, int parameter);
2403 * @brief Get the hinge angle.
2405 * The angle is measured between the two bodies, or between the body and
2406 * the static environment.
2407 * The angle will be between -pi..pi.
2408 * Give the relative rotation with respect to the Hinge axis of Body 1 with
2409 * respect to Body 2.
2410 * When the hinge anchor or axis is set, the current position of the attached
2411 * bodies is examined and that position will be the zero angle.
2414 ODE_API dReal dJointGetHingeAngle (dJointID);
2417 * @brief Get the hinge angle time derivative.
2420 ODE_API dReal dJointGetHingeAngleRate (dJointID);
2423 * @brief Get the slider linear position (i.e. the slider's extension)
2425 * When the axis is set, the current position of the attached bodies is
2426 * examined and that position will be the zero position.
2428 * The position is the distance, with respect to the zero position,
2429 * along the slider axis of body 1 with respect to
2430 * body 2. (A NULL body is replaced by the world).
2433 ODE_API dReal dJointGetSliderPosition (dJointID);
2436 * @brief Get the slider linear position's time derivative.
2439 ODE_API dReal dJointGetSliderPositionRate (dJointID);
2442 * @brief Get the slider axis
2445 ODE_API void dJointGetSliderAxis (dJointID, dVector3 result);
2448 * @brief get joint parameter
2451 ODE_API dReal dJointGetSliderParam (dJointID, int parameter);
2454 * @brief Get the joint anchor point, in world coordinates.
2455 * @return the point on body 1. If the joint is perfectly satisfied,
2456 * this will be the same as the point on body 2.
2459 ODE_API void dJointGetHinge2Anchor (dJointID, dVector3 result);
2462 * @brief Get the joint anchor point, in world coordinates.
2463 * This returns the point on body 2. If the joint is perfectly satisfied,
2464 * this will return the same value as dJointGetHinge2Anchor.
2465 * If not, this value will be slightly different.
2466 * This can be used, for example, to see how far the joint has come apart.
2469 ODE_API void dJointGetHinge2Anchor2 (dJointID, dVector3 result);
2472 * @brief Get joint axis
2475 ODE_API void dJointGetHinge2Axis1 (dJointID, dVector3 result);
2478 * @brief Get joint axis
2481 ODE_API void dJointGetHinge2Axis2 (dJointID, dVector3 result);
2484 * @brief get joint parameter
2487 ODE_API dReal dJointGetHinge2Param (dJointID, int parameter);
2493 ODE_API dReal dJointGetHinge2Angle1 (dJointID);
2496 * @brief Get time derivative of angle
2499 ODE_API dReal dJointGetHinge2Angle1Rate (dJointID);
2502 * @brief Get time derivative of angle
2505 ODE_API dReal dJointGetHinge2Angle2Rate (dJointID);
2508 * @brief Get the joint anchor point, in world coordinates.
2509 * @return the point on body 1. If the joint is perfectly satisfied,
2510 * this will be the same as the point on body 2.
2513 ODE_API void dJointGetUniversalAnchor (dJointID, dVector3 result);
2516 * @brief Get the joint anchor point, in world coordinates.
2517 * @return This returns the point on body 2.
2519 * You can think of the ball and socket part of a universal joint as
2520 * trying to keep the result of dJointGetBallAnchor() and
2521 * dJointGetBallAnchor2() the same. If the joint is
2522 * perfectly satisfied, this function will return the same value
2523 * as dJointGetUniversalAnchor() to within roundoff errors.
2524 * dJointGetUniversalAnchor2() can be used, along with
2525 * dJointGetUniversalAnchor(), to see how far the joint has come apart.
2528 ODE_API void dJointGetUniversalAnchor2 (dJointID, dVector3 result);
2534 ODE_API void dJointGetUniversalAxis1 (dJointID, dVector3 result);
2540 ODE_API void dJointGetUniversalAxis2 (dJointID, dVector3 result);
2544 * @brief get joint parameter
2547 ODE_API dReal dJointGetUniversalParam (dJointID, int parameter);
2550 * @brief Get both angles at the same time.
2553 * @param joint The universal joint for which we want to calculate the angles
2554 * @param angle1 The angle between the body1 and the axis 1
2555 * @param angle2 The angle between the body2 and the axis 2
2557 * @note This function combine getUniversalAngle1 and getUniversalAngle2 together
2558 * and try to avoid redundant calculation
2560 ODE_API void dJointGetUniversalAngles (dJointID, dReal *angle1, dReal *angle2);
2566 ODE_API dReal dJointGetUniversalAngle1 (dJointID);
2572 ODE_API dReal dJointGetUniversalAngle2 (dJointID);
2575 * @brief Get time derivative of angle
2578 ODE_API dReal dJointGetUniversalAngle1Rate (dJointID);
2581 * @brief Get time derivative of angle
2584 ODE_API dReal dJointGetUniversalAngle2Rate (dJointID);
2589 * @brief Get the joint anchor point, in world coordinates.
2590 * @return the point on body 1. If the joint is perfectly satisfied,
2591 * this will be the same as the point on body 2.
2594 ODE_API void dJointGetPRAnchor (dJointID, dVector3 result);
2597 * @brief Get the PR linear position (i.e. the prismatic's extension)
2599 * When the axis is set, the current position of the attached bodies is
2600 * examined and that position will be the zero position.
2602 * The position is the "oriented" length between the
2603 * position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
2607 ODE_API dReal dJointGetPRPosition (dJointID);
2610 * @brief Get the PR linear position's time derivative
2614 ODE_API dReal dJointGetPRPositionRate (dJointID);
2618 * @brief Get the PR angular position (i.e. the twist between the 2 bodies)
2620 * When the axis is set, the current position of the attached bodies is
2621 * examined and that position will be the zero position.
2624 ODE_API dReal dJointGetPRAngle (dJointID);
2627 * @brief Get the PR angular position's time derivative
2631 ODE_API dReal dJointGetPRAngleRate (dJointID);
2635 * @brief Get the prismatic axis
2638 ODE_API void dJointGetPRAxis1 (dJointID, dVector3 result);
2641 * @brief Get the Rotoide axis
2644 ODE_API void dJointGetPRAxis2 (dJointID, dVector3 result);
2647 * @brief get joint parameter
2650 ODE_API dReal dJointGetPRParam (dJointID, int parameter);
2655 * @brief Get the joint anchor point, in world coordinates.
2656 * @return the point on body 1. If the joint is perfectly satisfied,
2657 * this will be the same as the point on body 2.
2660 ODE_API void dJointGetPUAnchor (dJointID, dVector3 result);
2663 * @brief Get the PU linear position (i.e. the prismatic's extension)
2665 * When the axis is set, the current position of the attached bodies is
2666 * examined and that position will be the zero position.
2668 * The position is the "oriented" length between the
2669 * position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
2673 ODE_API dReal dJointGetPUPosition (dJointID);
2676 * @brief Get the PR linear position's time derivative
2680 ODE_API dReal dJointGetPUPositionRate (dJointID);
2683 * @brief Get the first axis of the universal component of the joint
2686 ODE_API void dJointGetPUAxis1 (dJointID, dVector3 result);
2689 * @brief Get the second axis of the Universal component of the joint
2692 ODE_API void dJointGetPUAxis2 (dJointID, dVector3 result);
2695 * @brief Get the prismatic axis
2698 ODE_API void dJointGetPUAxis3 (dJointID, dVector3 result);
2701 * @brief Get the prismatic axis
2704 * @note This function was added for convenience it is the same as
2707 ODE_API void dJointGetPUAxisP (dJointID id, dVector3 result);
2713 * @brief Get both angles at the same time.
2716 * @param joint The Prismatic universal joint for which we want to calculate the angles
2717 * @param angle1 The angle between the body1 and the axis 1
2718 * @param angle2 The angle between the body2 and the axis 2
2720 * @note This function combine dJointGetPUAngle1 and dJointGetPUAngle2 together
2721 * and try to avoid redundant calculation
2723 ODE_API void dJointGetPUAngles (dJointID, dReal *angle1, dReal *angle2);
2729 ODE_API dReal dJointGetPUAngle1 (dJointID);
2732 * @brief * @brief Get time derivative of angle1
2736 ODE_API dReal dJointGetPUAngle1Rate (dJointID);
2743 ODE_API dReal dJointGetPUAngle2 (dJointID);
2746 * @brief * @brief Get time derivative of angle2
2750 ODE_API dReal dJointGetPUAngle2Rate (dJointID);
2753 * @brief get joint parameter
2756 ODE_API dReal dJointGetPUParam (dJointID, int parameter);
2763 * @brief Get the Piston linear position (i.e. the piston's extension)
2765 * When the axis is set, the current position of the attached bodies is
2766 * examined and that position will be the zero position.
2769 ODE_API dReal dJointGetPistonPosition (dJointID);
2772 * @brief Get the piston linear position's time derivative.
2775 ODE_API dReal dJointGetPistonPositionRate (dJointID);
2778 * @brief Get the Piston angular position (i.e. the twist between the 2 bodies)
2780 * When the axis is set, the current position of the attached bodies is
2781 * examined and that position will be the zero position.
2784 ODE_API dReal dJointGetPistonAngle (dJointID);
2787 * @brief Get the piston angular position's time derivative.
2790 ODE_API dReal dJointGetPistonAngleRate (dJointID);
2794 * @brief Get the joint anchor
2796 * This returns the point on body 1. If the joint is perfectly satisfied,
2797 * this will be the same as the point on body 2 in direction perpendicular
2798 * to the prismatic axis.
2802 ODE_API void dJointGetPistonAnchor (dJointID, dVector3 result);
2805 * @brief Get the joint anchor w.r.t. body 2
2807 * This returns the point on body 2. You can think of a Piston
2808 * joint as trying to keep the result of dJointGetPistonAnchor() and
2809 * dJointGetPistonAnchor2() the same in the direction perpendicular to the
2810 * pirsmatic axis. If the joint is perfectly satisfied,
2811 * this function will return the same value as dJointGetPistonAnchor() to
2812 * within roundoff errors. dJointGetPistonAnchor2() can be used, along with
2813 * dJointGetPistonAnchor(), to see how far the joint has come apart.
2817 ODE_API void dJointGetPistonAnchor2 (dJointID, dVector3 result);
2820 * @brief Get the prismatic axis (This is also the rotoide axis.
2823 ODE_API void dJointGetPistonAxis (dJointID, dVector3 result);
2826 * @brief get joint parameter
2829 ODE_API dReal dJointGetPistonParam (dJointID, int parameter);
2833 * @brief Get the number of angular axes that will be controlled by the
2835 * @param num can range from 0 (which effectively deactivates the
2837 * This is automatically set to 3 in dAMotorEuler mode.
2840 ODE_API int dJointGetAMotorNumAxes (dJointID);
2843 * @brief Get the AMotor axes.
2844 * @param anum selects the axis to change (0,1 or 2).
2845 * @param rel Each axis can have one of three ``relative orientation'' modes.
2846 * \li 0: The axis is anchored to the global frame.
2847 * \li 1: The axis is anchored to the first body.
2848 * \li 2: The axis is anchored to the second body.
2851 ODE_API void dJointGetAMotorAxis (dJointID, int anum, dVector3 result);
2856 * The axis vector is always specified in global coordinates regardless
2857 * of the setting of rel.
2858 * There are two GetAMotorAxis functions, one to return the axis and one to
2859 * return the relative mode.
2861 * For dAMotorEuler mode:
2862 * \li Only axes 0 and 2 need to be set. Axis 1 will be determined
2863 automatically at each time step.
2864 * \li Axes 0 and 2 must be perpendicular to each other.
2865 * \li Axis 0 must be anchored to the first body, axis 2 must be anchored
2869 ODE_API int dJointGetAMotorAxisRel (dJointID, int anum);
2872 * @brief Get the current angle for axis.
2874 * In dAMotorUser mode this is simply the value that was set with
2875 * dJointSetAMotorAngle().
2876 * In dAMotorEuler mode this is the corresponding euler angle.
2879 ODE_API dReal dJointGetAMotorAngle (dJointID, int anum);
2882 * @brief Get the current angle rate for axis anum.
2884 * In dAMotorUser mode this is always zero, as not enough information is
2886 * In dAMotorEuler mode this is the corresponding euler angle rate.
2889 ODE_API dReal dJointGetAMotorAngleRate (dJointID, int anum);
2892 * @brief get joint parameter
2895 ODE_API dReal dJointGetAMotorParam (dJointID, int parameter);
2898 * @brief Get the angular motor mode.
2899 * @param mode must be one of the following constants:
2900 * \li dAMotorUser The AMotor axes and joint angle settings are entirely
2901 * controlled by the user. This is the default mode.
2902 * \li dAMotorEuler Euler angles are automatically computed.
2903 * The axis a1 is also automatically computed.
2904 * The AMotor axes must be set correctly when in this mode,
2905 * as described below.
2906 * When this mode is initially set the current relative orientations
2907 * of the bodies will correspond to all euler angles at zero.
2910 ODE_API int dJointGetAMotorMode (dJointID);
2913 * @brief Get nr of axes.
2916 ODE_API int dJointGetLMotorNumAxes (dJointID);
2922 ODE_API void dJointGetLMotorAxis (dJointID, int anum, dVector3 result);
2925 * @brief get joint parameter
2928 ODE_API dReal dJointGetLMotorParam (dJointID, int parameter);
2931 * @brief get joint parameter
2934 ODE_API dReal dJointGetFixedParam (dJointID, int parameter);
2940 ODE_API dJointID dConnectingJoint (dBodyID, dBodyID);
2945 ODE_API int dConnectingJointList (dBodyID, dBodyID, dJointID*);
2948 * @brief Utility function
2949 * @return 1 if the two bodies are connected together by
2950 * a joint, otherwise return 0.
2953 ODE_API int dAreConnected (dBodyID, dBodyID);
2956 * @brief Utility function
2957 * @return 1 if the two bodies are connected together by
2958 * a joint that does not have type @arg{joint_type}, otherwise return 0.
2959 * @param body1 A body to check.
2960 * @param body2 A body to check.
2961 * @param joint_type is a dJointTypeXXX constant.
2962 * This is useful for deciding whether to add contact joints between two bodies:
2963 * if they are already connected by non-contact joints then it may not be
2964 * appropriate to add contacts, however it is okay to add more contact between-
2965 * bodies that already have contacts.
2968 ODE_API int dAreConnectedExcluding (dBodyID body1, dBodyID body2, int joint_type);