26 #ifndef _ODE_ODECPP_H_
27 #define _ODE_ODECPP_H_
36 class dWorldSimpleIDContainer {
40 dWorldSimpleIDContainer(): _id(0) {}
41 ~dWorldSimpleIDContainer() { destroy(); }
51 class dWorldDynamicIDContainer:
public dWorldSimpleIDContainer {
53 virtual ~dWorldDynamicIDContainer() {}
56 template <
class dWorldTemplateBase>
57 class dWorldTemplate:
public dWorldTemplateBase {
59 dWorldTemplate (
const dWorldTemplate<dWorldTemplateBase> &);
60 void operator= (
const dWorldTemplate<dWorldTemplateBase> &);
63 dWorldID get_id()
const {
return dWorldTemplateBase::_id; }
64 void set_id(dWorldID value) { dWorldTemplateBase::_id = value; }
72 operator dWorldID()
const
75 void setGravity (dReal x, dReal y, dReal z)
77 void setGravity (
const dVector3 g)
78 { setGravity (g[0], g[1], g[2]); }
79 void getGravity (dVector3 g)
const
82 void setERP (dReal erp)
87 void setCFM (dReal cfm)
92 void step (dReal stepsize)
95 void quickStep(dReal stepsize)
97 void setQuickStepNumIterations(
int num)
99 int getQuickStepNumIterations()
const
101 void setQuickStepW(dReal over_relaxation)
103 dReal getQuickStepW()
const
106 void setAutoDisableLinearThreshold (dReal threshold)
108 dReal getAutoDisableLinearThreshold()
const
110 void setAutoDisableAngularThreshold (dReal threshold)
112 dReal getAutoDisableAngularThreshold()
const
114 void setAutoDisableSteps (
int steps)
116 int getAutoDisableSteps()
const
118 void setAutoDisableTime (dReal time)
120 dReal getAutoDisableTime()
const
122 void setAutoDisableFlag (
int do_auto_disable)
124 int getAutoDisableFlag()
const
127 dReal getLinearDampingThreshold()
const
129 void setLinearDampingThreshold(dReal threshold)
131 dReal getAngularDampingThreshold()
const
133 void setAngularDampingThreshold(dReal threshold)
135 dReal getLinearDamping()
const
137 void setLinearDamping(dReal scale)
139 dReal getAngularDamping()
const
141 void setAngularDamping(dReal scale)
143 void setDamping(dReal linear_scale, dReal angular_scale)
146 dReal getMaxAngularSpeed()
const
148 void setMaxAngularSpeed(dReal max_speed)
151 void setContactSurfaceLayer(dReal depth)
153 dReal getContactSurfaceLayer()
const
156 void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
162 class dBodySimpleIDContainer {
166 dBodySimpleIDContainer(): _id(0) {}
167 ~dBodySimpleIDContainer() { destroy(); }
177 class dBodyDynamicIDContainer:
public dBodySimpleIDContainer {
179 virtual ~dBodyDynamicIDContainer() {}
182 template <
class dBodyTemplateBase,
class dWorldTemplateBase>
183 class dBodyTemplate:
public dBodyTemplateBase {
185 dBodyTemplate (
const dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase> &);
186 void operator= (
const dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase> &);
189 dBodyID get_id()
const {
return dBodyTemplateBase::_id; }
190 void set_id(dBodyID value) { dBodyTemplateBase::_id = value; }
192 void destroy() { dBodyTemplateBase::destroy(); }
197 dBodyTemplate (dWorldID world)
199 dBodyTemplate (dWorldTemplate<dWorldTemplateBase>& world)
202 void create (dWorldID world) {
206 void create (dWorldTemplate<dWorldTemplateBase>& world) {
212 operator dBodyID()
const
215 void setData (
void *data)
217 void *getData()
const
220 void setPosition (dReal x, dReal y, dReal z)
222 void setPosition (
const dVector3 p)
223 { setPosition(p[0], p[1], p[2]); }
225 void setRotation (
const dMatrix3 R)
227 void setQuaternion (
const dQuaternion q)
229 void setLinearVel (dReal x, dReal y, dReal z)
231 void setLinearVel (
const dVector3 v)
232 { setLinearVel(v[0], v[1], v[2]); }
233 void setAngularVel (dReal x, dReal y, dReal z)
235 void setAngularVel (
const dVector3 v)
236 { setAngularVel (v[0], v[1], v[2]); }
238 const dReal * getPosition()
const
240 const dReal * getRotation()
const
242 const dReal * getQuaternion()
const
244 const dReal * getLinearVel()
const
246 const dReal * getAngularVel()
const
249 void setMass (
const dMass *mass)
251 void setMass (
const dMass &mass)
253 dMass getMass ()
const
256 void addForce (dReal fx, dReal fy, dReal fz)
258 void addForce (
const dVector3 f)
259 { addForce (f[0], f[1], f[2]); }
260 void addTorque (dReal fx, dReal fy, dReal fz)
262 void addTorque (
const dVector3 t)
263 { addTorque(t[0], t[1], t[2]); }
265 void addRelForce (dReal fx, dReal fy, dReal fz)
267 void addRelForce (
const dVector3 f)
268 { addRelForce (f[0], f[1], f[2]); }
269 void addRelTorque (dReal fx, dReal fy, dReal fz)
271 void addRelTorque (
const dVector3 t)
272 { addRelTorque (t[0], t[1], t[2]); }
274 void addForceAtPos (dReal fx, dReal fy, dReal fz,
275 dReal px, dReal py, dReal pz)
277 void addForceAtPos (
const dVector3 f,
const dVector3 p)
278 { addForceAtPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
280 void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
281 dReal px, dReal py, dReal pz)
283 void addForceAtRelPos (
const dVector3 f,
const dVector3 p)
284 { addForceAtRelPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
286 void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
287 dReal px, dReal py, dReal pz)
289 void addRelForceAtPos (
const dVector3 f,
const dVector3 p)
290 { addRelForceAtPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
292 void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
293 dReal px, dReal py, dReal pz)
295 void addRelForceAtRelPos (
const dVector3 f,
const dVector3 p)
296 { addRelForceAtRelPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
298 const dReal * getForce()
const
300 const dReal * getTorque()
const
302 void setForce (dReal x, dReal y, dReal z)
304 void setForce (
const dVector3 f)
305 { setForce (f[0], f[1], f[2]); }
306 void setTorque (dReal x, dReal y, dReal z)
308 void setTorque (
const dVector3 t)
309 { setTorque (t[0], t[1], t[2]); }
315 bool isKinematic()
const
322 bool isEnabled()
const
325 void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result)
const
327 void getRelPointPos (
const dVector3 p, dVector3 result)
const
328 { getRelPointPos (p[0], p[1], p[2], result); }
330 void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result)
const
332 void getRelPointVel (
const dVector3 p, dVector3 result)
const
333 { getRelPointVel (p[0], p[1], p[2], result); }
335 void getPointVel (dReal px, dReal py, dReal pz, dVector3 result)
const
337 void getPointVel (
const dVector3 p, dVector3 result)
const
338 { getPointVel (p[0], p[1], p[2], result); }
340 void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result)
const
342 void getPosRelPoint (
const dVector3 p, dVector3 result)
const
343 { getPosRelPoint (p[0], p[1], p[2], result); }
345 void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result)
const
347 void vectorToWorld (
const dVector3 p, dVector3 result)
const
348 { vectorToWorld (p[0], p[1], p[2], result); }
350 void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result)
const
352 void vectorFromWorld (
const dVector3 p, dVector3 result)
const
353 { vectorFromWorld (p[0], p[1], p[2], result); }
355 void setFiniteRotationMode (
bool mode)
358 void setFiniteRotationAxis (dReal x, dReal y, dReal z)
360 void setFiniteRotationAxis (
const dVector3 a)
361 { setFiniteRotationAxis (a[0], a[1], a[2]); }
363 bool getFiniteRotationMode()
const
365 void getFiniteRotationAxis (dVector3 result)
const
368 int getNumJoints()
const
370 dJointID getJoint (
int index)
const
373 void setGravityMode (
bool mode)
375 bool getGravityMode()
const
378 bool isConnectedTo (dBodyID body)
const
381 void setAutoDisableLinearThreshold (dReal threshold)
383 dReal getAutoDisableLinearThreshold()
const
385 void setAutoDisableAngularThreshold (dReal threshold)
387 dReal getAutoDisableAngularThreshold()
const
389 void setAutoDisableSteps (
int steps)
391 int getAutoDisableSteps()
const
393 void setAutoDisableTime (dReal time)
395 dReal getAutoDisableTime()
const
397 void setAutoDisableFlag (
bool do_auto_disable)
399 bool getAutoDisableFlag()
const
402 dReal getLinearDamping()
const
404 void setLinearDamping(dReal scale)
406 dReal getAngularDamping()
const
408 void setAngularDamping(dReal scale)
410 void setDamping(dReal linear_scale, dReal angular_scale)
412 dReal getLinearDampingThreshold()
const
414 void setLinearDampingThreshold(dReal threshold)
const
416 dReal getAngularDampingThreshold()
const
418 void setAngularDampingThreshold(dReal threshold)
420 void setDampingDefaults()
423 dReal getMaxAngularSpeed()
const
425 void setMaxAngularSpeed(dReal max_speed)
428 bool getGyroscopicMode()
const
430 void setGyroscopicMode(
bool mode)
436 class dJointGroupSimpleIDContainer {
440 dJointGroupSimpleIDContainer(): _id(0) {}
441 ~dJointGroupSimpleIDContainer() { destroy(); }
451 class dJointGroupDynamicIDContainer:
public dJointGroupSimpleIDContainer {
453 virtual ~dJointGroupDynamicIDContainer() {}
456 template <
class dJo
intGroupTemplateBase>
457 class dJointGroupTemplate:
public dJointGroupTemplateBase {
459 dJointGroupTemplate (
const dJointGroupTemplate<dJointGroupTemplateBase> &);
460 void operator= (
const dJointGroupTemplate<dJointGroupTemplateBase> &);
463 dJointGroupID get_id()
const {
return dJointGroupTemplateBase::_id; }
464 void set_id(dJointGroupID value) { dJointGroupTemplateBase::_id = value; }
466 void destroy() { dJointGroupTemplateBase::destroy(); }
469 dJointGroupTemplate ()
477 dJointGroupID id()
const
479 operator dJointGroupID()
const
489 class dJointSimpleIDContainer {
493 dJointSimpleIDContainer(): _id(0) {}
494 ~dJointSimpleIDContainer() { destroy(); }
504 class dJointDynamicIDContainer:
public dJointSimpleIDContainer {
506 virtual ~dJointDynamicIDContainer() {}
509 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
510 class dJointTemplate:
public dJointTemplateBase {
513 dJointTemplate (
const dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &) ;
514 void operator= (
const dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
517 dJointID get_id()
const {
return dJointTemplateBase::_id; }
518 void set_id(dJointID value) { dJointTemplateBase::_id = value; }
520 void destroy() { dJointTemplateBase::destroy(); }
529 operator dJointID()
const
532 int getNumBodies()
const
535 void attach (dBodyID body1, dBodyID body2)
537 void attach (dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase>& body1, dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase>& body2)
538 { attach(body1.id(), body2.id()); }
544 bool isEnabled()
const
547 void setData (
void *data)
549 void *getData()
const
552 dJointType getType()
const
555 dBodyID getBody (
int index)
const
564 virtual void setParam (
int, dReal) {};
565 virtual dReal getParam (
int)
const {
return 0; }
569 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
570 class dBallJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
573 dBallJointTemplate (
const dBallJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
574 void operator= (
const dBallJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
577 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
579 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
580 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
582 void destroy() { dBaseTemplate::destroy(); }
585 dBallJointTemplate() { }
586 dBallJointTemplate (dWorldID world, dJointGroupID group=0)
588 dBallJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
591 void create (dWorldID world, dJointGroupID group=0) {
595 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
596 { create(world.id(), group); }
598 void setAnchor (dReal x, dReal y, dReal z)
600 void setAnchor (
const dVector3 a)
601 { setAnchor (a[0], a[1], a[2]); }
602 void getAnchor (dVector3 result)
const
603 { dJointGetBallAnchor (get_id(), result); }
604 void getAnchor2 (dVector3 result)
const
605 { dJointGetBallAnchor2 (get_id(), result); }
606 virtual void setParam (
int parameter, dReal value)
608 virtual dReal getParam (
int parameter)
const
614 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
615 class dHingeJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
618 dHingeJointTemplate (
const dHingeJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
619 void operator = (
const dHingeJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
622 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
624 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
625 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
627 void destroy() { dBaseTemplate::destroy(); }
630 dHingeJointTemplate() { }
631 dHingeJointTemplate (dWorldID world, dJointGroupID group=0)
633 dHingeJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
636 void create (dWorldID world, dJointGroupID group=0) {
640 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
641 { create(world.id(), group); }
643 void setAnchor (dReal x, dReal y, dReal z)
645 void setAnchor (
const dVector3 a)
646 { setAnchor (a[0], a[1], a[2]); }
647 void getAnchor (dVector3 result)
const
649 void getAnchor2 (dVector3 result)
const
652 void setAxis (dReal x, dReal y, dReal z)
654 void setAxis (
const dVector3 a)
655 { setAxis(a[0], a[1], a[2]); }
656 void getAxis (dVector3 result)
const
659 dReal getAngle()
const
661 dReal getAngleRate()
const
664 virtual void setParam (
int parameter, dReal value)
666 virtual dReal getParam (
int parameter)
const
670 void addTorque (dReal torque)
675 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
676 class dSliderJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
679 dSliderJointTemplate (
const dSliderJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
680 void operator = (
const dSliderJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
683 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
685 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
686 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
688 void destroy() { dBaseTemplate::destroy(); }
691 dSliderJointTemplate() { }
692 dSliderJointTemplate (dWorldID world, dJointGroupID group=0)
694 dSliderJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
697 void create (dWorldID world, dJointGroupID group=0) {
701 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
702 { create(world.id(), group); }
704 void setAxis (dReal x, dReal y, dReal z)
706 void setAxis (
const dVector3 a)
707 { setAxis (a[0], a[1], a[2]); }
708 void getAxis (dVector3 result)
const
711 dReal getPosition()
const
713 dReal getPositionRate()
const
716 virtual void setParam (
int parameter, dReal value)
718 virtual dReal getParam (
int parameter)
const
722 void addForce (dReal force)
727 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
728 class dUniversalJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
731 dUniversalJointTemplate (
const dUniversalJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
732 void operator = (
const dUniversalJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
735 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
737 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
738 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
740 void destroy() { dBaseTemplate::destroy(); }
743 dUniversalJointTemplate() { }
744 dUniversalJointTemplate (dWorldID world, dJointGroupID group=0)
746 dUniversalJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
749 void create (dWorldID world, dJointGroupID group=0) {
753 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
754 { create(world.id(), group); }
756 void setAnchor (dReal x, dReal y, dReal z)
758 void setAnchor (
const dVector3 a)
759 { setAnchor(a[0], a[1], a[2]); }
760 void setAxis1 (dReal x, dReal y, dReal z)
762 void setAxis1 (
const dVector3 a)
763 { setAxis1 (a[0], a[1], a[2]); }
764 void setAxis2 (dReal x, dReal y, dReal z)
766 void setAxis2 (
const dVector3 a)
767 { setAxis2 (a[0], a[1], a[2]); }
769 void getAnchor (dVector3 result)
const
771 void getAnchor2 (dVector3 result)
const
773 void getAxis1 (dVector3 result)
const
775 void getAxis2 (dVector3 result)
const
778 virtual void setParam (
int parameter, dReal value)
780 virtual dReal getParam (
int parameter)
const
784 void getAngles(dReal *angle1, dReal *angle2)
const
787 dReal getAngle1()
const
789 dReal getAngle1Rate()
const
791 dReal getAngle2()
const
793 dReal getAngle2Rate()
const
796 void addTorques (dReal torque1, dReal torque2)
801 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
802 class dHinge2JointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
805 dHinge2JointTemplate (
const dHinge2JointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
806 void operator = (
const dHinge2JointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
809 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
811 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
812 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
814 void destroy() { dBaseTemplate::destroy(); }
817 dHinge2JointTemplate() { }
818 dHinge2JointTemplate (dWorldID world, dJointGroupID group=0)
820 dHinge2JointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
823 void create (dWorldID world, dJointGroupID group=0) {
827 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
828 { create(world.id(), group); }
830 void setAnchor (dReal x, dReal y, dReal z)
832 void setAnchor (
const dVector3 a)
833 { setAnchor(a[0], a[1], a[2]); }
834 void setAxis1 (dReal x, dReal y, dReal z)
836 void setAxis1 (
const dVector3 a)
837 { setAxis1 (a[0], a[1], a[2]); }
838 void setAxis2 (dReal x, dReal y, dReal z)
840 void setAxis2 (
const dVector3 a)
841 { setAxis2 (a[0], a[1], a[2]); }
843 void getAnchor (dVector3 result)
const
845 void getAnchor2 (dVector3 result)
const
847 void getAxis1 (dVector3 result)
const
849 void getAxis2 (dVector3 result)
const
852 dReal getAngle1()
const
854 dReal getAngle1Rate()
const
856 dReal getAngle2Rate()
const
859 virtual void setParam (
int parameter, dReal value)
861 virtual dReal getParam (
int parameter)
const
865 void addTorques(dReal torque1, dReal torque2)
870 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
871 class dPRJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
874 dPRJointTemplate (
const dPRJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
875 void operator = (
const dPRJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
878 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
880 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
881 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
883 void destroy() { dBaseTemplate::destroy(); }
886 dPRJointTemplate() { }
887 dPRJointTemplate (dWorldID world, dJointGroupID group=0)
889 dPRJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
892 void create (dWorldID world, dJointGroupID group=0) {
896 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
897 { create(world.id(), group); }
899 void setAnchor (dReal x, dReal y, dReal z)
901 void setAnchor (
const dVector3 a)
902 { setAnchor (a[0], a[1], a[2]); }
903 void setAxis1 (dReal x, dReal y, dReal z)
905 void setAxis1 (
const dVector3 a)
906 { setAxis1(a[0], a[1], a[2]); }
907 void setAxis2 (dReal x, dReal y, dReal z)
909 void setAxis2 (
const dVector3 a)
910 { setAxis2(a[0], a[1], a[2]); }
912 void getAnchor (dVector3 result)
const
914 void getAxis1 (dVector3 result)
const
916 void getAxis2 (dVector3 result)
const
919 dReal getPosition()
const
921 dReal getPositionRate()
const
924 dReal getAngle()
const
926 dReal getAngleRate()
const
929 virtual void setParam (
int parameter, dReal value)
931 virtual dReal getParam (
int parameter)
const
937 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
938 class dPUJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase>
942 dPUJointTemplate (
const dPUJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
943 void operator = (
const dPUJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
946 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
948 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
949 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
951 void destroy() { dBaseTemplate::destroy(); }
954 dPUJointTemplate() { }
955 dPUJointTemplate (dWorldID world, dJointGroupID group=0)
957 dPUJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
960 void create (dWorldID world, dJointGroupID group=0)
965 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
966 { create(world.id(), group); }
968 void setAnchor (dReal x, dReal y, dReal z)
970 void setAnchor (
const dVector3 a)
971 { setAnchor (a[0], a[1], a[2]); }
972 void setAxis1 (dReal x, dReal y, dReal z)
974 void setAxis1 (
const dVector3 a)
975 { setAxis1(a[0], a[1], a[2]); }
976 void setAxis2 (dReal x, dReal y, dReal z)
978 void setAxis3 (dReal x, dReal y, dReal z)
980 void setAxis3 (
const dVector3 a)
981 { setAxis3(a[0], a[1], a[2]); }
982 void setAxisP (dReal x, dReal y, dReal z)
984 void setAxisP (
const dVector3 a)
985 { setAxisP(a[0], a[1], a[2]); }
987 virtual void getAnchor (dVector3 result)
const
989 void getAxis1 (dVector3 result)
const
991 void getAxis2 (dVector3 result)
const
993 void getAxis3 (dVector3 result)
const
995 void getAxisP (dVector3 result)
const
998 dReal getAngle1()
const
1000 dReal getAngle1Rate()
const
1002 dReal getAngle2()
const
1004 dReal getAngle2Rate()
const
1007 dReal getPosition()
const
1009 dReal getPositionRate()
const
1012 virtual void setParam (
int parameter, dReal value)
1014 virtual dReal getParam (
int parameter)
const
1023 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
1024 class dPistonJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase>
1028 dPistonJointTemplate (
const dPistonJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1029 void operator = (
const dPistonJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1032 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1034 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
1035 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1037 void destroy() { dBaseTemplate::destroy(); }
1040 dPistonJointTemplate() { }
1041 dPistonJointTemplate (dWorldID world, dJointGroupID group=0)
1043 dPistonJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1046 void create (dWorldID world, dJointGroupID group=0)
1051 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1052 { create(world.id(), group); }
1054 void setAnchor (dReal x, dReal y, dReal z)
1056 void setAnchor (
const dVector3 a)
1057 { setAnchor (a[0], a[1], a[2]); }
1058 void getAnchor (dVector3 result)
const
1060 void getAnchor2 (dVector3 result)
const
1063 void setAxis (dReal x, dReal y, dReal z)
1065 void setAxis (
const dVector3 a)
1066 { setAxis(a[0], a[1], a[2]); }
1067 void getAxis (dVector3 result)
const
1070 dReal getPosition()
const
1072 dReal getPositionRate()
const
1075 virtual void setParam (
int parameter, dReal value)
1077 virtual dReal getParam (
int parameter)
const
1081 void addForce (dReal force)
1087 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
1088 class dFixedJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase>
1092 dFixedJointTemplate (
const dFixedJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1093 void operator = (
const dFixedJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1096 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1098 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
1099 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1101 void destroy() { dBaseTemplate::destroy(); }
1104 dFixedJointTemplate() { }
1105 dFixedJointTemplate (dWorldID world, dJointGroupID group=0)
1107 dFixedJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1110 void create (dWorldID world, dJointGroupID group=0) {
1114 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1115 { create(world.id(), group); }
1120 virtual void setParam (
int parameter, dReal value)
1121 { dJointSetFixedParam (get_id(), parameter, value); }
1123 virtual dReal getParam (
int parameter)
const
1129 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
1130 class dContactJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1133 dContactJointTemplate (
const dContactJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1134 void operator = (
const dContactJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1137 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1139 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
1140 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1142 void destroy() { dBaseTemplate::destroy(); }
1145 dContactJointTemplate() { }
1146 dContactJointTemplate (dWorldID world, dJointGroupID group,
dContact *contact)
1148 dContactJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group,
dContact *contact)
1151 void create (dWorldID world, dJointGroupID group,
dContact *contact) {
1156 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group,
dContact *contact)
1157 { create(world.id(), group, contact); }
1161 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
1162 class dNullJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1165 dNullJointTemplate (
const dNullJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1166 void operator = (
const dNullJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1169 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1171 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
1172 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1174 void destroy() { dBaseTemplate::destroy(); }
1177 dNullJointTemplate() { }
1178 dNullJointTemplate (dWorldID world, dJointGroupID group=0)
1179 { set_id(dJointCreateNull(world, group)); }
1180 dNullJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1181 { set_id(dJointCreateNull (world.id(), group)); }
1183 void create (dWorldID world, dJointGroupID group=0) {
1185 set_id(dJointCreateNull(world, group));
1187 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1188 { create(world.id(), group); }
1192 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
1193 class dAMotorJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1196 dAMotorJointTemplate (
const dAMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1197 void operator = (
const dAMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1200 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1202 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
1203 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1205 void destroy() { dBaseTemplate::destroy(); }
1208 dAMotorJointTemplate() { }
1209 dAMotorJointTemplate (dWorldID world, dJointGroupID group=0)
1211 dAMotorJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1214 void create (dWorldID world, dJointGroupID group=0) {
1218 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1219 { create(world.id(), group); }
1221 void setMode (
int mode)
1226 void setNumAxes (
int num)
1228 int getNumAxes()
const
1231 void setAxis (
int anum,
int rel, dReal x, dReal y, dReal z)
1233 void setAxis (
int anum,
int rel,
const dVector3 a)
1234 { setAxis(anum, rel, a[0], a[1], a[2]); }
1235 void getAxis (
int anum, dVector3 result)
const
1237 int getAxisRel (
int anum)
const
1240 void setAngle (
int anum, dReal angle)
1242 dReal getAngle (
int anum)
const
1244 dReal getAngleRate (
int anum)
1247 void setParam (
int parameter, dReal value)
1249 dReal getParam (
int parameter)
const
1253 void addTorques(dReal torque1, dReal torque2, dReal torque3)
1258 template <
class dJo
intTemplateBase,
class dWorldTemplateBase,
class dBodyTemplateBase>
1259 class dLMotorJointTemplate :
public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1262 dLMotorJointTemplate (
const dLMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1263 void operator = (
const dLMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1266 typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1268 dJointID get_id()
const {
return dBaseTemplate::get_id(); }
1269 void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1271 void destroy() { dBaseTemplate::destroy(); }
1274 dLMotorJointTemplate() { }
1275 dLMotorJointTemplate (dWorldID world, dJointGroupID group=0)
1277 dLMotorJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1280 void create (dWorldID world, dJointGroupID group=0) {
1284 void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1285 { create(world.id(), group); }
1287 void setNumAxes (
int num)
1289 int getNumAxes()
const
1292 void setAxis (
int anum,
int rel, dReal x, dReal y, dReal z)
1294 void setAxis (
int anum,
int rel,
const dVector3 a)
1295 { setAxis(anum, rel, a[0], a[1], a[2]); }
1296 void getAxis (
int anum, dVector3 result)
const
1299 void setParam (
int parameter, dReal value)
1301 dReal getParam (
int parameter)
const
1308 #if !defined(dODECPP_WORLD_TEMPLATE_BASE)
1310 #if defined(dODECPP_BODY_TEMPLATE_BASE) || defined(dODECPP_JOINTGROUP_TEMPLATE_BASE) || defined(dODECPP_JOINT_TEMPLATE_BASE)
1311 #error All the odecpp template bases must be defined or not defined together
1314 #define dODECPP_WORLD_TEMPLATE_BASE dWorldDynamicIDContainer
1315 #define dODECPP_BODY_TEMPLATE_BASE dBodyDynamicIDContainer
1316 #define dODECPP_JOINTGROUP_TEMPLATE_BASE dJointGroupDynamicIDContainer
1317 #define dODECPP_JOINT_TEMPLATE_BASE dJointDynamicIDContainer
1319 #else // #if defined(dODECPP_WORLD_TEMPLATE_BASE)
1321 #if !defined(dODECPP_BODY_TEMPLATE_BASE) || !defined(dODECPP_JOINTGROUP_TEMPLATE_BASE) || !defined(dODECPP_JOINT_TEMPLATE_BASE)
1322 #error All the odecpp template bases must be defined or not defined together
1325 #endif // #if defined(dODECPP_WORLD_TEMPLATE_BASE)
1328 typedef dWorldTemplate<dODECPP_WORLD_TEMPLATE_BASE> dWorld;
1329 typedef dBodyTemplate<dODECPP_BODY_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE> dBody;
1330 typedef dJointGroupTemplate<dODECPP_JOINTGROUP_TEMPLATE_BASE> dJointGroup;
1331 typedef dJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dJoint;
1332 typedef dBallJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dBallJoint;
1333 typedef dHingeJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dHingeJoint;
1334 typedef dSliderJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dSliderJoint;
1335 typedef dUniversalJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dUniversalJoint;
1336 typedef dHinge2JointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dHinge2Joint;
1337 typedef dPRJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dPRJoint;
1338 typedef dPUJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dPUJoint;
1339 typedef dPistonJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dPistonJoint;
1340 typedef dFixedJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dFixedJoint;
1341 typedef dContactJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dContactJoint;
1342 typedef dNullJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dNullJoint;
1343 typedef dAMotorJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dAMotorJoint;
1344 typedef dLMotorJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dLMotorJoint;
dReal dJointGetHinge2Angle1(dJointID)
Get angle.
void dJointGetLMotorAxis(dJointID, int anum, dVector3 result)
Get axis.
void dJointGetAMotorAxis(dJointID, int anum, dVector3 result)
Get the AMotor axes.
int dWorldStep(dWorldID w, dReal stepsize)
Step the world.
dJointGroupID dJointGroupCreate(int max_size)
Create a joint group.
const dReal * dBodyGetLinearVel(dBodyID)
Get the linear velocity of a body.
dReal dWorldGetAutoDisableTime(dWorldID)
Get auto disable time for newly created bodies.
void dJointGroupEmpty(dJointGroupID)
Empty a joint group.All joints in the joint group will be destroyed, but the joint group itself will ...
void dJointSetFeedback(dJointID, dJointFeedback *)
Sets the datastructure that is to receive the feedback.
dReal dJointGetAMotorAngle(dJointID, int anum)
Get the current angle for axis.
void dJointSetData(dJointID, void *data)
Set the user-data pointer.
dJointID dJointCreateContact(dWorldID, dJointGroupID, const dContact *)
Create a new joint of the contact type.
dReal dBodyGetAngularDamping(dBodyID b)
Get the body's angular damping scale.
void dJointAttach(dJointID, dBodyID body1, dBodyID body2)
Attach the joint to some new bodies.If the joint is already attached, it will be detached from the ol...
dReal dBodyGetAngularDampingThreshold(dBodyID b)
Get the body's angular damping threshold.
void dJointSetUniversalParam(dJointID, int parameter, dReal value)
set joint parameter
int dWorldGetQuickStepNumIterations(dWorldID)
Get the number of iterations that the QuickStep method performs per step.
void dBodySetData(dBodyID, void *data)
Set the body's user-data pointer.
const dReal * dBodyGetQuaternion(dBodyID)
Get the rotation of a body.
dReal dJointGetSliderPosition(dJointID)
Get the slider linear position (i.e. the slider's extension)
dReal dJointGetPUPositionRate(dJointID)
Get the PR linear position's time derivative.
dReal dBodyGetAutoDisableAngularThreshold(dBodyID)
Get auto disable angular average threshold.
void dBodySetAutoDisableFlag(dBodyID, int do_auto_disable)
Set auto disable flag.
void dBodySetLinearDampingThreshold(dBodyID b, dReal threshold)
Set the body's linear damping threshold.
dReal dBodyGetAutoDisableLinearThreshold(dBodyID)
Get auto disable linear average threshold.
int dJointGetAMotorNumAxes(dJointID)
Get the number of angular axes that will be controlled by the AMotor.
dReal dJointGetPRPositionRate(dJointID)
Get the PR linear position's time derivative.
void dWorldSetLinearDamping(dWorldID w, dReal scale)
Set the world's linear damping scale.
void dBodyDestroy(dBodyID)
Destroy a body.
void dJointGetUniversalAngles(dJointID, dReal *angle1, dReal *angle2)
Get both angles at the same time.
void dJointDestroy(dJointID)
Destroy a joint.disconnects it from its attached bodies and removing it from the world. However, if the joint is a member of a group then this function has no effect - to destroy that joint the group must be emptied or destroyed.
int dBodyGetGravityMode(dBodyID b)
Get whether the body is influenced by the world's gravity or not.
void dBodyAddForceAtRelPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in local coordinates.
void dJointGetPistonAnchor2(dJointID, dVector3 result)
Get the joint anchor w.r.t. body 2.
void dJointSetPistonParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dWorldGetCFM(dWorldID)
Get the constraint force mixing value.
int dBodyGetFiniteRotationMode(dBodyID)
Get the way a body's orientation is updated each timestep.
void dJointGetPistonAxis(dJointID, dVector3 result)
Get the prismatic axis (This is also the rotoide axis.
const dReal * dBodyGetAngularVel(dBodyID)
Get the angular velocity of a body.
void dBodyAddRelTorque(dBodyID, dReal fx, dReal fy, dReal fz)
Add torque at centre of mass of body in coordinates relative to body.
int dJointGetAMotorAxisRel(dJointID, int anum)
Get axis.
void dWorldSetMaxAngularSpeed(dWorldID w, dReal max_speed)
Set the default maximum angular speed for new bodies.
dReal dJointGetFixedParam(dJointID, int parameter)
get joint parameter
void dWorldGetGravity(dWorldID, dVector3 gravity)
Get the gravity vector for a given world.
dReal dJointGetPRPosition(dJointID)
Get the PR linear position (i.e. the prismatic's extension)
dReal dJointGetPistonPositionRate(dJointID)
Get the piston linear position's time derivative.
void dBodyAddForce(dBodyID, dReal fx, dReal fy, dReal fz)
Add force at centre of mass of body in absolute coordinates.
int dBodyGetGyroscopicMode(dBodyID b)
Get the body's gyroscopic state.
void dWorldSetAutoDisableTime(dWorldID, dReal time)
Set auto disable time for newly created bodies.
void dJointGetUniversalAxis1(dJointID, dVector3 result)
Get axis.
void dBodySetAngularDampingThreshold(dBodyID b, dReal threshold)
Set the body's angular damping threshold.
int dAreConnected(dBodyID, dBodyID)
Utility function.
dReal dJointGetHinge2Angle1Rate(dJointID)
Get time derivative of angle.
void dJointGetPUAxis2(dJointID, dVector3 result)
Get the second axis of the Universal component of the joint.
dReal dJointGetSliderParam(dJointID, int parameter)
get joint parameter
void dJointSetPUAxis3(dJointID, dReal x, dReal y, dReal z)
set the axis for the prismatic articulation
void dBodySetDamping(dBodyID b, dReal linear_scale, dReal angular_scale)
Convenience function to set linear and angular scales at once.
dReal dJointGetLMotorParam(dJointID, int parameter)
get joint parameter
dReal dJointGetUniversalAngle2Rate(dJointID)
Get time derivative of angle.
void dJointSetPRAxis2(dJointID, dReal x, dReal y, dReal z)
set the axis for the rotoide articulation
void dJointSetBallParam(dJointID, int parameter, dReal value)
Param setting for Ball joints.
void dJointGetPUAxis1(dJointID, dVector3 result)
Get the first axis of the universal component of the joint.
void dJointDisable(dJointID)
Manually disable a joint.
void dWorldSetAngularDamping(dWorldID w, dReal scale)
Set the world's angular damping scale.
void dJointSetPistonAnchor(dJointID, dReal x, dReal y, dReal z)
set the joint anchor
void dJointSetPUParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetPistonPosition(dJointID)
Get the Piston linear position (i.e. the piston's extension)
void dWorldSetCFM(dWorldID, dReal cfm)
Set the global CFM (constraint force mixing) value.
dReal dWorldGetLinearDamping(dWorldID w)
Get the world's linear damping scale.
void dWorldSetContactSurfaceLayer(dWorldID, dReal depth)
Set the depth of the surface layer around all geometry objects.
void dJointGetUniversalAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2)
Applies torque1 about the hinge2's axis 1, torque2 about the hinge2's axis 2.
dReal dJointGetPUAngle1(dJointID)
Get angle.
void dJointSetPistonAxis(dJointID, dReal x, dReal y, dReal z)
set the joint axis
void dBodySetFiniteRotationMode(dBodyID, int mode)
controls the way a body's orientation is updated at each timestep.
void dJointSetSliderParam(dJointID, int parameter, dReal value)
set joint parameter
void dBodySetLinearVel(dBodyID, dReal x, dReal y, dReal z)
Set the linear velocity of a body.
void dBodySetGyroscopicMode(dBodyID b, int enabled)
Enable/disable the body's gyroscopic term.
int dBodyGetAutoDisableFlag(dBodyID)
Get auto disable flag.
const dReal * dBodyGetRotation(dBodyID)
Get the rotation of a body.
void dJointSetUniversalAxis2(dJointID, dReal x, dReal y, dReal z)
set axis
int dJointIsEnabled(dJointID)
Check wether a joint is enabled.
void dBodySetPosition(dBodyID, dReal x, dReal y, dReal z)
Set position of a body.
void dJointSetHinge2Axis2(dJointID, dReal x, dReal y, dReal z)
set axis
void dJointGetUniversalAxis2(dJointID, dVector3 result)
Get axis.
int dWorldQuickStep(dWorldID w, dReal stepsize)
Quick-step the world.
void dJointSetLMotorNumAxes(dJointID, int num)
Set the number of axes that will be controlled by the LMotor.
dReal dWorldGetAutoDisableAngularThreshold(dWorldID)
Get auto disable angular threshold for newly created bodies.
void dBodySetAngularDamping(dBodyID b, dReal scale)
Set the body's angular damping scale.
void dJointGetPRAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dBodyGetRelPointPos(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get world position of a relative point on body.
void dJointSetAMotorParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetUniversalParam(dJointID, int parameter)
get joint parameter
void dBodyVectorToWorld(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Convert from local to world coordinates.
void dJointSetHingeParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetUniversalAngle2(dJointID)
Get angle.
dJointID dJointCreateLMotor(dWorldID, dJointGroupID)
Create a new joint of the L-motor type.
void dJointSetFixed(dJointID)
Call this on the fixed joint after it has been attached to remember the current desired relative offs...
void dJointSetHingeAxis(dJointID, dReal x, dReal y, dReal z)
Set hinge axis.
int dWorldGetAutoDisableFlag(dWorldID)
Get auto disable flag for newly created bodies.
void dBodySetAutoDisableSteps(dBodyID, int steps)
Set auto disable steps.
void dBodyGetRelPointVel(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get velocity vector in global coords of a relative point on body.
dJointID dJointCreateSlider(dWorldID, dJointGroupID)
Create a new joint of the slider type.
dJointID dBodyGetJoint(dBodyID, int index)
Return a joint attached to this body, given by index.
void dBodyGetPosRelPoint(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
takes a point in global coordinates and returns the point's position in body-relative coordinates...
dReal dWorldGetAngularDamping(dWorldID w)
Get the world's angular damping scale.
dReal dJointGetHinge2Angle2Rate(dJointID)
Get time derivative of angle.
void dJointSetHingeAnchor(dJointID, dReal x, dReal y, dReal z)
Set hinge anchor parameter.
void dWorldSetAutoDisableFlag(dWorldID, int do_auto_disable)
Set auto disable flag for newly created bodies.
const dReal * dBodyGetTorque(dBodyID)
Return the current accumulated torque vector.
void dWorldSetLinearDampingThreshold(dWorldID w, dReal threshold)
Set the world's linear damping threshold.
void dJointSetUniversalAxis1(dJointID, dReal x, dReal y, dReal z)
set axis
void dJointGetHingeAnchor(dJointID, dVector3 result)
Get the hinge anchor point, in world coordinates.
void dBodySetDynamic(dBodyID)
Set rigid body to dynamic state (default).
void dBodyGetMass(dBodyID, dMass *mass)
Get the mass of a body.
dReal dJointGetUniversalAngle1Rate(dJointID)
Get time derivative of angle.
void dWorldDestroy(dWorldID world)
Destroy a world and everything in it.
void dBodySetLinearDamping(dBodyID b, dReal scale)
Set the body's linear damping scale.
void dBodyAddForceAtPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in global coordinates.
void dWorldSetQuickStepW(dWorldID, dReal over_relaxation)
Set the SOR over-relaxation parameter.
void dWorldImpulseToForce(dWorldID, dReal stepsize, dReal ix, dReal iy, dReal iz, dVector3 force)
Converts an impulse to a force.
void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2)
Applies torque1 about the universal's axis 1, torque2 about the universal's axis 2.
dReal dJointGetUniversalAngle1(dJointID)
Get angle.
int dJointGetNumBodies(dJointID)
Return the number of bodies attached to the joint.
void dJointSetLMotorParam(dJointID, int parameter, dReal value)
set joint parameter
void dJointSetHinge2Param(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetPUAngle2(dJointID)
Get angle.
int dBodyIsKinematic(dBodyID)
Check wether a body is in kinematic state.
void dBodySetAutoDisableTime(dBodyID, dReal time)
Set auto disable time.
int dBodyIsEnabled(dBodyID)
Check wether a body is enabled.
void dJointSetHinge2Anchor(dJointID, dReal x, dReal y, dReal z)
set anchor
int dWorldGetAutoDisableSteps(dWorldID)
Get auto disable steps for newly created bodies.
int dBodyGetNumJoints(dBodyID b)
Get the number of joints that are attached to this body.
void dJointSetSliderAxis(dJointID, dReal x, dReal y, dReal z)
set the joint axis
void dWorldSetERP(dWorldID, dReal erp)
Set the global ERP value, that controls how much error correction is performed in each time step...
void dWorldSetAngularDampingThreshold(dWorldID w, dReal threshold)
Set the world's angular damping threshold.
void dWorldSetAutoDisableAngularThreshold(dWorldID, dReal angular_threshold)
Set auto disable angular threshold for newly created bodies.
dJointID dJointCreatePiston(dWorldID, dJointGroupID)
Create a new joint of the Piston type.
void dJointEnable(dJointID)
Manually enable a joint.
dJointID dJointCreatePU(dWorldID, dJointGroupID)
Create a new joint of the PU (Prismatic and Universal) type.
void dJointSetUniversalAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
void dBodyAddRelForceAtRelPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in local coordinates.
void dJointSetAMotorNumAxes(dJointID, int num)
set the nr of axes
dReal dJointGetPRAngle(dJointID)
Get the PR angular position (i.e. the twist between the 2 bodies)
void dBodySetForce(dBodyID b, dReal x, dReal y, dReal z)
Set the body force accumulation vector.
dReal dWorldGetLinearDampingThreshold(dWorldID w)
Get the world's linear damping threshold.
void dJointAddPistonForce(dJointID joint, dReal force)
Applies the given force in the slider's direction.
void dJointGetHinge2Axis2(dJointID, dVector3 result)
Get joint axis.
void dBodyAddRelForce(dBodyID, dReal fx, dReal fy, dReal fz)
Add force at centre of mass of body in coordinates relative to body.
void dJointGroupDestroy(dJointGroupID)
Destroy a joint group.All joints in the joint group will be destroyed.
void * dJointGetData(dJointID)
Get the user-data pointer.
dReal dJointGetHinge2Param(dJointID, int parameter)
get joint parameter
void dBodySetAutoDisableAngularThreshold(dBodyID, dReal angular_average_threshold)
Set auto disable angular average threshold.
void dBodySetGravityMode(dBodyID b, int mode)
Set whether the body is influenced by the world's gravity or not.
void dJointGetHingeAxis(dJointID, dVector3 result)
get axis
dReal dJointGetHingeParam(dJointID, int parameter)
get joint parameter
void dJointGetPRAxis2(dJointID, dVector3 result)
Get the Rotoide axis.
dJointID dJointCreateAMotor(dWorldID, dJointGroupID)
Create a new joint of the A-motor type.
void dJointGetPistonAnchor(dJointID, dVector3 result)
Get the joint anchor.
void dWorldSetQuickStepNumIterations(dWorldID, int num)
Set the number of iterations that the QuickStep method performs per step.
dReal dJointGetAMotorParam(dJointID, int parameter)
get joint parameter
void dJointSetAMotorMode(dJointID, int mode)
set mode
void dBodySetMaxAngularSpeed(dBodyID b, dReal max_speed)
Set the body's maximum angular speed.
dReal dJointGetPRParam(dJointID, int parameter)
get joint parameter
void dBodyAddTorque(dBodyID, dReal fx, dReal fy, dReal fz)
Add torque at centre of mass of body in absolute coordinates.
void dBodySetFiniteRotationAxis(dBodyID, dReal x, dReal y, dReal z)
sets the finite rotation axis for a body.
dReal dWorldGetAutoDisableLinearThreshold(dWorldID)
Get auto disable linear threshold for newly created bodies.
dReal dJointGetBallParam(dJointID, int parameter)
get joint parameter
void dJointGetHingeAnchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
dReal dJointGetHingeAngle(dJointID)
Get the hinge angle.
int dBodyGetAutoDisableSteps(dBodyID)
Get auto steps a body must be thought of as idle to disable.
dWorldID dWorldCreate(void)
Create a new, empty world and return its ID number.
void dJointSetBallAnchor(dJointID, dReal x, dReal y, dReal z)
Set the joint anchor point.The joint will try to keep this point on each body together. The input is specified in world coordinates.
void dJointGetPUAxis3(dJointID, dVector3 result)
Get the prismatic axis.
void dBodyVectorFromWorld(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Convert from world to local coordinates.
void dBodySetAutoDisableLinearThreshold(dBodyID, dReal linear_average_threshold)
Set auto disable linear average threshold.
void dJointSetAMotorAxis(dJointID, int anum, int rel, dReal x, dReal y, dReal z)
set axis
void dBodyEnable(dBodyID)
Manually enable a body.
dJointID dJointCreatePR(dWorldID, dJointGroupID)
Create a new joint of the PR (Prismatic and Rotoide) type.
void dJointSetPUAxis2(dJointID, dReal x, dReal y, dReal z)
set the axis for the second axis or the universal articulation
dReal dJointGetPUAngle1Rate(dJointID)
void dJointSetLMotorAxis(dJointID, int anum, int rel, dReal x, dReal y, dReal z)
Set the AMotor axes.
dReal dWorldGetERP(dWorldID)
Get the error reduction parameter.
dBodyID dJointGetBody(dJointID, int index)
Return the bodies that this joint connects.
int dJointGetLMotorNumAxes(dJointID)
Get nr of axes.
dJointFeedback * dJointGetFeedback(dJointID)
Gets the datastructure that is to receive the feedback.
void dJointGetHinge2Anchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates. This returns the point on body 2. If the joint is perfectly satisfied, this will return the same value as dJointGetHinge2Anchor. If not, this value will be slightly different. This can be used, for example, to see how far the joint has come apart.
dReal dBodyGetLinearDampingThreshold(dBodyID b)
Get the body's linear damping threshold.
void dBodyGetPointVel(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get velocity vector in global coords of a globally specified point on a body.
void dBodyAddRelForceAtPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in global coordinates.
void dWorldSetAutoDisableSteps(dWorldID, int steps)
Set auto disable steps for newly created bodies.
void dJointAddAMotorTorques(dJointID, dReal torque1, dReal torque2, dReal torque3)
Applies torque0 about the AMotor's axis 0, torque1 about the AMotor's axis 1, and torque2 about the A...
const dReal * dBodyGetPosition(dBodyID)
Get the position of a body.
void dWorldSetDamping(dWorldID w, dReal linear_scale, dReal angular_scale)
Convenience function to set body linear and angular scales.
void dBodySetRotation(dBodyID, const dMatrix3 R)
Set the orientation of a body.
dReal dBodyGetMaxAngularSpeed(dBodyID b)
Get the body's maximum angular speed.
dReal dJointGetPUPosition(dJointID)
Get the PU linear position (i.e. the prismatic's extension)
void dJointGetPRAxis1(dJointID, dVector3 result)
Get the prismatic axis.
void dWorldSetGravity(dWorldID, dReal x, dReal y, dReal z)
Set the world's global gravity vector.
dReal dJointGetHingeAngleRate(dJointID)
Get the hinge angle time derivative.
dReal dBodyGetAutoDisableTime(dBodyID)
Get auto disable time.
dJointID dJointCreateBall(dWorldID, dJointGroupID)
Create a new joint of the ball type.
void dJointSetPUAxis1(dJointID, dReal x, dReal y, dReal z)
set the axis for the first axis or the universal articulation
dJointID dJointCreateHinge2(dWorldID, dJointGroupID)
Create a new joint of the hinge2 type.
const dReal * dBodyGetForce(dBodyID)
Return the current accumulated force vector.
dReal dWorldGetAngularDampingThreshold(dWorldID w)
Get the world's angular damping threshold.
void dBodyGetFiniteRotationAxis(dBodyID, dVector3 result)
Get the finite rotation axis.
dBodyID dBodyCreate(dWorldID)
Create a body in given world.
int dJointGetAMotorMode(dJointID)
Get the angular motor mode.
void dJointGetSliderAxis(dJointID, dVector3 result)
Get the slider axis.
void dJointSetPRAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
void dJointAddSliderForce(dJointID joint, dReal force)
Applies the given force in the slider's direction.
dReal dJointGetPUAngle2Rate(dJointID)
void dBodySetAngularVel(dBodyID, dReal x, dReal y, dReal z)
Set the angular velocity of a body.
dReal dJointGetPUParam(dJointID, int parameter)
get joint parameter
dReal dWorldGetMaxAngularSpeed(dWorldID w)
Get the default maximum angular speed.
void dJointSetPRAxis1(dJointID, dReal x, dReal y, dReal z)
set the axis for the prismatic articulation
void dJointGetUniversalAnchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
dJointType dJointGetType(dJointID)
Get the type of the joint.
void dBodySetQuaternion(dBodyID, const dQuaternion q)
Set the orientation of a body.
void dJointGetHinge2Anchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dJointSetPRParam(dJointID, int parameter, dReal value)
set joint parameter
void dJointAddHingeTorque(dJointID joint, dReal torque)
Applies the torque about the hinge axis.
void dBodySetMass(dBodyID, const dMass *mass)
Set the mass of a body.
void dJointGetHinge2Axis1(dJointID, dVector3 result)
Get joint axis.
void dJointSetPUAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
dReal dWorldGetQuickStepW(dWorldID)
Get the SOR over-relaxation parameter.
void dJointSetHinge2Axis1(dJointID, dReal x, dReal y, dReal z)
set axis
void * dBodyGetData(dBodyID)
Get the body's user-data pointer.
void dBodyDisable(dBodyID)
Manually disable a body.
dJointID dJointCreateFixed(dWorldID, dJointGroupID)
Create a new joint of the fixed type.
void dBodySetDampingDefaults(dBodyID b)
Resets the damping settings to the current world's settings.
dReal dWorldGetContactSurfaceLayer(dWorldID)
Get the depth of the surface layer around all geometry objects.
dReal dJointGetAMotorAngleRate(dJointID, int anum)
Get the current angle rate for axis anum.
dJointID dJointCreateUniversal(dWorldID, dJointGroupID)
Create a new joint of the universal type.
void dBodySetTorque(dBodyID b, dReal x, dReal y, dReal z)
Set the body torque accumulation vector.
dReal dJointGetSliderPositionRate(dJointID)
Get the slider linear position's time derivative.
dReal dJointGetPRAngleRate(dJointID)
Get the PR angular position's time derivative.
void dBodySetKinematic(dBodyID)
Set rigid body to kinematic state. When in kinematic state the body isn't simulated as a dynamic body...
dReal dBodyGetLinearDamping(dBodyID b)
Get the body's linear damping scale.
dJointID dJointCreateHinge(dWorldID, dJointGroupID)
Create a new joint of the hinge type.
void dJointGetPUAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dWorldSetAutoDisableLinearThreshold(dWorldID, dReal linear_threshold)
Set auto disable linear threshold for newly created bodies.
dReal dJointGetPistonParam(dJointID, int parameter)
get joint parameter
void dJointSetAMotorAngle(dJointID, int anum, dReal angle)
Tell the AMotor what the current angle is along axis anum.