| objects.h | | objects.h | |
|
| | | | |
| /************************************************************************* | | /************************************************************************* | |
| * * | | * * | |
| * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * | | * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * | |
| * All rights reserved. Email: russ@q12.org Web: www.q12.org * | | * All rights reserved. Email: russ@q12.org Web: www.q12.org * | |
| * * | | * * | |
| * This library is free software; you can redistribute it and/or * | | * This library is free software; you can redistribute it and/or * | |
| * modify it under the terms of EITHER: * | | * modify it under the terms of EITHER: * | |
| * (1) The GNU Lesser General Public License as published by the Free * | | * (1) The GNU Lesser General Public License as published by the Free * | |
| * Software Foundation; either version 2.1 of the License, or (at * | | * Software Foundation; either version 2.1 of the License, or (at * | |
| * your option) any later version. The text of the GNU Lesser * | | * your option) any later version. The text of the GNU Lesser * | |
| | | | |
| skipping to change at line 1535 | | skipping to change at line 1536 | |
| | | | |
| ODE_API void dJointSetHingeAnchorDelta (dJointID, dReal x, dReal y, dReal z
, dReal ax, dReal ay, dReal az); | | ODE_API void dJointSetHingeAnchorDelta (dJointID, dReal x, dReal y, dReal z
, dReal ax, dReal ay, dReal az); | |
| | | | |
| /** | | /** | |
| * @brief Set hinge axis. | | * @brief Set hinge axis. | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z); | | ODE_API void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| /** | | /** | |
|
| | | * @brief Set the Hinge axis as if the 2 bodies were already at angle appar | |
| | | t. | |
| | | * @ingroup joints | |
| | | * | |
| | | * This function initialize the Axis and the relative orientation of each b | |
| | | ody | |
| | | * as if body1 was rotated around the axis by the angle value. \br | |
| | | * Ex: | |
| | | * <PRE> | |
| | | * dJointSetHingeAxis(jId, 1, 0, 0); | |
| | | * // If you request the position you will have: dJointGetHingeAngle(jId) = | |
| | | = 0 | |
| | | * dJointSetHingeAxisDelta(jId, 1, 0, 0, 0.23); | |
| | | * // If you request the position you will have: dJointGetHingeAngle(jId) = | |
| | | = 0.23 | |
| | | * </PRE> | |
| | | | |
| | | * @param j The Hinge joint ID for which the axis will be set | |
| | | * @param x The X component of the axis in world frame | |
| | | * @param y The Y component of the axis in world frame | |
| | | * @param z The Z component of the axis in world frame | |
| | | * @param angle The angle for the offset of the relative orientation. | |
| | | * As if body1 was rotated by angle when the Axis was set (see | |
| | | below). | |
| | | * The rotation is around the new Hinge axis. | |
| | | * | |
| | | * @note Usually the function dJointSetHingeAxis set the current position o | |
| | | f body1 | |
| | | * and body2 as the zero angle position. This function set the curren | |
| | | t position | |
| | | * as the if the 2 bodies where \b angle appart. | |
| | | * @warning Calling dJointSetHingeAnchor or dJointSetHingeAxis will reset t | |
| | | he "zero" | |
| | | * angle position. | |
| | | */ | |
| | | ODE_API void dJointSetHingeAxisOffset (dJointID j, dReal x, dReal y, dReal | |
| | | z, dReal angle); | |
| | | | |
| | | /** | |
| * @brief set joint parameter | | * @brief set joint parameter | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API void dJointSetHingeParam (dJointID, int parameter, dReal value); | | ODE_API void dJointSetHingeParam (dJointID, int parameter, dReal value); | |
| | | | |
| /** | | /** | |
| * @brief Applies the torque about the hinge axis. | | * @brief Applies the torque about the hinge axis. | |
| * | | * | |
| * That is, it applies a torque with specified magnitude in the direction | | * That is, it applies a torque with specified magnitude in the direction | |
| * of the hinge axis, to body 1, and with the same magnitude but in opposit
e | | * of the hinge axis, to body 1, and with the same magnitude but in opposit
e | |
| | | | |
| skipping to change at line 1738 | | skipping to change at line 1769 | |
| * @brief Applies the torque about the rotoide axis of the PU joint | | * @brief Applies the torque about the rotoide axis of the PU joint | |
| * | | * | |
| * That is, it applies a torque with specified magnitude in the direction | | * That is, it applies a torque with specified magnitude in the direction | |
| * of the rotoide axis, to body 1, and with the same magnitude but in opp
osite | | * of the rotoide axis, to body 1, and with the same magnitude but in opp
osite | |
| * direction to body 2. This function is just a wrapper for dBodyAddTorqu
e()} | | * direction to body 2. This function is just a wrapper for dBodyAddTorqu
e()} | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API void dJointAddPUTorque (dJointID j, dReal torque); | | ODE_API void dJointAddPUTorque (dJointID j, dReal torque); | |
| | | | |
| /** | | /** | |
|
| * @brief set the joint axis | | * @brief set the joint anchor | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API void dJointSetPistonAnchor (dJointID, dReal x, dReal y, dReal z); | | ODE_API void dJointSetPistonAnchor (dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| /** | | /** | |
|
| * @brief set the joint axis | | * @brief Set the Piston anchor as if the 2 bodies were already at [dx,dy | |
| | | , dz] appart. | |
| | | * @ingroup joints | |
| | | * | |
| | | * This function initialize the anchor and the relative position of each | |
| | | body | |
| | | * as if the position between body1 and body2 was already the projection | |
| | | of [dx, dy, dz] | |
| | | * along the Piston axis. (i.e as if the body1 was at its current positio | |
| | | n - [dx,dy,dy] when the | |
| | | * axis is set). | |
| | | * Ex: | |
| | | * <PRE> | |
| | | * dReal offset = 3; | |
| | | * dVector3 axis; | |
| | | * dJointGetPistonAxis(jId, axis); | |
| | | * dJointSetPistonAnchor(jId, 0, 0, 0); | |
| | | * // If you request the position you will have: dJointGetPistonPosition( | |
| | | jId) == 0 | |
| | | * dJointSetPistonAnchorOffset(jId, 0, 0, 0, axis[X]*offset, axis[Y]*offs | |
| | | et, axis[Z]*offset); | |
| | | * // If you request the position you will have: dJointGetPistonPosition( | |
| | | jId) == offset | |
| | | * </PRE> | |
| | | * @param j The Piston joint for which the anchor point will be set | |
| | | * @param x The X position of the anchor point in world frame | |
| | | * @param y The Y position of the anchor point in world frame | |
| | | * @param z The Z position of the anchor point in world frame | |
| | | * @param dx A delta to be substracted to the X position as if the anchor | |
| | | was set | |
| | | * when body1 was at current_position[X] - dx | |
| | | * @param dx A delta to be substracted to the Y position as if the anchor | |
| | | was set | |
| | | * when body1 was at current_position[Y] - dy | |
| | | * @param dx A delta to be substracted to the Z position as if the anchor | |
| | | was set | |
| | | * when body1 was at current_position[Z] - dz | |
| | | */ | |
| | | ODE_API void dJointSetPistonAnchorOffset(dJointID j, dReal x, dReal y, dR | |
| | | eal z, | |
| | | dReal dx, dReal dy, dReal dz); | |
| | | | |
| | | /** | |
| | | * @brief set the joint axis | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API void dJointSetPistonAxis (dJointID, dReal x, dReal y, dReal z); | | ODE_API void dJointSetPistonAxis (dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| /** | | /** | |
| * This function set prismatic axis of the joint and also set the positio
n | | * This function set prismatic axis of the joint and also set the positio
n | |
| * of the joint. | | * of the joint. | |
| * | | * | |
| * @ingroup joints | | * @ingroup joints | |
| * @param j The joint affected by this function | | * @param j The joint affected by this function | |
| * @param x The x component of the axis | | * @param x The x component of the axis | |
| * @param y The y component of the axis | | * @param y The y component of the axis | |
| * @param z The z component of the axis | | * @param z The z component of the axis | |
| * @param dx The Initial position of the prismatic join in the x directio
n | | * @param dx The Initial position of the prismatic join in the x directio
n | |
| * @param dy The Initial position of the prismatic join in the y directio
n | | * @param dy The Initial position of the prismatic join in the y directio
n | |
| * @param dz The Initial position of the prismatic join in the z directio
n | | * @param dz The Initial position of the prismatic join in the z directio
n | |
| */ | | */ | |
|
| ODE_API void dJointSetPistonAxisDelta (dJointID j, dReal x, dReal y, dRea
l z, dReal ax, dReal ay, dReal az); | | ODE_API_DEPRECATED ODE_API void dJointSetPistonAxisDelta (dJointID j, dRe
al x, dReal y, dReal z, dReal ax, dReal ay, dReal az); | |
| | | | |
| /** | | /** | |
| * @brief set joint parameter | | * @brief set joint parameter | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API void dJointSetPistonParam (dJointID, int parameter, dReal value); | | ODE_API void dJointSetPistonParam (dJointID, int parameter, dReal value); | |
| | | | |
| /** | | /** | |
| * @brief Applies the given force in the slider's direction. | | * @brief Applies the given force in the slider's direction. | |
| * | | * | |
| | | | |
| skipping to change at line 1947 | | skipping to change at line 2010 | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API dReal dJointGetHingeParam (dJointID, int parameter); | | ODE_API dReal dJointGetHingeParam (dJointID, int parameter); | |
| | | | |
| /** | | /** | |
| * @brief Get the hinge angle. | | * @brief Get the hinge angle. | |
| * | | * | |
| * The angle is measured between the two bodies, or between the body and | | * The angle is measured between the two bodies, or between the body and | |
| * the static environment. | | * the static environment. | |
| * The angle will be between -pi..pi. | | * The angle will be between -pi..pi. | |
|
| | | * Give the relative rotation with respect to the Hinge axis of Body 1 with | |
| | | * respect to Body 2. | |
| * When the hinge anchor or axis is set, the current position of the attach
ed | | * When the hinge anchor or axis is set, the current position of the attach
ed | |
| * bodies is examined and that position will be the zero angle. | | * bodies is examined and that position will be the zero angle. | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API dReal dJointGetHingeAngle (dJointID); | | ODE_API dReal dJointGetHingeAngle (dJointID); | |
| | | | |
| /** | | /** | |
| * @brief Get the hinge angle time derivative. | | * @brief Get the hinge angle time derivative. | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API dReal dJointGetHingeAngleRate (dJointID); | | ODE_API dReal dJointGetHingeAngleRate (dJointID); | |
| | | | |
| /** | | /** | |
| * @brief Get the slider linear position (i.e. the slider's extension) | | * @brief Get the slider linear position (i.e. the slider's extension) | |
| * | | * | |
| * When the axis is set, the current position of the attached bodies is | | * When the axis is set, the current position of the attached bodies is | |
| * examined and that position will be the zero position. | | * examined and that position will be the zero position. | |
|
| | | | |
| | | * The position is the distance, with respect to the zero position, | |
| | | * along the slider axis of body 1 with respect to | |
| | | * body 2. (A NULL body is replaced by the world). | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API dReal dJointGetSliderPosition (dJointID); | | ODE_API dReal dJointGetSliderPosition (dJointID); | |
| | | | |
| /** | | /** | |
| * @brief Get the slider linear position's time derivative. | | * @brief Get the slider linear position's time derivative. | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API dReal dJointGetSliderPositionRate (dJointID); | | ODE_API dReal dJointGetSliderPositionRate (dJointID); | |
| | | | |
| | | | |
End of changes. 7 change blocks. |
| 3 lines changed or deleted | | 92 lines changed or added | |
|
| odecpp.h | | odecpp.h | |
| | | | |
| skipping to change at line 272 | | skipping to change at line 272 | |
| void setTorque (dReal x, dReal y, dReal z) | | void setTorque (dReal x, dReal y, dReal z) | |
| { dBodySetTorque (_id,x,y,z); } | | { dBodySetTorque (_id,x,y,z); } | |
| void setTorque (const dVector3 t) | | void setTorque (const dVector3 t) | |
| { setTorque (t[0], t[1], t[2]); } | | { setTorque (t[0], t[1], t[2]); } | |
| | | | |
| void enable() | | void enable() | |
| { dBodyEnable (_id); } | | { dBodyEnable (_id); } | |
| void disable() | | void disable() | |
| { dBodyDisable (_id); } | | { dBodyDisable (_id); } | |
| bool isEnabled() const | | bool isEnabled() const | |
|
| { return bool(dBodyIsEnabled (_id)); } | | { return dBodyIsEnabled (_id) != 0; } | |
| | | | |
| void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const | | void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const | |
| { dBodyGetRelPointPos (_id, px, py, pz, result); } | | { dBodyGetRelPointPos (_id, px, py, pz, result); } | |
| void getRelPointPos (const dVector3 p, dVector3 result) const | | void getRelPointPos (const dVector3 p, dVector3 result) const | |
| { getRelPointPos (p[0], p[1], p[2], result); } | | { getRelPointPos (p[0], p[1], p[2], result); } | |
| | | | |
| void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const | | void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const | |
| { dBodyGetRelPointVel (_id, px, py, pz, result); } | | { dBodyGetRelPointVel (_id, px, py, pz, result); } | |
| void getRelPointVel (const dVector3 p, dVector3 result) const | | void getRelPointVel (const dVector3 p, dVector3 result) const | |
| { getRelPointVel (p[0], p[1], p[2], result); } | | { getRelPointVel (p[0], p[1], p[2], result); } | |
| | | | |
| skipping to change at line 313 | | skipping to change at line 313 | |
| | | | |
| void setFiniteRotationMode (bool mode) | | void setFiniteRotationMode (bool mode) | |
| { dBodySetFiniteRotationMode (_id, mode); } | | { dBodySetFiniteRotationMode (_id, mode); } | |
| | | | |
| void setFiniteRotationAxis (dReal x, dReal y, dReal z) | | void setFiniteRotationAxis (dReal x, dReal y, dReal z) | |
| { dBodySetFiniteRotationAxis (_id, x, y, z); } | | { dBodySetFiniteRotationAxis (_id, x, y, z); } | |
| void setFiniteRotationAxis (const dVector3 a) | | void setFiniteRotationAxis (const dVector3 a) | |
| { setFiniteRotationAxis (a[0], a[1], a[2]); } | | { setFiniteRotationAxis (a[0], a[1], a[2]); } | |
| | | | |
| bool getFiniteRotationMode() const | | bool getFiniteRotationMode() const | |
|
| { return bool(dBodyGetFiniteRotationMode (_id)); } | | { return dBodyGetFiniteRotationMode (_id) != 0; } | |
| void getFiniteRotationAxis (dVector3 result) const | | void getFiniteRotationAxis (dVector3 result) const | |
| { dBodyGetFiniteRotationAxis (_id, result); } | | { dBodyGetFiniteRotationAxis (_id, result); } | |
| | | | |
| int getNumJoints() const | | int getNumJoints() const | |
| { return dBodyGetNumJoints (_id); } | | { return dBodyGetNumJoints (_id); } | |
| dJointID getJoint (int index) const | | dJointID getJoint (int index) const | |
| { return dBodyGetJoint (_id, index); } | | { return dBodyGetJoint (_id, index); } | |
| | | | |
| void setGravityMode (bool mode) | | void setGravityMode (bool mode) | |
| { dBodySetGravityMode (_id,mode); } | | { dBodySetGravityMode (_id,mode); } | |
| bool getGravityMode() const | | bool getGravityMode() const | |
|
| { return bool(dBodyGetGravityMode (_id)); } | | { return dBodyGetGravityMode (_id) != 0; } | |
| | | | |
| bool isConnectedTo (dBodyID body) const | | bool isConnectedTo (dBodyID body) const | |
|
| { return bool(dAreConnected (_id, body)); } | | { return dAreConnected (_id, body) != 0; } | |
| | | | |
| void setAutoDisableLinearThreshold (dReal threshold) | | void setAutoDisableLinearThreshold (dReal threshold) | |
| { dBodySetAutoDisableLinearThreshold (_id,threshold); } | | { dBodySetAutoDisableLinearThreshold (_id,threshold); } | |
| dReal getAutoDisableLinearThreshold() const | | dReal getAutoDisableLinearThreshold() const | |
| { return dBodyGetAutoDisableLinearThreshold (_id); } | | { return dBodyGetAutoDisableLinearThreshold (_id); } | |
| void setAutoDisableAngularThreshold (dReal threshold) | | void setAutoDisableAngularThreshold (dReal threshold) | |
| { dBodySetAutoDisableAngularThreshold (_id,threshold); } | | { dBodySetAutoDisableAngularThreshold (_id,threshold); } | |
| dReal getAutoDisableAngularThreshold() const | | dReal getAutoDisableAngularThreshold() const | |
| { return dBodyGetAutoDisableAngularThreshold (_id); } | | { return dBodyGetAutoDisableAngularThreshold (_id); } | |
| void setAutoDisableSteps (int steps) | | void setAutoDisableSteps (int steps) | |
| { dBodySetAutoDisableSteps (_id,steps); } | | { dBodySetAutoDisableSteps (_id,steps); } | |
| int getAutoDisableSteps() const | | int getAutoDisableSteps() const | |
| { return dBodyGetAutoDisableSteps (_id); } | | { return dBodyGetAutoDisableSteps (_id); } | |
| void setAutoDisableTime (dReal time) | | void setAutoDisableTime (dReal time) | |
| { dBodySetAutoDisableTime (_id,time); } | | { dBodySetAutoDisableTime (_id,time); } | |
| dReal getAutoDisableTime() const | | dReal getAutoDisableTime() const | |
| { return dBodyGetAutoDisableTime (_id); } | | { return dBodyGetAutoDisableTime (_id); } | |
| void setAutoDisableFlag (bool do_auto_disable) | | void setAutoDisableFlag (bool do_auto_disable) | |
| { dBodySetAutoDisableFlag (_id,do_auto_disable); } | | { dBodySetAutoDisableFlag (_id,do_auto_disable); } | |
| bool getAutoDisableFlag() const | | bool getAutoDisableFlag() const | |
|
| { return bool(dBodyGetAutoDisableFlag (_id)); } | | { return dBodyGetAutoDisableFlag (_id) != 0; } | |
| | | | |
| dReal getLinearDamping() const | | dReal getLinearDamping() const | |
| { return dBodyGetLinearDamping(_id); } | | { return dBodyGetLinearDamping(_id); } | |
| void setLinearDamping(dReal scale) | | void setLinearDamping(dReal scale) | |
| { dBodySetLinearDamping(_id, scale); } | | { dBodySetLinearDamping(_id, scale); } | |
| dReal getAngularDamping() const | | dReal getAngularDamping() const | |
| { return dBodyGetAngularDamping(_id); } | | { return dBodyGetAngularDamping(_id); } | |
| void setAngularDamping(dReal scale) | | void setAngularDamping(dReal scale) | |
| { dBodySetAngularDamping(_id, scale); } | | { dBodySetAngularDamping(_id, scale); } | |
| void setDamping(dReal linear_scale, dReal angular_scale) | | void setDamping(dReal linear_scale, dReal angular_scale) | |
| | | | |
| skipping to change at line 416 | | skipping to change at line 416 | |
| | | | |
| class dJoint { | | class dJoint { | |
| private: | | private: | |
| // intentionally undefined, don't use these | | // intentionally undefined, don't use these | |
| dJoint (const dJoint &) ; | | dJoint (const dJoint &) ; | |
| void operator= (const dJoint &); | | void operator= (const dJoint &); | |
| | | | |
| protected: | | protected: | |
| dJointID _id; | | dJointID _id; | |
| | | | |
|
| public: | | dJoint() // don't let user construct pure dJoint objects | |
| dJoint() | | | |
| { _id = 0; } | | { _id = 0; } | |
|
| | | | |
| | | public: | |
| virtual ~dJoint() // :( Destructor must be virtual to suppress compiler w
arning "class XXX has virtual functions but non-virtual destructor" | | virtual ~dJoint() // :( Destructor must be virtual to suppress compiler w
arning "class XXX has virtual functions but non-virtual destructor" | |
| { if (_id) dJointDestroy (_id); } | | { if (_id) dJointDestroy (_id); } | |
| | | | |
| dJointID id() const | | dJointID id() const | |
| { return _id; } | | { return _id; } | |
| operator dJointID() const | | operator dJointID() const | |
| { return _id; } | | { return _id; } | |
| | | | |
| int getNumBodies() const | | int getNumBodies() const | |
| { return dJointGetNumBodies(_id); } | | { return dJointGetNumBodies(_id); } | |
| | | | |
End of changes. 7 change blocks. |
| 7 lines changed or deleted | | 8 lines changed or added | |
|