| collision.h | | collision.h | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | | * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | |
| * * | | * * | |
| *************************************************************************/ | | *************************************************************************/ | |
| | | | |
| #ifndef _ODE_COLLISION_H_ | | #ifndef _ODE_COLLISION_H_ | |
| #define _ODE_COLLISION_H_ | | #define _ODE_COLLISION_H_ | |
| | | | |
| #include <ode/common.h> | | #include <ode/common.h> | |
| #include <ode/collision_space.h> | | #include <ode/collision_space.h> | |
| #include <ode/contact.h> | | #include <ode/contact.h> | |
|
| // Include odeinit.h for backward compatibility as some of initialization A | | | |
| PIs | | | |
| // were initally declared in current header. | | | |
| #include <ode/odeinit.h> | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * @defgroup collide Collision Detection | | * @defgroup collide Collision Detection | |
| * | | * | |
| * ODE has two main components: a dynamics simulation engine and a collisio
n | | * ODE has two main components: a dynamics simulation engine and a collisio
n | |
| * detection engine. The collision engine is given information about the | | * detection engine. The collision engine is given information about the | |
| | | | |
| skipping to change at line 402 | | skipping to change at line 399 | |
| enum | | enum | |
| { | | { | |
| dGeomCommonAnyControlCode = 0, | | dGeomCommonAnyControlCode = 0, | |
| | | | |
| dGeomColliderSetMergeSphereContactsControlCode = 1, | | dGeomColliderSetMergeSphereContactsControlCode = 1, | |
| dGeomColliderGetMergeSphereContactsControlCode = 2 | | dGeomColliderGetMergeSphereContactsControlCode = 2 | |
| }; | | }; | |
| | | | |
| enum | | enum | |
| { | | { | |
|
| dGeomColliderMergeContactsValue__Default = 0, // Used with Set... to
restore default value | | dGeomColliderMergeContactsValue__Default = 0, /* Used with Set... to re
store default value*/ | |
| dGeomColliderMergeContactsValue_None = 1, | | dGeomColliderMergeContactsValue_None = 1, | |
| dGeomColliderMergeContactsValue_Normals = 2, | | dGeomColliderMergeContactsValue_Normals = 2, | |
| dGeomColliderMergeContactsValue_Full = 3 | | dGeomColliderMergeContactsValue_Full = 3 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @brief Execute low level control operation for geometry. | | * @brief Execute low level control operation for geometry. | |
| * | | * | |
| * The variable the dataSize points to must be initialized before the call. | | * The variable the dataSize points to must be initialized before the call. | |
| * If the size does not match the one expected for the control class/code f
unction | | * If the size does not match the one expected for the control class/code f
unction | |
| | | | |
| skipping to change at line 853 | | skipping to change at line 850 | |
| dPlaneClass, | | dPlaneClass, | |
| dRayClass, | | dRayClass, | |
| dConvexClass, | | dConvexClass, | |
| dGeomTransformClass, | | dGeomTransformClass, | |
| dTriMeshClass, | | dTriMeshClass, | |
| dHeightfieldClass, | | dHeightfieldClass, | |
| | | | |
| dFirstSpaceClass, | | dFirstSpaceClass, | |
| dSimpleSpaceClass = dFirstSpaceClass, | | dSimpleSpaceClass = dFirstSpaceClass, | |
| dHashSpaceClass, | | dHashSpaceClass, | |
|
| dSweepAndPruneSpaceClass, // SAP | | dSweepAndPruneSpaceClass, /* SAP */ | |
| dQuadTreeSpaceClass, | | dQuadTreeSpaceClass, | |
| dLastSpaceClass = dQuadTreeSpaceClass, | | dLastSpaceClass = dQuadTreeSpaceClass, | |
| | | | |
| dFirstUserClass, | | dFirstUserClass, | |
| dLastUserClass = dFirstUserClass + dMaxUserClasses - 1, | | dLastUserClass = dFirstUserClass + dMaxUserClasses - 1, | |
| dGeomNumClasses | | dGeomNumClasses | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @defgroup collide_sphere Sphere Class | | * @defgroup collide_sphere Sphere Class | |
| | | | |
| skipping to change at line 920 | | skipping to change at line 917 | |
| * @param z the Z coordinate of the point. | | * @param z the Z coordinate of the point. | |
| * | | * | |
| * @returns The depth of the point. Points inside the sphere will have a | | * @returns The depth of the point. Points inside the sphere will have a | |
| * positive depth, points outside it will have a negative depth, and points | | * positive depth, points outside it will have a negative depth, and points | |
| * on the surface will have a depth of zero. | | * on the surface will have a depth of zero. | |
| * | | * | |
| * @ingroup collide_sphere | | * @ingroup collide_sphere | |
| */ | | */ | |
| ODE_API dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dRea
l z); | | ODE_API dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dRea
l z); | |
| | | | |
|
| //--> Convex Functions | | /*--> Convex Functions*/ | |
| ODE_API dGeomID dCreateConvex (dSpaceID space, | | ODE_API dGeomID dCreateConvex (dSpaceID space, | |
| dReal *_planes, | | dReal *_planes, | |
| unsigned int _planecount, | | unsigned int _planecount, | |
| dReal *_points, | | dReal *_points, | |
| unsigned int _pointcount,unsigned int *_polyg
ons); | | unsigned int _pointcount,unsigned int *_polyg
ons); | |
| | | | |
| ODE_API void dGeomSetConvex (dGeomID g, | | ODE_API void dGeomSetConvex (dGeomID g, | |
| dReal *_planes, | | dReal *_planes, | |
| unsigned int _count, | | unsigned int _count, | |
| dReal *_points, | | dReal *_points, | |
| unsigned int _pointcount,unsigned int *_polygon
s); | | unsigned int _pointcount,unsigned int *_polygon
s); | |
|
| //<-- Convex Functions | | /*<-- Convex Functions*/ | |
| | | | |
| /** | | /** | |
| * @defgroup collide_box Box Class | | * @defgroup collide_box Box Class | |
| * @ingroup collide | | * @ingroup collide | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @brief Create a box geom with the provided side lengths. | | * @brief Create a box geom with the provided side lengths. | |
| * | | * | |
| * @param space a space to contain the new geom. May be null. | | * @param space a space to contain the new geom. May be null. | |
| | | | |
| skipping to change at line 1005 | | skipping to change at line 1002 | |
| ODE_API dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dR
eal d); | | ODE_API dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dR
eal d); | |
| ODE_API void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c,
dReal d); | | ODE_API void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c,
dReal d); | |
| ODE_API void dGeomPlaneGetParams (dGeomID plane, dVector4 result); | | ODE_API void dGeomPlaneGetParams (dGeomID plane, dVector4 result); | |
| ODE_API dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal
z); | | ODE_API dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal
z); | |
| | | | |
| ODE_API dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length)
; | | ODE_API dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length)
; | |
| ODE_API void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal
length); | | ODE_API void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal
length); | |
| ODE_API void dGeomCapsuleGetParams (dGeomID ccylinder, dReal *radius, dReal
*length); | | ODE_API void dGeomCapsuleGetParams (dGeomID ccylinder, dReal *radius, dReal
*length); | |
| ODE_API dReal dGeomCapsulePointDepth (dGeomID ccylinder, dReal x, dReal y,
dReal z); | | ODE_API dReal dGeomCapsulePointDepth (dGeomID ccylinder, dReal x, dReal y,
dReal z); | |
| | | | |
|
| // For now we want to have a backwards compatible C-API, note: C++ API is n
ot. | | /* For now we want to have a backwards compatible C-API, note: C++ API is n
ot.*/ | |
| #define dCreateCCylinder dCreateCapsule | | #define dCreateCCylinder dCreateCapsule | |
| #define dGeomCCylinderSetParams dGeomCapsuleSetParams | | #define dGeomCCylinderSetParams dGeomCapsuleSetParams | |
| #define dGeomCCylinderGetParams dGeomCapsuleGetParams | | #define dGeomCCylinderGetParams dGeomCapsuleGetParams | |
| #define dGeomCCylinderPointDepth dGeomCapsulePointDepth | | #define dGeomCCylinderPointDepth dGeomCapsulePointDepth | |
| #define dCCylinderClass dCapsuleClass | | #define dCCylinderClass dCapsuleClass | |
| | | | |
| ODE_API dGeomID dCreateCylinder (dSpaceID space, dReal radius, dReal length
); | | ODE_API dGeomID dCreateCylinder (dSpaceID space, dReal radius, dReal length
); | |
| ODE_API void dGeomCylinderSetParams (dGeomID cylinder, dReal radius, dReal
length); | | ODE_API void dGeomCylinderSetParams (dGeomID cylinder, dReal radius, dReal
length); | |
| ODE_API void dGeomCylinderGetParams (dGeomID cylinder, dReal *radius, dReal
*length); | | ODE_API void dGeomCylinderGetParams (dGeomID cylinder, dReal *radius, dReal
*length); | |
| | | | |
| | | | |
| skipping to change at line 1046 | | skipping to change at line 1043 | |
| ODE_API void dGeomTransformSetGeom (dGeomID g, dGeomID obj); | | ODE_API void dGeomTransformSetGeom (dGeomID g, dGeomID obj); | |
| ODE_API dGeomID dGeomTransformGetGeom (dGeomID g); | | ODE_API dGeomID dGeomTransformGetGeom (dGeomID g); | |
| ODE_API void dGeomTransformSetCleanup (dGeomID g, int mode); | | ODE_API void dGeomTransformSetCleanup (dGeomID g, int mode); | |
| ODE_API int dGeomTransformGetCleanup (dGeomID g); | | ODE_API int dGeomTransformGetCleanup (dGeomID g); | |
| ODE_API void dGeomTransformSetInfo (dGeomID g, int mode); | | ODE_API void dGeomTransformSetInfo (dGeomID g, int mode); | |
| ODE_API int dGeomTransformGetInfo (dGeomID g); | | ODE_API int dGeomTransformGetInfo (dGeomID g); | |
| | | | |
| /* ************************************************************************
*/ | | /* ************************************************************************
*/ | |
| /* heightfield functions */ | | /* heightfield functions */ | |
| | | | |
|
| // Data storage for heightfield data. | | /* Data storage for heightfield data.*/ | |
| struct dxHeightfieldData; | | struct dxHeightfieldData; | |
| typedef struct dxHeightfieldData* dHeightfieldDataID; | | typedef struct dxHeightfieldData* dHeightfieldDataID; | |
| | | | |
| /** | | /** | |
| * @brief Callback prototype | | * @brief Callback prototype | |
| * | | * | |
| * Used by the callback heightfield data type to sample a height for a | | * Used by the callback heightfield data type to sample a height for a | |
| * given cell position. | | * given cell position. | |
| * | | * | |
| * @param p_user_data User data specified when creating the dHeightfieldDat
aID | | * @param p_user_data User data specified when creating the dHeightfieldDat
aID | |
| | | | |
| skipping to change at line 1410 | | skipping to change at line 1407 | |
| /* utility functions */ | | /* utility functions */ | |
| | | | |
| ODE_API void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a
2, | | ODE_API void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a
2, | |
| const dVector3 b1, const dVector3 b2, | | const dVector3 b1, const dVector3 b2, | |
| dVector3 cp1, dVector3 cp2); | | dVector3 cp1, dVector3 cp2); | |
| | | | |
| ODE_API int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1, | | ODE_API int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1, | |
| const dVector3 side1, const dVector3 _p2, | | const dVector3 side1, const dVector3 _p2, | |
| const dMatrix3 R2, const dVector3 side2); | | const dMatrix3 R2, const dVector3 side2); | |
| | | | |
|
| // The meaning of flags parameter is the same as in dCollide() | | /* The meaning of flags parameter is the same as in dCollide()*/ | |
| ODE_API int dBoxBox (const dVector3 p1, const dMatrix3 R1, | | ODE_API int dBoxBox (const dVector3 p1, const dMatrix3 R1, | |
| const dVector3 side1, const dVector3 p2, | | const dVector3 side1, const dVector3 p2, | |
| const dMatrix3 R2, const dVector3 side2, | | const dMatrix3 R2, const dVector3 side2, | |
| dVector3 normal, dReal *depth, int *return_code, | | dVector3 normal, dReal *depth, int *return_code, | |
| int flags, dContactGeom *contact, int skip); | | int flags, dContactGeom *contact, int skip); | |
| | | | |
| ODE_API void dInfiniteAABB (dGeomID geom, dReal aabb[6]); | | ODE_API void dInfiniteAABB (dGeomID geom, dReal aabb[6]); | |
| | | | |
| /* ************************************************************************
*/ | | /* ************************************************************************
*/ | |
| /* custom classes */ | | /* custom classes */ | |
| | | | |
End of changes. 8 change blocks. |
| 11 lines changed or deleted | | 7 lines changed or added | |
|
| common.h | | common.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| * * | | * * | |
| * This library is distributed in the hope that it will be useful, * | | * This library is distributed in the hope that it will be useful, * | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of * | | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * | |
| * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | | * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | |
| * * | | * * | |
| *************************************************************************/ | | *************************************************************************/ | |
| | | | |
| #ifndef _ODE_COMMON_H_ | | #ifndef _ODE_COMMON_H_ | |
| #define _ODE_COMMON_H_ | | #define _ODE_COMMON_H_ | |
|
| | | | |
| #include <ode/odeconfig.h> | | #include <ode/odeconfig.h> | |
| #include <ode/error.h> | | #include <ode/error.h> | |
|
| #include <math.h> | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
|
| #define PURE_INLINE static __inline | | | |
| | | | |
| /* configuration stuff */ | | /* configuration stuff */ | |
| | | | |
| /* constants */ | | /* constants */ | |
| | | | |
| /* pi and 1/sqrt(2) are defined here if necessary because they don't get | | /* pi and 1/sqrt(2) are defined here if necessary because they don't get | |
| * defined in <math.h> on some platforms (like MS-Windows) | | * defined in <math.h> on some platforms (like MS-Windows) | |
| */ | | */ | |
| | | | |
| #ifndef M_PI | | #ifndef M_PI | |
| #define M_PI REAL(3.1415926535897932384626433832795029) | | #define M_PI REAL(3.1415926535897932384626433832795029) | |
| #endif | | #endif | |
|
| | | #ifndef M_PI_2 | |
| | | #define M_PI_2 REAL(1.5707963267948966192313216916398) | |
| | | #endif | |
| #ifndef M_SQRT1_2 | | #ifndef M_SQRT1_2 | |
| #define M_SQRT1_2 REAL(0.7071067811865475244008443621048490) | | #define M_SQRT1_2 REAL(0.7071067811865475244008443621048490) | |
| #endif | | #endif | |
| | | | |
|
| /* debugging: | | | |
| * IASSERT is an internal assertion, i.e. a consistency check. if it fai | | | |
| ls | | | |
| * we want to know where. | | | |
| * UASSERT is a user assertion, i.e. if it fails a nice error message | | | |
| * should be printed for the user. | | | |
| * AASSERT is an arguments assertion, i.e. if it fails "bad argument(s)" | | | |
| * is printed. | | | |
| * DEBUGMSG just prints out a message | | | |
| */ | | | |
| | | | |
| # if defined(__STDC__) && __STDC_VERSION__ >= 199901L | | | |
| # define __FUNCTION__ __func__ | | | |
| # endif | | | |
| #ifndef dNODEBUG | | | |
| # ifdef __GNUC__ | | | |
| # define dIASSERT(a) { if (!(a)) { dDebug (d_ERR_IASSERT, \ | | | |
| "assertion \"" #a "\" failed in %s() [%s:%u]",__FUNCTION__,__FILE__,_ | | | |
| _LINE__); } } | | | |
| # define dUASSERT(a,msg) { if (!(a)) { dDebug (d_ERR_UASSERT, \ | | | |
| msg " in %s()", __FUNCTION__); } } | | | |
| # define dDEBUGMSG(msg) { dMessage (d_ERR_UASSERT, | | | |
| \ | | | |
| msg " in %s() [%s:%u]", __FUNCTION__,__FILE__,__LINE__); } | | | |
| # else // not __GNUC__ | | | |
| # define dIASSERT(a) { if (!(a)) { dDebug (d_ERR_IASSERT, \ | | | |
| "assertion \"" #a "\" failed in %s:%u",__FILE__,__LINE__); } } | | | |
| # define dUASSERT(a,msg) { if (!(a)) { dDebug (d_ERR_UASSERT, \ | | | |
| msg " (%s:%u)", __FILE__,__LINE__); } } | | | |
| # define dDEBUGMSG(msg) { dMessage (d_ERR_UASSERT, \ | | | |
| msg " (%s:%u)", __FILE__,__LINE__); } | | | |
| # endif | | | |
| # define dIVERIFY(a) dIASSERT(a) | | | |
| #else | | | |
| # define dIASSERT(a) ((void)0) | | | |
| # define dUASSERT(a,msg) ((void)0) | | | |
| # define dDEBUGMSG(msg) ((void)0) | | | |
| # define dIVERIFY(a) ((void)(a)) | | | |
| #endif | | | |
| | | | |
| # ifdef __GNUC__ | | | |
| # define dICHECK(a) { if (!(a)) { dDebug (d_ERR_IASSERT, \ | | | |
| "assertion \"" #a "\" failed in %s() [%s:%u]",__FUNCTION__,__FILE__,_ | | | |
| _LINE__); *(int *)0 = 0; } } | | | |
| # else // not __GNUC__ | | | |
| # define dICHECK(a) { if (!(a)) { dDebug (d_ERR_IASSERT, \ | | | |
| "assertion \"" #a "\" failed in %s:%u",__FILE__,__LINE__); *(int *)0 | | | |
| = 0; } } | | | |
| # endif | | | |
| | | | |
| // Argument assert is a special case of user assert | | | |
| #define dAASSERT(a) dUASSERT(a,"Bad argument(s)") | | | |
| | | | |
| /* floating point data type, vector, matrix and quaternion types */ | | /* floating point data type, vector, matrix and quaternion types */ | |
| | | | |
| #if defined(dSINGLE) | | #if defined(dSINGLE) | |
| typedef float dReal; | | typedef float dReal; | |
| #ifdef dDOUBLE | | #ifdef dDOUBLE | |
| #error You can only #define dSINGLE or dDOUBLE, not both. | | #error You can only #define dSINGLE or dDOUBLE, not both. | |
|
| #endif // dDOUBLE | | #endif /* dDOUBLE */ | |
| #elif defined(dDOUBLE) | | #elif defined(dDOUBLE) | |
| typedef double dReal; | | typedef double dReal; | |
| #else | | #else | |
| #error You must #define dSINGLE or dDOUBLE | | #error You must #define dSINGLE or dDOUBLE | |
| #endif | | #endif | |
| | | | |
|
| // Detect if we've got both trimesh engines enabled. | | /* Detect if we've got both trimesh engines enabled. */ | |
| #if dTRIMESH_ENABLED | | #if dTRIMESH_ENABLED | |
| #if dTRIMESH_OPCODE && dTRIMESH_GIMPACT | | #if dTRIMESH_OPCODE && dTRIMESH_GIMPACT | |
| #error You can only #define dTRIMESH_OPCODE or dTRIMESH_GIMPACT, not both. | | #error You can only #define dTRIMESH_OPCODE or dTRIMESH_GIMPACT, not both. | |
| #endif | | #endif | |
|
| #endif // dTRIMESH_ENABLED | | #endif /* dTRIMESH_ENABLED */ | |
| | | | |
|
| // Define a type for indices, either 16 or 32 bit, based on build option | | /* | |
| // TODO: Currently GIMPACT only supports 32 bit indices. | | * Define a type for indices, either 16 or 32 bit, based on build option | |
| | | * TODO: Currently GIMPACT only supports 32 bit indices. | |
| | | */ | |
| #if dTRIMESH_16BIT_INDICES | | #if dTRIMESH_16BIT_INDICES | |
| #if dTRIMESH_GIMPACT | | #if dTRIMESH_GIMPACT | |
|
| typedef uint32 dTriIndex; | | typedef duint32 dTriIndex; | |
| #else // dTRIMESH_GIMPACT | | #else /* dTRIMESH_GIMPACT */ | |
| typedef uint16 dTriIndex; | | typedef duint16 dTriIndex; | |
| #endif // dTRIMESH_GIMPACT | | #endif /* dTRIMESH_GIMPACT */ | |
| #else // dTRIMESH_16BIT_INDICES | | #else /* dTRIMESH_16BIT_INDICES */ | |
| typedef uint32 dTriIndex; | | typedef duint32 dTriIndex; | |
| #endif // dTRIMESH_16BIT_INDICES | | #endif /* dTRIMESH_16BIT_INDICES */ | |
| | | | |
| /* round an integer up to a multiple of 4, except that 0 and 1 are unmodifi
ed | | /* round an integer up to a multiple of 4, except that 0 and 1 are unmodifi
ed | |
| * (used to compute matrix leading dimensions) | | * (used to compute matrix leading dimensions) | |
| */ | | */ | |
| #define dPAD(a) (((a) > 1) ? ((((a)-1)|3)+1) : (a)) | | #define dPAD(a) (((a) > 1) ? ((((a)-1)|3)+1) : (a)) | |
| | | | |
| /* these types are mainly just used in headers */ | | /* these types are mainly just used in headers */ | |
| typedef dReal dVector3[4]; | | typedef dReal dVector3[4]; | |
| typedef dReal dVector4[4]; | | typedef dReal dVector4[4]; | |
| typedef dReal dMatrix3[4*3]; | | typedef dReal dMatrix3[4*3]; | |
| typedef dReal dMatrix4[4*4]; | | typedef dReal dMatrix4[4*4]; | |
| typedef dReal dMatrix6[8*6]; | | typedef dReal dMatrix6[8*6]; | |
| typedef dReal dQuaternion[4]; | | typedef dReal dQuaternion[4]; | |
| | | | |
| /* precision dependent scalar math functions */ | | /* precision dependent scalar math functions */ | |
| | | | |
| #if defined(dSINGLE) | | #if defined(dSINGLE) | |
| | | | |
|
| #define REAL(x) (x ## f) /* form a co
nstant */ | | #define REAL(x) (x##f) /* form a constant *
/ | |
| #define dRecip(x) ((1.0f/(x))) /* reciprocal */ | | #define dRecip(x) ((1.0f/(x))) /* reciprocal */ | |
| #define dSqrt(x) (sqrtf(x)) /* square root */ | | #define dSqrt(x) (sqrtf(x)) /* square root */ | |
| #define dRecipSqrt(x) ((1.0f/sqrtf(x))) /* reciprocal square
root */ | | #define dRecipSqrt(x) ((1.0f/sqrtf(x))) /* reciprocal square
root */ | |
| #define dSin(x) (sinf(x)) /* sine */ | | #define dSin(x) (sinf(x)) /* sine */ | |
| #define dCos(x) (cosf(x)) /* cosine */ | | #define dCos(x) (cosf(x)) /* cosine */ | |
| #define dFabs(x) (fabsf(x)) /* absolute value */ | | #define dFabs(x) (fabsf(x)) /* absolute value */ | |
| #define dAtan2(y,x) (atan2f(y,x)) /* arc tangent with 2 args *
/ | | #define dAtan2(y,x) (atan2f(y,x)) /* arc tangent with 2 args *
/ | |
|
| | | #define dAcos(x) (acosf(x)) | |
| #define dFMod(a,b) (fmodf(a,b)) /* modulo */ | | #define dFMod(a,b) (fmodf(a,b)) /* modulo */ | |
| #define dFloor(x) floorf(x) /* floor */ | | #define dFloor(x) floorf(x) /* floor */ | |
|
| #define dCeil(x) ceilf(x) /* floor */ | | #define dCeil(x) ceilf(x) /* ceil */ | |
| #define dCopySign(a,b) ((dReal)copysignf(a,b)) /* copy value sign */ | | #define dCopySign(a,b) _ode_copysignf(a, b) /* copy value sign */ | |
| #define dNextAfter(x, y) nextafterf(x, y) /* next value after */ | | #define dNextAfter(x, y) _ode_nextafterf(x, y) /* next value after */ | |
| | | | |
| #if defined(_ODE__NEXTAFTERF_REQUIRED) | | | |
| float _nextafterf(float x, float y); | | | |
| #endif | | | |
| | | | |
| #ifdef HAVE___ISNANF | | #ifdef HAVE___ISNANF | |
| #define dIsNan(x) (__isnanf(x)) | | #define dIsNan(x) (__isnanf(x)) | |
| #elif defined(HAVE__ISNANF) | | #elif defined(HAVE__ISNANF) | |
| #define dIsNan(x) (_isnanf(x)) | | #define dIsNan(x) (_isnanf(x)) | |
| #elif defined(HAVE_ISNANF) | | #elif defined(HAVE_ISNANF) | |
| #define dIsNan(x) (isnanf(x)) | | #define dIsNan(x) (isnanf(x)) | |
| #else | | #else | |
| /* | | /* | |
| fall back to _isnan which is the VC way, | | fall back to _isnan which is the VC way, | |
| | | | |
| skipping to change at line 194 | | skipping to change at line 146 | |
| #elif defined(dDOUBLE) | | #elif defined(dDOUBLE) | |
| | | | |
| #define REAL(x) (x) | | #define REAL(x) (x) | |
| #define dRecip(x) (1.0/(x)) | | #define dRecip(x) (1.0/(x)) | |
| #define dSqrt(x) sqrt(x) | | #define dSqrt(x) sqrt(x) | |
| #define dRecipSqrt(x) (1.0/sqrt(x)) | | #define dRecipSqrt(x) (1.0/sqrt(x)) | |
| #define dSin(x) sin(x) | | #define dSin(x) sin(x) | |
| #define dCos(x) cos(x) | | #define dCos(x) cos(x) | |
| #define dFabs(x) fabs(x) | | #define dFabs(x) fabs(x) | |
| #define dAtan2(y,x) atan2((y),(x)) | | #define dAtan2(y,x) atan2((y),(x)) | |
|
| | | #define dAcos(x) acos(x) | |
| #define dFMod(a,b) (fmod((a),(b))) | | #define dFMod(a,b) (fmod((a),(b))) | |
| #define dFloor(x) floor(x) | | #define dFloor(x) floor(x) | |
| #define dCeil(x) ceil(x) | | #define dCeil(x) ceil(x) | |
|
| #define dCopySign(a,b) (copysign((a),(b))) | | #define dCopySign(a,b) _ode_copysign(a, b) | |
| #define dNextAfter(x, y) nextafter(x, y) | | #define dNextAfter(x, y) _ode_nextafter(x, y) | |
| | | | |
| #undef _ODE__NEXTAFTERF_REQUIRED | | | |
| | | | |
| #ifdef HAVE___ISNAN | | #ifdef HAVE___ISNAN | |
| #define dIsNan(x) (__isnan(x)) | | #define dIsNan(x) (__isnan(x)) | |
| #elif defined(HAVE__ISNAN) | | #elif defined(HAVE__ISNAN) | |
| #define dIsNan(x) (_isnan(x)) | | #define dIsNan(x) (_isnan(x)) | |
| #elif defined(HAVE_ISNAN) | | #elif defined(HAVE_ISNAN) | |
| #define dIsNan(x) (isnan(x)) | | #define dIsNan(x) (isnan(x)) | |
| #else | | #else | |
| #define dIsNan(x) (_isnan(x)) | | #define dIsNan(x) (_isnan(x)) | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 261 | | skipping to change at line 212 | |
| dJointTypeContact, | | dJointTypeContact, | |
| dJointTypeUniversal, | | dJointTypeUniversal, | |
| dJointTypeHinge2, | | dJointTypeHinge2, | |
| dJointTypeFixed, | | dJointTypeFixed, | |
| dJointTypeNull, | | dJointTypeNull, | |
| dJointTypeAMotor, | | dJointTypeAMotor, | |
| dJointTypeLMotor, | | dJointTypeLMotor, | |
| dJointTypePlane2D, | | dJointTypePlane2D, | |
| dJointTypePR, | | dJointTypePR, | |
| dJointTypePU, | | dJointTypePU, | |
|
| dJointTypePiston | | dJointTypePiston, | |
| | | dJointTypeDBall, | |
| | | dJointTypeDHinge, | |
| | | dJointTypeTransmission, | |
| } dJointType; | | } dJointType; | |
| | | | |
| /* an alternative way of setting joint parameters, using joint parameter | | /* an alternative way of setting joint parameters, using joint parameter | |
| * structures and member constants. we don't actually do this yet. | | * structures and member constants. we don't actually do this yet. | |
| */ | | */ | |
| | | | |
| /* | | /* | |
| typedef struct dLimot { | | typedef struct dLimot { | |
| int mode; | | int mode; | |
| dReal lostop, histop; | | dReal lostop, histop; | |
| | | | |
| skipping to change at line 301 | | skipping to change at line 255 | |
| * MSVC complains if we call D_ALL_PARAM_NAMES_X with a blank second argume
nt, | | * MSVC complains if we call D_ALL_PARAM_NAMES_X with a blank second argume
nt, | |
| * which is why we have the D_ALL_PARAM_NAMES macro as well. please copy an
d | | * which is why we have the D_ALL_PARAM_NAMES macro as well. please copy an
d | |
| * paste between these two. | | * paste between these two. | |
| */ | | */ | |
| | | | |
| #define D_ALL_PARAM_NAMES(start) \ | | #define D_ALL_PARAM_NAMES(start) \ | |
| /* parameters for limits and motors */ \ | | /* parameters for limits and motors */ \ | |
| dParamLoStop = start, \ | | dParamLoStop = start, \ | |
| dParamHiStop, \ | | dParamHiStop, \ | |
| dParamVel, \ | | dParamVel, \ | |
|
| | | dParamLoVel, \ | |
| | | dParamHiVel, \ | |
| dParamFMax, \ | | dParamFMax, \ | |
| dParamFudgeFactor, \ | | dParamFudgeFactor, \ | |
| dParamBounce, \ | | dParamBounce, \ | |
| dParamCFM, \ | | dParamCFM, \ | |
| dParamStopERP, \ | | dParamStopERP, \ | |
| dParamStopCFM, \ | | dParamStopCFM, \ | |
| /* parameters for suspension */ \ | | /* parameters for suspension */ \ | |
| dParamSuspensionERP, \ | | dParamSuspensionERP, \ | |
| dParamSuspensionCFM, \ | | dParamSuspensionCFM, \ | |
| dParamERP, \ | | dParamERP, \ | |
| | | | |
|
| ///////////////////////////////////////////////////////////////////////// | | /* | |
| ///// | | * \enum D_ALL_PARAM_NAMES_X | |
| /// \enum D_ALL_PARAM_NAMES_X | | * | |
| /// | | * \var dParamGroup This is the starting value of the different group | |
| /// \var dParamGroup This is the starting value of the different group | | * (i.e. dParamGroup1, dParamGroup2, dParamGroup3) | |
| /// (i.e. dParamGroup1, dParamGroup2, dParamGroup3) | | * It also helps in the use of parameter | |
| /// It also helps in the use of parameter | | * (dParamGroup2 | dParamFMax) == dParamFMax2 | |
| /// (dParamGroup2 | dParamFMax) == dParamFMax2 | | */ | |
| ///////////////////////////////////////////////////////////////////////// | | | |
| ///// | | | |
| #define D_ALL_PARAM_NAMES_X(start,x) \ | | #define D_ALL_PARAM_NAMES_X(start,x) \ | |
| dParamGroup ## x = start, \ | | dParamGroup ## x = start, \ | |
| /* parameters for limits and motors */ \ | | /* parameters for limits and motors */ \ | |
| dParamLoStop ## x = start, \ | | dParamLoStop ## x = start, \ | |
| dParamHiStop ## x, \ | | dParamHiStop ## x, \ | |
| dParamVel ## x, \ | | dParamVel ## x, \ | |
|
| | | dParamLoVel ## x, \ | |
| | | dParamHiVel ## x, \ | |
| dParamFMax ## x, \ | | dParamFMax ## x, \ | |
| dParamFudgeFactor ## x, \ | | dParamFudgeFactor ## x, \ | |
| dParamBounce ## x, \ | | dParamBounce ## x, \ | |
| dParamCFM ## x, \ | | dParamCFM ## x, \ | |
| dParamStopERP ## x, \ | | dParamStopERP ## x, \ | |
| dParamStopCFM ## x, \ | | dParamStopCFM ## x, \ | |
| /* parameters for suspension */ \ | | /* parameters for suspension */ \ | |
| dParamSuspensionERP ## x, \ | | dParamSuspensionERP ## x, \ | |
| dParamSuspensionCFM ## x, \ | | dParamSuspensionCFM ## x, \ | |
| dParamERP ## x, | | dParamERP ## x, | |
| | | | |
| enum { | | enum { | |
| D_ALL_PARAM_NAMES(0) | | D_ALL_PARAM_NAMES(0) | |
|
| dParamsInGroup, ///< Number of parameter in a group | | dParamsInGroup, /* < Number of parameter in a group */ | |
| D_ALL_PARAM_NAMES_X(0x000,1) | | D_ALL_PARAM_NAMES_X(0x000,1) | |
| D_ALL_PARAM_NAMES_X(0x100,2) | | D_ALL_PARAM_NAMES_X(0x100,2) | |
| D_ALL_PARAM_NAMES_X(0x200,3) | | D_ALL_PARAM_NAMES_X(0x200,3) | |
| | | | |
| /* add a multiple of this constant to the basic parameter numbers to get | | /* add a multiple of this constant to the basic parameter numbers to get | |
| * the parameters for the second, third etc axes. | | * the parameters for the second, third etc axes. | |
| */ | | */ | |
| dParamGroup=0x100 | | dParamGroup=0x100 | |
| }; | | }; | |
| | | | |
| /* angular motor mode numbers */ | | /* angular motor mode numbers */ | |
| | | | |
| enum { | | enum { | |
| dAMotorUser = 0, | | dAMotorUser = 0, | |
| dAMotorEuler = 1 | | dAMotorEuler = 1 | |
| }; | | }; | |
| | | | |
|
| | | /* transmission joint mode numbers */ | |
| | | | |
| | | enum { | |
| | | dTransmissionParallelAxes = 0, | |
| | | dTransmissionIntersectingAxes = 1, | |
| | | dTransmissionChainDrive = 2 | |
| | | }; | |
| | | | |
| /* joint force feedback information */ | | /* joint force feedback information */ | |
| | | | |
| typedef struct dJointFeedback { | | typedef struct dJointFeedback { | |
| dVector3 f1; /* force applied to body 1 */ | | dVector3 f1; /* force applied to body 1 */ | |
| dVector3 t1; /* torque applied to body 1 */ | | dVector3 t1; /* torque applied to body 1 */ | |
| dVector3 f2; /* force applied to body 2 */ | | dVector3 f2; /* force applied to body 2 */ | |
| dVector3 t2; /* torque applied to body 2 */ | | dVector3 t2; /* torque applied to body 2 */ | |
| } dJointFeedback; | | } dJointFeedback; | |
| | | | |
| /* private functions that must be implemented by the collision library: | | /* private functions that must be implemented by the collision library: | |
| | | | |
End of changes. 21 change blocks. |
| 92 lines changed or deleted | | 51 lines changed or added | |
|
| matrix.h | | matrix.h | |
| | | | |
| skipping to change at line 172 | | skipping to change at line 172 | |
| */ | | */ | |
| ODE_API void dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d, | | ODE_API void dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d, | |
| int n1, int n2, int r, int nskip); | | int n1, int n2, int r, int nskip); | |
| | | | |
| /* given an n*n matrix A (with leading dimension nskip), remove the r'th ro
w | | /* given an n*n matrix A (with leading dimension nskip), remove the r'th ro
w | |
| * and column by moving elements. the new matrix will have the same leading | | * and column by moving elements. the new matrix will have the same leading | |
| * dimension. the last row and column of A are untouched on exit. | | * dimension. the last row and column of A are untouched on exit. | |
| */ | | */ | |
| ODE_API void dRemoveRowCol (dReal *A, int n, int nskip, int r); | | ODE_API void dRemoveRowCol (dReal *A, int n, int nskip, int r); | |
| | | | |
|
| #if defined(__ODE__) | | | |
| | | | |
| void _dSetZero (dReal *a, size_t n); | | | |
| void _dSetValue (dReal *a, size_t n, dReal value); | | | |
| dReal _dDot (const dReal *a, const dReal *b, int n); | | | |
| void _dMultiply0 (dReal *A, const dReal *B, const dReal *C, int p,int q,int | | | |
| r); | | | |
| void _dMultiply1 (dReal *A, const dReal *B, const dReal *C, int p,int q,int | | | |
| r); | | | |
| void _dMultiply2 (dReal *A, const dReal *B, const dReal *C, int p,int q,int | | | |
| r); | | | |
| int _dFactorCholesky (dReal *A, int n, void *tmpbuf); | | | |
| void _dSolveCholesky (const dReal *L, dReal *b, int n, void *tmpbuf); | | | |
| int _dInvertPDMatrix (const dReal *A, dReal *Ainv, int n, void *tmpbuf); | | | |
| int _dIsPositiveDefinite (const dReal *A, int n, void *tmpbuf); | | | |
| void _dFactorLDLT (dReal *A, dReal *d, int n, int nskip); | | | |
| void _dSolveL1 (const dReal *L, dReal *b, int n, int nskip); | | | |
| void _dSolveL1T (const dReal *L, dReal *b, int n, int nskip); | | | |
| void _dVectorScale (dReal *a, const dReal *d, int n); | | | |
| void _dSolveLDLT (const dReal *L, const dReal *d, dReal *b, int n, int nski | | | |
| p); | | | |
| void _dLDLTAddTL (dReal *L, dReal *d, const dReal *a, int n, int nskip, voi | | | |
| d *tmpbuf); | | | |
| void _dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d, int n1, int | | | |
| n2, int r, int nskip, void *tmpbuf); | | | |
| void _dRemoveRowCol (dReal *A, int n, int nskip, int r); | | | |
| | | | |
| PURE_INLINE size_t _dEstimateFactorCholeskyTmpbufSize(int n) | | | |
| { | | | |
| return dPAD(n) * sizeof(dReal); | | | |
| } | | | |
| | | | |
| PURE_INLINE size_t _dEstimateSolveCholeskyTmpbufSize(int n) | | | |
| { | | | |
| return dPAD(n) * sizeof(dReal); | | | |
| } | | | |
| | | | |
| PURE_INLINE size_t _dEstimateInvertPDMatrixTmpbufSize(int n) | | | |
| { | | | |
| size_t FactorCholesky_size = _dEstimateFactorCholeskyTmpbufSize(n); | | | |
| size_t SolveCholesky_size = _dEstimateSolveCholeskyTmpbufSize(n); | | | |
| size_t MaxCholesky_size = FactorCholesky_size > SolveCholesky_size ? Fact | | | |
| orCholesky_size : SolveCholesky_size; | | | |
| return dPAD(n) * (n + 1) * sizeof(dReal) + MaxCholesky_size; | | | |
| } | | | |
| | | | |
| PURE_INLINE size_t _dEstimateIsPositiveDefiniteTmpbufSize(int n) | | | |
| { | | | |
| return dPAD(n) * n * sizeof(dReal) + _dEstimateFactorCholeskyTmpbufSize(n | | | |
| ); | | | |
| } | | | |
| | | | |
| PURE_INLINE size_t _dEstimateLDLTAddTLTmpbufSize(int nskip) | | | |
| { | | | |
| return nskip * 2 * sizeof(dReal); | | | |
| } | | | |
| | | | |
| PURE_INLINE size_t _dEstimateLDLTRemoveTmpbufSize(int n2, int nskip) | | | |
| { | | | |
| return n2 * sizeof(dReal) + _dEstimateLDLTAddTLTmpbufSize(nskip); | | | |
| } | | | |
| | | | |
| // For internal use | | | |
| #define dSetZero(a, n) _dSetZero(a, n) | | | |
| #define dSetValue(a, n, value) _dSetValue(a, n, value) | | | |
| #define dDot(a, b, n) _dDot(a, b, n) | | | |
| #define dMultiply0(A, B, C, p, q, r) _dMultiply0(A, B, C, p, q, r) | | | |
| #define dMultiply1(A, B, C, p, q, r) _dMultiply1(A, B, C, p, q, r) | | | |
| #define dMultiply2(A, B, C, p, q, r) _dMultiply2(A, B, C, p, q, r) | | | |
| #define dFactorCholesky(A, n, tmpbuf) _dFactorCholesky(A, n, tmpbuf) | | | |
| #define dSolveCholesky(L, b, n, tmpbuf) _dSolveCholesky(L, b, n, tmpbuf) | | | |
| #define dInvertPDMatrix(A, Ainv, n, tmpbuf) _dInvertPDMatrix(A, Ainv, n, tm | | | |
| pbuf) | | | |
| #define dIsPositiveDefinite(A, n, tmpbuf) _dIsPositiveDefinite(A, n, tmpbuf | | | |
| ) | | | |
| #define dFactorLDLT(A, d, n, nskip) _dFactorLDLT(A, d, n, nskip) | | | |
| #define dSolveL1(L, b, n, nskip) _dSolveL1(L, b, n, nskip) | | | |
| #define dSolveL1T(L, b, n, nskip) _dSolveL1T(L, b, n, nskip) | | | |
| #define dVectorScale(a, d, n) _dVectorScale(a, d, n) | | | |
| #define dSolveLDLT(L, d, b, n, nskip) _dSolveLDLT(L, d, b, n, nskip) | | | |
| #define dLDLTAddTL(L, d, a, n, nskip, tmpbuf) _dLDLTAddTL(L, d, a, n, nskip | | | |
| , tmpbuf) | | | |
| #define dLDLTRemove(A, p, L, d, n1, n2, r, nskip, tmpbuf) _dLDLTRemove(A, p | | | |
| , L, d, n1, n2, r, nskip, tmpbuf) | | | |
| #define dRemoveRowCol(A, n, nskip, r) _dRemoveRowCol(A, n, nskip, r) | | | |
| | | | |
| #define dEstimateFactorCholeskyTmpbufSize(n) _dEstimateFactorCholeskyTmpbuf | | | |
| Size(n) | | | |
| #define dEstimateSolveCholeskyTmpbufSize(n) _dEstimateSolveCholeskyTmpbufSi | | | |
| ze(n) | | | |
| #define dEstimateInvertPDMatrixTmpbufSize(n) _dEstimateInvertPDMatrixTmpbuf | | | |
| Size(n) | | | |
| #define dEstimateIsPositiveDefiniteTmpbufSize(n) _dEstimateIsPositiveDefini | | | |
| teTmpbufSize(n) | | | |
| #define dEstimateLDLTAddTLTmpbufSize(nskip) _dEstimateLDLTAddTLTmpbufSize(n | | | |
| skip) | | | |
| #define dEstimateLDLTRemoveTmpbufSize(n2, nskip) _dEstimateLDLTRemoveTmpbuf | | | |
| Size(n2, nskip) | | | |
| | | | |
| #endif // defined(__ODE__) | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 1 change blocks. |
| 101 lines changed or deleted | | 0 lines changed or added | |
|
| 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 30 | | skipping to change at line 29 | |
| * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | | * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | |
| * * | | * * | |
| *************************************************************************/ | | *************************************************************************/ | |
| | | | |
| #ifndef _ODE_OBJECTS_H_ | | #ifndef _ODE_OBJECTS_H_ | |
| #define _ODE_OBJECTS_H_ | | #define _ODE_OBJECTS_H_ | |
| | | | |
| #include <ode/common.h> | | #include <ode/common.h> | |
| #include <ode/mass.h> | | #include <ode/mass.h> | |
| #include <ode/contact.h> | | #include <ode/contact.h> | |
|
| | | #include <ode/threading.h> | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * @defgroup world World | | * @defgroup world World | |
| * | | * | |
| * The world object is a container for rigid bodies and joints. Objects in | | * The world object is a container for rigid bodies and joints. Objects in | |
| * different worlds can not interact, for example rigid bodies from two | | * different worlds can not interact, for example rigid bodies from two | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 113 | |
| */ | | */ | |
| ODE_API void dWorldSetCFM (dWorldID, dReal cfm); | | ODE_API void dWorldSetCFM (dWorldID, dReal cfm); | |
| | | | |
| /** | | /** | |
| * @brief Get the constraint force mixing value. | | * @brief Get the constraint force mixing value. | |
| * @ingroup world | | * @ingroup world | |
| * @return CFM value | | * @return CFM value | |
| */ | | */ | |
| ODE_API dReal dWorldGetCFM (dWorldID); | | ODE_API dReal dWorldGetCFM (dWorldID); | |
| | | | |
|
| | | #define dWORLDSTEP_THREADCOUNT_UNLIMITED 0U | |
| | | | |
| | | /** | |
| | | * @brief Set maximum threads to be used for island stepping | |
| | | * | |
| | | * The actual number of threads that is going to be used will be the minimu | |
| | | m | |
| | | * of this limit and number of threads in the threading pool. By default | |
| | | * there is no limit (@c dWORLDSTEP_THREADCOUNT_UNLIMITED). | |
| | | * | |
| | | * @warning | |
| | | * WARNING! Running island stepping in multiple threads requires allocating | |
| | | * individual stepping memory buffer for each of those threads. The size of | |
| | | buffers | |
| | | * allocated is the size needed to handle the largest island in the world. | |
| | | * | |
| | | * Note: Setting a limit for island stepping does not affect threading at l | |
| | | ower | |
| | | * levels in stepper functions. The sub-calls scheduled from them can be ex | |
| | | ecuted | |
| | | * in as many threads as there are available in the pool. | |
| | | * | |
| | | * @param w The world affected | |
| | | * @param count Thread count limit value for island stepping | |
| | | * @ingroup world | |
| | | * @see dWorldGetStepIslandsProcessingMaxThreadCount | |
| | | */ | |
| | | ODE_API void dWorldSetStepIslandsProcessingMaxThreadCount(dWorldID w, unsig | |
| | | ned count); | |
| | | /** | |
| | | * @brief Get maximum threads that are allowed to be used for island steppi | |
| | | ng. | |
| | | * | |
| | | * Please read commentaries to @c dWorldSetStepIslandsProcessingMaxThreadCo | |
| | | unt for | |
| | | * important information regarding the value returned. | |
| | | * | |
| | | * @param w The world queried | |
| | | * @returns Current thread count limit value for island stepping | |
| | | * @ingroup world | |
| | | * @see dWorldSetStepIslandsProcessingMaxThreadCount | |
| | | */ | |
| | | ODE_API unsigned dWorldGetStepIslandsProcessingMaxThreadCount(dWorldID w); | |
| | | | |
| /** | | /** | |
| * @brief Set the world to use shared working memory along with another wor
ld. | | * @brief Set the world to use shared working memory along with another wor
ld. | |
| * | | * | |
| * The worlds allocate working memory internally for simulation stepping. T
his | | * The worlds allocate working memory internally for simulation stepping. T
his | |
| * memory is cached among the calls to @c dWordStep and @c dWorldQuickStep. | | * memory is cached among the calls to @c dWordStep and @c dWorldQuickStep. | |
| * Similarly, several worlds can be set up to share this memory caches thus | | * Similarly, several worlds can be set up to share this memory caches thus | |
| * reducing overall memory usage by cost of making worlds inappropriate for | | * reducing overall memory usage by cost of making worlds inappropriate for | |
| * simultaneous simulation in multiple threads. | | * simultaneous simulation in multiple threads. | |
| * | | * | |
| * If null value is passed for @a from_world parameter the world is detache
d from | | * If null value is passed for @a from_world parameter the world is detache
d from | |
| | | | |
| skipping to change at line 138 | | skipping to change at line 175 | |
| * | | * | |
| * Allocation policy used can only increase world's internal reserved memor
y size | | * Allocation policy used can only increase world's internal reserved memor
y size | |
| * and never decreases it. @c dWorldCleanupWorkingMemory can be used to rel
ease | | * and never decreases it. @c dWorldCleanupWorkingMemory can be used to rel
ease | |
| * working memory for a world in case if number of objects/joint decreases | | * working memory for a world in case if number of objects/joint decreases | |
| * significantly in it. | | * significantly in it. | |
| * | | * | |
| * With sharing working memory worlds also automatically share memory reser
vation | | * With sharing working memory worlds also automatically share memory reser
vation | |
| * policy and memory manager. Thus, these parameters need to be customized
for | | * policy and memory manager. Thus, these parameters need to be customized
for | |
| * initial world to be used as sharing source only. | | * initial world to be used as sharing source only. | |
| * | | * | |
|
| | | * If worlds share working memory they must also use compatible threading i | |
| | | mplementations | |
| | | * (i.e. it is illegal for one world to perform stepping with self-threaded | |
| | | implementation | |
| | | * when the other world is assigned a multi-threaded implementation). | |
| | | * For more information read section about threading approaches in ODE. | |
| | | * | |
| * Failure result status means a memory allocation failure. | | * Failure result status means a memory allocation failure. | |
| * | | * | |
| * @param w The world to use the shared memory with. | | * @param w The world to use the shared memory with. | |
| * @param from_world Null or the world the shared memory is to be used from
. | | * @param from_world Null or the world the shared memory is to be used from
. | |
| * @returns 1 for success and 0 for failure. | | * @returns 1 for success and 0 for failure. | |
| * | | * | |
| * @ingroup world | | * @ingroup world | |
| * @see dWorldCleanupWorkingMemory | | * @see dWorldCleanupWorkingMemory | |
| * @see dWorldSetStepMemoryReservationPolicy | | * @see dWorldSetStepMemoryReservationPolicy | |
| * @see dWorldSetStepMemoryManager | | * @see dWorldSetStepMemoryManager | |
| | | | |
| skipping to change at line 196 | | skipping to change at line 238 | |
| * @c reserve_minimum is a minimum size that is checked against whenever re
allocation | | * @c reserve_minimum is a minimum size that is checked against whenever re
allocation | |
| * is needed to allocate expected working memory minimum at once without ex
tra | | * is needed to allocate expected working memory minimum at once without ex
tra | |
| * reallocations as number of bodies/joints grows. | | * reallocations as number of bodies/joints grows. | |
| * | | * | |
| * @ingroup world | | * @ingroup world | |
| * @see dWorldSetStepMemoryReservationPolicy | | * @see dWorldSetStepMemoryReservationPolicy | |
| */ | | */ | |
| typedef struct | | typedef struct | |
| { | | { | |
| unsigned struct_size; | | unsigned struct_size; | |
|
| float reserve_factor; // Use float as precision does not matter here | | float reserve_factor; /* Use float as precision does not matter here*/ | |
| unsigned reserve_minimum; | | unsigned reserve_minimum; | |
| | | | |
| } dWorldStepReserveInfo; | | } dWorldStepReserveInfo; | |
| | | | |
| /** | | /** | |
| * @brief Set memory reservation policy for world to be used with simulatio
n stepping functions | | * @brief Set memory reservation policy for world to be used with simulatio
n stepping functions | |
| * | | * | |
| * The function allows to customize reservation policy to be used for inter
nal | | * The function allows to customize reservation policy to be used for inter
nal | |
| * memory which is allocated to aid simulation for a world. By default, val
ues | | * memory which is allocated to aid simulation for a world. By default, val
ues | |
| * of @c dWORLDSTEP_RESERVEFACTOR_DEFAULT and @c dWORLDSTEP_RESERVESIZE_DEF
AULT | | * of @c dWORLDSTEP_RESERVEFACTOR_DEFAULT and @c dWORLDSTEP_RESERVESIZE_DEF
AULT | |
| | | | |
| skipping to change at line 284 | | skipping to change at line 326 | |
| * @param w The world to change memory reservation policy for. | | * @param w The world to change memory reservation policy for. | |
| * @param memfuncs Null or a pointer to memory manager descriptor structure. | | * @param memfuncs Null or a pointer to memory manager descriptor structure. | |
| * @returns 1 for success and 0 for failure. | | * @returns 1 for success and 0 for failure. | |
| * | | * | |
| * @ingroup world | | * @ingroup world | |
| * @see dWorldUseSharedWorkingMemory | | * @see dWorldUseSharedWorkingMemory | |
| */ | | */ | |
| ODE_API int dWorldSetStepMemoryManager(dWorldID w, const dWorldStepMemoryFu
nctionsInfo *memfuncs); | | ODE_API int dWorldSetStepMemoryManager(dWorldID w, const dWorldStepMemoryFu
nctionsInfo *memfuncs); | |
| | | | |
| /** | | /** | |
|
| | | * @brief Assign threading implementation to be used for [quick]stepping th | |
| | | e world. | |
| | | * | |
| | | * @warning It is not recommended to assign the same threading implementati | |
| | | on to | |
| | | * different worlds if they are going to be called in parallel. In particul | |
| | | ar this | |
| | | * makes resources preallocation for threaded calls to lose its sense. | |
| | | * Built-in threading implementation is likely to crash if misused this way | |
| | | . | |
| | | * | |
| | | * @param w The world to change threading implementation for. | |
| | | * @param functions_info Pointer to threading functions structure | |
| | | * @param threading_impl ID of threading implementation object | |
| | | * | |
| | | * @ingroup world | |
| | | */ | |
| | | ODE_API void dWorldSetStepThreadingImplementation(dWorldID w, const dThread | |
| | | ingFunctionsInfo *functions_info, dThreadingImplementationID threading_impl | |
| | | ); | |
| | | | |
| | | /** | |
| * @brief Step the world. | | * @brief Step the world. | |
| * | | * | |
| * This uses a "big matrix" method that takes time on the order of m^3 | | * This uses a "big matrix" method that takes time on the order of m^3 | |
| * and memory on the order of m^2, where m is the total number of constrain
t | | * and memory on the order of m^2, where m is the total number of constrain
t | |
| * rows. For large systems this will use a lot of memory and can be very sl
ow, | | * rows. For large systems this will use a lot of memory and can be very sl
ow, | |
| * but this is currently the most accurate method. | | * but this is currently the most accurate method. | |
| * | | * | |
| * Failure result status means that the memory allocation has failed for op
eration. | | * Failure result status means that the memory allocation has failed for op
eration. | |
| * In such a case all the objects remain in unchanged state and simulation
can be | | * In such a case all the objects remain in unchanged state and simulation
can be | |
| * retried as soon as more memory is available. | | * retried as soon as more memory is available. | |
| | | | |
| skipping to change at line 1602 | | skipping to change at line 1660 | |
| | | | |
| /** | | /** | |
| * @brief Create a new joint of the plane-2d type. | | * @brief Create a new joint of the plane-2d type. | |
| * @ingroup joints | | * @ingroup joints | |
| * @param dJointGroupID set to 0 to allocate the joint normally. | | * @param dJointGroupID set to 0 to allocate the joint normally. | |
| * If it is nonzero the joint is allocated in the given joint group. | | * If it is nonzero the joint is allocated in the given joint group. | |
| */ | | */ | |
| ODE_API dJointID dJointCreatePlane2D (dWorldID, dJointGroupID); | | ODE_API dJointID dJointCreatePlane2D (dWorldID, dJointGroupID); | |
| | | | |
| /** | | /** | |
|
| | | * @brief Create a new joint of the double ball type. | |
| | | * @ingroup joints | |
| | | * @param dJointGroupID set to 0 to allocate the joint normally. | |
| | | * If it is nonzero the joint is allocated in the given joint group. | |
| | | */ | |
| | | ODE_API dJointID dJointCreateDBall (dWorldID, dJointGroupID); | |
| | | | |
| | | /** | |
| | | * @brief Create a new joint of the double hinge type. | |
| | | * @ingroup joints | |
| | | * @param dJointGroupID set to 0 to allocate the joint normally. | |
| | | * If it is nonzero the joint is allocated in the given joint group. | |
| | | */ | |
| | | ODE_API dJointID dJointCreateDHinge (dWorldID, dJointGroupID); | |
| | | | |
| | | /** | |
| | | * @brief Create a new joint of the Transmission type. | |
| | | * @ingroup joints | |
| | | * @param dJointGroupID set to 0 to allocate the joint normally. | |
| | | * If it is nonzero the joint is allocated in the given joint group. | |
| | | */ | |
| | | ODE_API dJointID dJointCreateTransmission (dWorldID, dJointGroupID); | |
| | | | |
| | | /** | |
| * @brief Destroy a joint. | | * @brief Destroy a joint. | |
| * @ingroup joints | | * @ingroup joints | |
| * | | * | |
| * disconnects it from its attached bodies and removing it from the world. | | * 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 | | * 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. | | * effect - to destroy that joint the group must be emptied or destroyed. | |
| */ | | */ | |
| ODE_API void dJointDestroy (dJointID); | | ODE_API void dJointDestroy (dJointID); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 2872 | | skipping to change at line 2954 | |
| */ | | */ | |
| ODE_API dReal dJointGetLMotorParam (dJointID, int parameter); | | ODE_API dReal dJointGetLMotorParam (dJointID, int parameter); | |
| | | | |
| /** | | /** | |
| * @brief get joint parameter | | * @brief get joint parameter | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API dReal dJointGetFixedParam (dJointID, int parameter); | | ODE_API dReal dJointGetFixedParam (dJointID, int parameter); | |
| | | | |
| /** | | /** | |
|
| | | * @brief get the contact point of the first wheel of the Transmission join | |
| | | t. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetTransmissionContactPoint1(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief get contact point of the second wheel of the Transmission joint. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetTransmissionContactPoint2(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief set the first axis for the Transmission joint | |
| | | * @remarks This is the axis around which the first body is allowed to | |
| | | * revolve and is attached to it. It is given in global coordinates | |
| | | * and can only be set explicitly in intersecting-axes mode. For the | |
| | | * parallel-axes and chain modes which share one common axis of | |
| | | * revolution for both gears dJointSetTransmissionAxis should be used. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionAxis1(dJointID, dReal x, dReal y, dReal z | |
| | | ); | |
| | | | |
| | | /** | |
| | | * @brief get first axis for the Transmission joint | |
| | | * @remarks In parallel-axes and chain mode the common axis with | |
| | | * respect to the first body is returned. If the joint constraint is | |
| | | * satisfied it should be the same as the axis return with | |
| | | * dJointGetTransmissionAxis2 or dJointGetTransmissionAxis. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetTransmissionAxis1(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief set second axis for the Transmission joint | |
| | | * @remarks This is the axis around which the second body is allowed | |
| | | * to revolve and is attached to it. It is given in global | |
| | | * coordinates and can only be set explicitly in intersecting-axes | |
| | | * mode. For the parallel-axes and chain modes which share one common | |
| | | * axis of revolution for both gears dJointSetTransmissionAxis should | |
| | | * be used. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionAxis2(dJointID, dReal x, dReal y, dReal z | |
| | | ); | |
| | | | |
| | | /** | |
| | | * @brief get second axis for the Transmission joint | |
| | | * @remarks In parallel-axes and chain mode the common axis with | |
| | | * respect to the second body is returned. If the joint constraint is | |
| | | * satisfied it should be the same as the axis return with | |
| | | * dJointGetTransmissionAxis1 or dJointGetTransmissionAxis. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetTransmissionAxis2(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief set the first anchor for the Transmission joint | |
| | | * @remarks This is the point of attachment of the wheel on the | |
| | | * first body. It is given in global coordinates. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionAnchor1(dJointID, dReal x, dReal y, dReal | |
| | | z); | |
| | | | |
| | | /** | |
| | | * @brief get the first anchor of the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetTransmissionAnchor1(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief set the second anchor for the Transmission joint | |
| | | * @remarks This is the point of attachment of the wheel on the | |
| | | * second body. It is given in global coordinates. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionAnchor2(dJointID, dReal x, dReal y, dReal | |
| | | z); | |
| | | | |
| | | /** | |
| | | * @brief get the second anchor for the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetTransmissionAnchor2(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief set a Transmission joint parameter | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionParam(dJointID, int parameter, dReal valu | |
| | | e); | |
| | | | |
| | | /** | |
| | | * @brief get a Transmission joint parameter | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetTransmissionParam(dJointID, int parameter); | |
| | | | |
| | | /** | |
| | | * @brief set the Transmission joint mode | |
| | | * @remarks The mode can be one of dTransmissionParallelAxes, | |
| | | * dTransmissionIntersectingAxes and dTransmissionChainDrive simulating a | |
| | | * set of parallel-axes gears, intersecting-axes beveled gears or | |
| | | * chain and sprockets respectively. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionMode( dJointID j, int mode ); | |
| | | | |
| | | /** | |
| | | * @brief get the Transmission joint mode | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API int dJointGetTransmissionMode( dJointID j ); | |
| | | | |
| | | /** | |
| | | * @brief set the Transmission ratio | |
| | | * @remarks This is the ratio of the angular speed of the first gear | |
| | | * to that of the second gear. It can only be set explicitly in | |
| | | * parallel-axes mode. In intersecting-axes mode the ratio is defined | |
| | | * implicitly by the initial configuration of the wheels and in chain | |
| | | * mode it is defined implicitly be the wheel radii. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionRatio( dJointID j, dReal ratio ); | |
| | | | |
| | | /** | |
| | | * @brief get the Transmission joint ratio | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetTransmissionRatio( dJointID j ); | |
| | | | |
| | | /** | |
| | | * @brief set the common axis for both wheels of the Transmission joint | |
| | | * @remarks This sets the common axis of revolution for both wheels | |
| | | * and should only be used in parallel-axes or chain mode. For | |
| | | * intersecting-axes mode where each wheel axis needs to be specified | |
| | | * individually dJointSetTransmissionAxis1 and | |
| | | * dJointSetTransmissionAxis2 should be used. The axis is given in | |
| | | * global coordinates | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionAxis( dJointID j, dReal x, dReal y, dReal | |
| | | z ); | |
| | | | |
| | | /** | |
| | | * @brief get the common axis for both wheels of the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetTransmissionAxis( dJointID j, dVector3 result ); | |
| | | | |
| | | /** | |
| | | * @brief get the phase, that is the traversed angle for the first | |
| | | * wheel of the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetTransmissionAngle1( dJointID j ); | |
| | | | |
| | | /** | |
| | | * @brief get the phase, that is the traversed angle for the second | |
| | | * wheel of the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetTransmissionAngle2( dJointID j ); | |
| | | | |
| | | /** | |
| | | * @brief get the radius of the first wheel of the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetTransmissionRadius1( dJointID j ); | |
| | | | |
| | | /** | |
| | | * @brief get the radius of the second wheel of the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetTransmissionRadius2( dJointID j ); | |
| | | | |
| | | /** | |
| | | * @brief set the radius of the first wheel of the Transmission joint | |
| | | * @remarks The wheel radii can only be set explicitly in chain mode. | |
| | | * In the other modes they're defined implicitly by the initial | |
| | | * configuration and ratio of the wheels. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionRadius1( dJointID j, dReal radius ); | |
| | | | |
| | | /** | |
| | | * @brief set the radius of the second wheel of the Transmission joint | |
| | | * @remarks The wheel radii can only be set explicitly in chain mode. | |
| | | * In the other modes they're defined implicitly by the initial | |
| | | * configuration and ratio of the wheels. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionRadius2( dJointID j, dReal radius ); | |
| | | | |
| | | /** | |
| | | * @brief get the backlash of the Transmission joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetTransmissionBacklash( dJointID j ); | |
| | | | |
| | | /** | |
| | | * @brief set the backlash of the Transmission joint | |
| | | * @remarks Backlash is the clearance in the mesh of the wheels of the | |
| | | * transmission and is defined as the maximum distance that the | |
| | | * geometric contact point can travel without any actual contact or | |
| | | * transfer of power between the wheels. This can be converted in | |
| | | * degrees of revolution for each wheel by dividing by the wheel's | |
| | | * radius. To further illustrate this consider the situation where a | |
| | | * wheel of radius r_1 is driving another wheel of radius r_2 and | |
| | | * there is an amount of backlash equal to b in their mesh. If the | |
| | | * driving wheel were to instantaneously stop there would be no | |
| | | * contact and hence the driven wheel would continue to turn for | |
| | | * another b / r_2 radians until all the backlash in the mesh was take | |
| | | * up and contact restored with the relationship of driving and driven | |
| | | * wheel reversed. The backlash is therefore given in untis of | |
| | | * length. | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetTransmissionBacklash( dJointID j, dReal backlash ); | |
| | | | |
| | | /** | |
| | | * @brief set anchor1 for double ball joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetDBallAnchor1(dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| | | /** | |
| | | * @brief set anchor2 for double ball joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetDBallAnchor2(dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| | | /** | |
| | | * @brief get anchor1 from double ball joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetDBallAnchor1(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief get anchor2 from double ball joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetDBallAnchor2(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief get the set distance from double ball joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetDBallDistance(dJointID); | |
| | | | |
| | | /** | |
| | | * @brief set double ball joint parameter | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetDBallParam(dJointID, int parameter, dReal value); | |
| | | | |
| | | /** | |
| | | * @brief get double ball joint parameter | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetDBallParam(dJointID, int parameter); | |
| | | | |
| | | /** | |
| | | * @brief set axis for double hinge joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetDHingeAxis(dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| | | /** | |
| | | * @brief get axis for double hinge joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetDHingeAxis(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief set anchor1 for double hinge joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetDHingeAnchor1(dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| | | /** | |
| | | * @brief set anchor2 for double hinge joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetDHingeAnchor2(dJointID, dReal x, dReal y, dReal z); | |
| | | | |
| | | /** | |
| | | * @brief get anchor1 from double hinge joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetDHingeAnchor1(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief get anchor2 from double hinge joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointGetDHingeAnchor2(dJointID, dVector3 result); | |
| | | | |
| | | /** | |
| | | * @brief get the set distance from double hinge joint | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetDHingeDistance(dJointID); | |
| | | | |
| | | /** | |
| | | * @brief set double hinge joint parameter | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API void dJointSetDHingeParam(dJointID, int parameter, dReal value); | |
| | | | |
| | | /** | |
| | | * @brief get double hinge joint parameter | |
| | | * @ingroup joints | |
| | | */ | |
| | | ODE_API dReal dJointGetDHingeParam(dJointID, int parameter); | |
| | | | |
| | | /** | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API dJointID dConnectingJoint (dBodyID, dBodyID); | | ODE_API dJointID dConnectingJoint (dBodyID, dBodyID); | |
| | | | |
| /** | | /** | |
| * @ingroup joints | | * @ingroup joints | |
| */ | | */ | |
| ODE_API int dConnectingJointList (dBodyID, dBodyID, dJointID*); | | ODE_API int dConnectingJointList (dBodyID, dBodyID, dJointID*); | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 8 change blocks. |
| 2 lines changed or deleted | | 418 lines changed or added | |
|
| odemath.h | | odemath.h | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| #define dACCESS33(A,i,j) ((A)[(i)*4+(j)]) | | #define dACCESS33(A,i,j) ((A)[(i)*4+(j)]) | |
| | | | |
| /* | | /* | |
| * Macro to test for valid floating point values | | * Macro to test for valid floating point values | |
| */ | | */ | |
| #define dVALIDVEC3(v) (!(dIsNan(v[0]) || dIsNan(v[1]) || dIsNan(v[2]))) | | #define dVALIDVEC3(v) (!(dIsNan(v[0]) || dIsNan(v[1]) || dIsNan(v[2]))) | |
| #define dVALIDVEC4(v) (!(dIsNan(v[0]) || dIsNan(v[1]) || dIsNan(v[2]) || dI
sNan(v[3]))) | | #define dVALIDVEC4(v) (!(dIsNan(v[0]) || dIsNan(v[1]) || dIsNan(v[2]) || dI
sNan(v[3]))) | |
| #define dVALIDMAT3(m) (!(dIsNan(m[0]) || dIsNan(m[1]) || dIsNan(m[2]) || dI
sNan(m[3]) || dIsNan(m[4]) || dIsNan(m[5]) || dIsNan(m[6]) || dIsNan(m[7])
|| dIsNan(m[8]) || dIsNan(m[9]) || dIsNan(m[10]) || dIsNan(m[11]))) | | #define dVALIDMAT3(m) (!(dIsNan(m[0]) || dIsNan(m[1]) || dIsNan(m[2]) || dI
sNan(m[3]) || dIsNan(m[4]) || dIsNan(m[5]) || dIsNan(m[6]) || dIsNan(m[7])
|| dIsNan(m[8]) || dIsNan(m[9]) || dIsNan(m[10]) || dIsNan(m[11]))) | |
| #define dVALIDMAT4(m) (!(dIsNan(m[0]) || dIsNan(m[1]) || dIsNan(m[2]) || dI
sNan(m[3]) || dIsNan(m[4]) || dIsNan(m[5]) || dIsNan(m[6]) || dIsNan(m[7])
|| dIsNan(m[8]) || dIsNan(m[9]) || dIsNan(m[10]) || dIsNan(m[11]) || dIsNan
(m[12]) || dIsNan(m[13]) || dIsNan(m[14]) || dIsNan(m[15]) )) | | #define dVALIDMAT4(m) (!(dIsNan(m[0]) || dIsNan(m[1]) || dIsNan(m[2]) || dI
sNan(m[3]) || dIsNan(m[4]) || dIsNan(m[5]) || dIsNan(m[6]) || dIsNan(m[7])
|| dIsNan(m[8]) || dIsNan(m[9]) || dIsNan(m[10]) || dIsNan(m[11]) || dIsNan
(m[12]) || dIsNan(m[13]) || dIsNan(m[14]) || dIsNan(m[15]) )) | |
| | | | |
|
| // Some vector math | | /* Some vector math */ | |
| PURE_INLINE void dAddVectors3(dReal *res, const dReal *a, const dReal *b) | | ODE_PURE_INLINE void dAddVectors3(dReal *res, const dReal *a, const dReal * | |
| | | b) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = a[0] + b[0]; | |
| res_0 = a[0] + b[0]; | | const dReal res_1 = a[1] + b[1]; | |
| res_1 = a[1] + b[1]; | | const dReal res_2 = a[2] + b[2]; | |
| res_2 = a[2] + b[2]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dSubtractVectors3(dReal *res, const dReal *a, const dReal
*b) | | ODE_PURE_INLINE void dSubtractVectors3(dReal *res, const dReal *a, const dR
eal *b) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = a[0] - b[0]; | |
| res_0 = a[0] - b[0]; | | const dReal res_1 = a[1] - b[1]; | |
| res_1 = a[1] - b[1]; | | const dReal res_2 = a[2] - b[2]; | |
| res_2 = a[2] - b[2]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dAddScaledVectors3(dReal *res, const dReal *a, const dReal
*b, dReal a_scale, dReal b_scale) | | ODE_PURE_INLINE void dAddScaledVectors3(dReal *res, const dReal *a, const d
Real *b, dReal a_scale, dReal b_scale) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = a_scale * a[0] + b_scale * b[0]; | |
| res_0 = a_scale * a[0] + b_scale * b[0]; | | const dReal res_1 = a_scale * a[1] + b_scale * b[1]; | |
| res_1 = a_scale * a[1] + b_scale * b[1]; | | const dReal res_2 = a_scale * a[2] + b_scale * b[2]; | |
| res_2 = a_scale * a[2] + b_scale * b[2]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dScaleVector3(dReal *res, dReal nScale) | | ODE_PURE_INLINE void dScaleVector3(dReal *res, dReal nScale) | |
| { | | { | |
| res[0] *= nScale ; | | res[0] *= nScale ; | |
| res[1] *= nScale ; | | res[1] *= nScale ; | |
| res[2] *= nScale ; | | res[2] *= nScale ; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dNegateVector3(dReal *res) | | ODE_PURE_INLINE void dNegateVector3(dReal *res) | |
| { | | { | |
| res[0] = -res[0]; | | res[0] = -res[0]; | |
| res[1] = -res[1]; | | res[1] = -res[1]; | |
| res[2] = -res[2]; | | res[2] = -res[2]; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dCopyVector3(dReal *res, const dReal *a) | | ODE_PURE_INLINE void dCopyVector3(dReal *res, const dReal *a) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = a[0]; | |
| res_0 = a[0]; | | const dReal res_1 = a[1]; | |
| res_1 = a[1]; | | const dReal res_2 = a[2]; | |
| res_2 = a[2]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dCopyScaledVector3(dReal *res, const dReal *a, dReal nScal
e) | | ODE_PURE_INLINE void dCopyScaledVector3(dReal *res, const dReal *a, dReal n
Scale) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = a[0] * nScale; | |
| res_0 = a[0] * nScale; | | const dReal res_1 = a[1] * nScale; | |
| res_1 = a[1] * nScale; | | const dReal res_2 = a[2] * nScale; | |
| res_2 = a[2] * nScale; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dCopyNegatedVector3(dReal *res, const dReal *a) | | ODE_PURE_INLINE void dCopyNegatedVector3(dReal *res, const dReal *a) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = -a[0]; | |
| res_0 = -a[0]; | | const dReal res_1 = -a[1]; | |
| res_1 = -a[1]; | | const dReal res_2 = -a[2]; | |
| res_2 = -a[2]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dCopyVector4(dReal *res, const dReal *a) | | ODE_PURE_INLINE void dCopyVector4(dReal *res, const dReal *a) | |
| { | | { | |
|
| dReal res_0, res_1, res_2, res_3; | | const dReal res_0 = a[0]; | |
| res_0 = a[0]; | | const dReal res_1 = a[1]; | |
| res_1 = a[1]; | | const dReal res_2 = a[2]; | |
| res_2 = a[2]; | | const dReal res_3 = a[3]; | |
| res_3 = a[3]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; res[3] = res_3; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; res[3] = res_3; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dCopyMatrix4x4(dReal *res, const dReal *a) | | ODE_PURE_INLINE void dCopyMatrix4x4(dReal *res, const dReal *a) | |
| { | | { | |
| dCopyVector4(res + 0, a + 0); | | dCopyVector4(res + 0, a + 0); | |
| dCopyVector4(res + 4, a + 4); | | dCopyVector4(res + 4, a + 4); | |
| dCopyVector4(res + 8, a + 8); | | dCopyVector4(res + 8, a + 8); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dCopyMatrix4x3(dReal *res, const dReal *a) | | ODE_PURE_INLINE void dCopyMatrix4x3(dReal *res, const dReal *a) | |
| { | | { | |
| dCopyVector3(res + 0, a + 0); | | dCopyVector3(res + 0, a + 0); | |
| dCopyVector3(res + 4, a + 4); | | dCopyVector3(res + 4, a + 4); | |
| dCopyVector3(res + 8, a + 8); | | dCopyVector3(res + 8, a + 8); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dGetMatrixColumn3(dReal *res, const dReal *a, unsigned n) | | ODE_PURE_INLINE void dGetMatrixColumn3(dReal *res, const dReal *a, unsigned
n) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = a[n + 0]; | |
| res_0 = a[n + 0]; | | const dReal res_1 = a[n + 4]; | |
| res_1 = a[n + 4]; | | const dReal res_2 = a[n + 8]; | |
| res_2 = a[n + 8]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE dReal dCalcVectorLength3(const dReal *a) | | ODE_PURE_INLINE dReal dCalcVectorLength3(const dReal *a) | |
| { | | { | |
| return dSqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); | | return dSqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); | |
| } | | } | |
| | | | |
|
| PURE_INLINE dReal dCalcVectorLengthSquare3(const dReal *a) | | ODE_PURE_INLINE dReal dCalcVectorLengthSquare3(const dReal *a) | |
| { | | { | |
| return (a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); | | return (a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); | |
| } | | } | |
| | | | |
|
| PURE_INLINE dReal dCalcPointDepth3(const dReal *test_p, const dReal *plane_
p, const dReal *plane_n) | | ODE_PURE_INLINE dReal dCalcPointDepth3(const dReal *test_p, const dReal *pl
ane_p, const dReal *plane_n) | |
| { | | { | |
| return (plane_p[0] - test_p[0]) * plane_n[0] + (plane_p[1] - test_p[1]) *
plane_n[1] + (plane_p[2] - test_p[2]) * plane_n[2]; | | return (plane_p[0] - test_p[0]) * plane_n[0] + (plane_p[1] - test_p[1]) *
plane_n[1] + (plane_p[2] - test_p[2]) * plane_n[2]; | |
| } | | } | |
| | | | |
| /* | | /* | |
| * 3-way dot product. _dCalcVectorDot3 means that elements of `a' and `b' ar
e spaced | | * 3-way dot product. _dCalcVectorDot3 means that elements of `a' and `b' ar
e spaced | |
| * step_a and step_b indexes apart respectively. dCalcVectorDot3() means dDo
t311. | | * step_a and step_b indexes apart respectively. dCalcVectorDot3() means dDo
t311. | |
| */ | | */ | |
| | | | |
|
| PURE_INLINE dReal _dCalcVectorDot3(const dReal *a, const dReal *b, unsigned
step_a, unsigned step_b) | | ODE_PURE_INLINE dReal _dCalcVectorDot3(const dReal *a, const dReal *b, unsi
gned step_a, unsigned step_b) | |
| { | | { | |
| return a[0] * b[0] + a[step_a] * b[step_b] + a[2 * step_a] * b[2 * step_b
]; | | return a[0] * b[0] + a[step_a] * b[step_b] + a[2 * step_a] * b[2 * step_b
]; | |
| } | | } | |
| | | | |
|
| PURE_INLINE dReal dCalcVectorDot3 (const dReal *a, const dReal *b) { ret | | ODE_PURE_INLINE dReal dCalcVectorDot3 (const dReal *a, const dReal *b) { | |
| urn _dCalcVectorDot3(a,b,1,1); } | | return _dCalcVectorDot3(a,b,1,1); } | |
| PURE_INLINE dReal dCalcVectorDot3_13 (const dReal *a, const dReal *b) { ret | | ODE_PURE_INLINE dReal dCalcVectorDot3_13 (const dReal *a, const dReal *b) { | |
| urn _dCalcVectorDot3(a,b,1,3); } | | return _dCalcVectorDot3(a,b,1,3); } | |
| PURE_INLINE dReal dCalcVectorDot3_31 (const dReal *a, const dReal *b) { ret | | ODE_PURE_INLINE dReal dCalcVectorDot3_31 (const dReal *a, const dReal *b) { | |
| urn _dCalcVectorDot3(a,b,3,1); } | | return _dCalcVectorDot3(a,b,3,1); } | |
| PURE_INLINE dReal dCalcVectorDot3_33 (const dReal *a, const dReal *b) { ret | | ODE_PURE_INLINE dReal dCalcVectorDot3_33 (const dReal *a, const dReal *b) { | |
| urn _dCalcVectorDot3(a,b,3,3); } | | return _dCalcVectorDot3(a,b,3,3); } | |
| PURE_INLINE dReal dCalcVectorDot3_14 (const dReal *a, const dReal *b) { ret | | ODE_PURE_INLINE dReal dCalcVectorDot3_14 (const dReal *a, const dReal *b) { | |
| urn _dCalcVectorDot3(a,b,1,4); } | | return _dCalcVectorDot3(a,b,1,4); } | |
| PURE_INLINE dReal dCalcVectorDot3_41 (const dReal *a, const dReal *b) { ret | | ODE_PURE_INLINE dReal dCalcVectorDot3_41 (const dReal *a, const dReal *b) { | |
| urn _dCalcVectorDot3(a,b,4,1); } | | return _dCalcVectorDot3(a,b,4,1); } | |
| PURE_INLINE dReal dCalcVectorDot3_44 (const dReal *a, const dReal *b) { ret | | ODE_PURE_INLINE dReal dCalcVectorDot3_44 (const dReal *a, const dReal *b) { | |
| urn _dCalcVectorDot3(a,b,4,4); } | | return _dCalcVectorDot3(a,b,4,4); } | |
| | | | |
| /* | | /* | |
| * cross product, set res = a x b. _dCalcVectorCross3 means that elements o
f `res', `a' | | * cross product, set res = a x b. _dCalcVectorCross3 means that elements o
f `res', `a' | |
| * and `b' are spaced step_res, step_a and step_b indexes apart respectivel
y. | | * and `b' are spaced step_res, step_a and step_b indexes apart respectivel
y. | |
| * dCalcVectorCross3() means dCross3111. | | * dCalcVectorCross3() means dCross3111. | |
| */ | | */ | |
| | | | |
|
| PURE_INLINE void _dCalcVectorCross3(dReal *res, const dReal *a, const dReal
*b, unsigned step_res, unsigned step_a, unsigned step_b) | | ODE_PURE_INLINE void _dCalcVectorCross3(dReal *res, const dReal *a, const d
Real *b, unsigned step_res, unsigned step_a, unsigned step_b) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = a[ step_a]*b[2*step_b] - a[2*step_a]*b[ step_b]; | |
| res_0 = a[ step_a]*b[2*step_b] - a[2*step_a]*b[ step_b]; | | const dReal res_1 = a[2*step_a]*b[ 0] - a[ 0]*b[2*step_b]; | |
| res_1 = a[2*step_a]*b[ 0] - a[ 0]*b[2*step_b]; | | const dReal res_2 = a[ 0]*b[ step_b] - a[ step_a]*b[ 0]; | |
| res_2 = a[ 0]*b[ step_b] - a[ step_a]*b[ 0]; | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[ 0] = res_0; | | res[ 0] = res_0; | |
| res[ step_res] = res_1; | | res[ step_res] = res_1; | |
| res[2*step_res] = res_2; | | res[2*step_res] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dCalcVectorCross3 (dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3 (dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 1, 1, 1); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 1, 1, 1); } | |
| PURE_INLINE void dCalcVectorCross3_114(dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3_114(dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 1, 1, 4); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 1, 1, 4); } | |
| PURE_INLINE void dCalcVectorCross3_141(dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3_141(dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 1, 4, 1); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 1, 4, 1); } | |
| PURE_INLINE void dCalcVectorCross3_144(dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3_144(dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 1, 4, 4); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 1, 4, 4); } | |
| PURE_INLINE void dCalcVectorCross3_411(dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3_411(dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 4, 1, 1); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 4, 1, 1); } | |
| PURE_INLINE void dCalcVectorCross3_414(dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3_414(dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 4, 1, 4); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 4, 1, 4); } | |
| PURE_INLINE void dCalcVectorCross3_441(dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3_441(dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 4, 4, 1); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 4, 4, 1); } | |
| PURE_INLINE void dCalcVectorCross3_444(dReal *res, const dReal *a, const dR | | ODE_PURE_INLINE void dCalcVectorCross3_444(dReal *res, const dReal *a, cons | |
| eal *b) { _dCalcVectorCross3(res, a, b, 4, 4, 4); } | | t dReal *b) { _dCalcVectorCross3(res, a, b, 4, 4, 4); } | |
| | | | |
|
| PURE_INLINE void dAddVectorCross3(dReal *res, const dReal *a, const dReal *
b) | | ODE_PURE_INLINE void dAddVectorCross3(dReal *res, const dReal *a, const dRe
al *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dCalcVectorCross3(tmp, a, b); | | dCalcVectorCross3(tmp, a, b); | |
| dAddVectors3(res, res, tmp); | | dAddVectors3(res, res, tmp); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dSubtractVectorCross3(dReal *res, const dReal *a, const dR
eal *b) | | ODE_PURE_INLINE void dSubtractVectorCross3(dReal *res, const dReal *a, cons
t dReal *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dCalcVectorCross3(tmp, a, b); | | dCalcVectorCross3(tmp, a, b); | |
| dSubtractVectors3(res, res, tmp); | | dSubtractVectors3(res, res, tmp); | |
| } | | } | |
| | | | |
| /* | | /* | |
| * set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b. | | * set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b. | |
| * A is stored by rows, and has `skip' elements per row. the matrix is | | * A is stored by rows, and has `skip' elements per row. the matrix is | |
| * assumed to be already zero, so this does not write zero elements! | | * assumed to be already zero, so this does not write zero elements! | |
| * if (plus,minus) is (+,-) then a positive version will be written. | | * if (plus,minus) is (+,-) then a positive version will be written. | |
| * if (plus,minus) is (-,+) then a negative version will be written. | | * if (plus,minus) is (-,+) then a negative version will be written. | |
| */ | | */ | |
| | | | |
|
| PURE_INLINE void dSetCrossMatrixPlus(dReal *res, const dReal *a, unsigned s
kip) | | ODE_PURE_INLINE void dSetCrossMatrixPlus(dReal *res, const dReal *a, unsign
ed skip) | |
| { | | { | |
| const dReal a_0 = a[0], a_1 = a[1], a_2 = a[2]; | | const dReal a_0 = a[0], a_1 = a[1], a_2 = a[2]; | |
| res[1] = -a_2; | | res[1] = -a_2; | |
| res[2] = +a_1; | | res[2] = +a_1; | |
| res[skip+0] = +a_2; | | res[skip+0] = +a_2; | |
| res[skip+2] = -a_0; | | res[skip+2] = -a_0; | |
| res[2*skip+0] = -a_1; | | res[2*skip+0] = -a_1; | |
| res[2*skip+1] = +a_0; | | res[2*skip+1] = +a_0; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dSetCrossMatrixMinus(dReal *res, const dReal *a, unsigned
skip) | | ODE_PURE_INLINE void dSetCrossMatrixMinus(dReal *res, const dReal *a, unsig
ned skip) | |
| { | | { | |
| const dReal a_0 = a[0], a_1 = a[1], a_2 = a[2]; | | const dReal a_0 = a[0], a_1 = a[1], a_2 = a[2]; | |
| res[1] = +a_2; | | res[1] = +a_2; | |
| res[2] = -a_1; | | res[2] = -a_1; | |
| res[skip+0] = -a_2; | | res[skip+0] = -a_2; | |
| res[skip+2] = +a_0; | | res[skip+2] = +a_0; | |
| res[2*skip+0] = +a_1; | | res[2*skip+0] = +a_1; | |
| res[2*skip+1] = -a_0; | | res[2*skip+1] = -a_0; | |
| } | | } | |
| | | | |
| /* | | /* | |
| * compute the distance between two 3D-vectors | | * compute the distance between two 3D-vectors | |
| */ | | */ | |
| | | | |
|
| PURE_INLINE dReal dCalcPointsDistance3(const dReal *a, const dReal *b) | | ODE_PURE_INLINE dReal dCalcPointsDistance3(const dReal *a, const dReal *b) | |
| { | | { | |
| dReal res; | | dReal res; | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dSubtractVectors3(tmp, a, b); | | dSubtractVectors3(tmp, a, b); | |
| res = dCalcVectorLength3(tmp); | | res = dCalcVectorLength3(tmp); | |
| return res; | | return res; | |
| } | | } | |
| | | | |
| /* | | /* | |
| * special case matrix multiplication, with operator selection | | * special case matrix multiplication, with operator selection | |
| */ | | */ | |
| | | | |
|
| PURE_INLINE void dMultiplyHelper0_331(dReal *res, const dReal *a, const dRe
al *b) | | ODE_PURE_INLINE void dMultiplyHelper0_331(dReal *res, const dReal *a, const
dReal *b) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = dCalcVectorDot3(a, b); | |
| res_0 = dCalcVectorDot3(a, b); | | const dReal res_1 = dCalcVectorDot3(a + 4, b); | |
| res_1 = dCalcVectorDot3(a + 4, b); | | const dReal res_2 = dCalcVectorDot3(a + 8, b); | |
| res_2 = dCalcVectorDot3(a + 8, b); | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyHelper1_331(dReal *res, const dReal *a, const dRe
al *b) | | ODE_PURE_INLINE void dMultiplyHelper1_331(dReal *res, const dReal *a, const
dReal *b) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = dCalcVectorDot3_41(a, b); | |
| res_0 = dCalcVectorDot3_41(a, b); | | const dReal res_1 = dCalcVectorDot3_41(a + 1, b); | |
| res_1 = dCalcVectorDot3_41(a + 1, b); | | const dReal res_2 = dCalcVectorDot3_41(a + 2, b); | |
| res_2 = dCalcVectorDot3_41(a + 2, b); | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyHelper0_133(dReal *res, const dReal *a, const dRe
al *b) | | ODE_PURE_INLINE void dMultiplyHelper0_133(dReal *res, const dReal *a, const
dReal *b) | |
| { | | { | |
| dMultiplyHelper1_331(res, b, a); | | dMultiplyHelper1_331(res, b, a); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyHelper1_133(dReal *res, const dReal *a, const dRe
al *b) | | ODE_PURE_INLINE void dMultiplyHelper1_133(dReal *res, const dReal *a, const
dReal *b) | |
| { | | { | |
|
| dReal res_0, res_1, res_2; | | const dReal res_0 = dCalcVectorDot3_44(a, b); | |
| res_0 = dCalcVectorDot3_44(a, b); | | const dReal res_1 = dCalcVectorDot3_44(a + 1, b); | |
| res_1 = dCalcVectorDot3_44(a + 1, b); | | const dReal res_2 = dCalcVectorDot3_44(a + 2, b); | |
| res_2 = dCalcVectorDot3_44(a + 2, b); | | /* Only assign after all the calculations are over to avoid incurring mem | |
| // Only assign after all the calculations are over to avoid incurring mem | | ory aliasing*/ | |
| ory aliasing | | | |
| res[0] = res_0; res[1] = res_1; res[2] = res_2; | | res[0] = res_0; res[1] = res_1; res[2] = res_2; | |
| } | | } | |
| | | | |
| /* | | /* | |
| Note: NEVER call any of these functions/macros with the same variable for A
and C, | | Note: NEVER call any of these functions/macros with the same variable for A
and C, | |
| it is not equivalent to A*=B. | | it is not equivalent to A*=B. | |
| */ | | */ | |
| | | | |
|
| PURE_INLINE void dMultiply0_331(dReal *res, const dReal *a, const dReal *b) | | ODE_PURE_INLINE void dMultiply0_331(dReal *res, const dReal *a, const dReal
*b) | |
| { | | { | |
| dMultiplyHelper0_331(res, a, b); | | dMultiplyHelper0_331(res, a, b); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiply1_331(dReal *res, const dReal *a, const dReal *b) | | ODE_PURE_INLINE void dMultiply1_331(dReal *res, const dReal *a, const dReal
*b) | |
| { | | { | |
| dMultiplyHelper1_331(res, a, b); | | dMultiplyHelper1_331(res, a, b); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiply0_133(dReal *res, const dReal *a, const dReal *b) | | ODE_PURE_INLINE void dMultiply0_133(dReal *res, const dReal *a, const dReal
*b) | |
| { | | { | |
| dMultiplyHelper0_133(res, a, b); | | dMultiplyHelper0_133(res, a, b); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiply0_333(dReal *res, const dReal *a, const dReal *b) | | ODE_PURE_INLINE void dMultiply0_333(dReal *res, const dReal *a, const dReal
*b) | |
| { | | { | |
| dMultiplyHelper0_133(res + 0, a + 0, b); | | dMultiplyHelper0_133(res + 0, a + 0, b); | |
| dMultiplyHelper0_133(res + 4, a + 4, b); | | dMultiplyHelper0_133(res + 4, a + 4, b); | |
| dMultiplyHelper0_133(res + 8, a + 8, b); | | dMultiplyHelper0_133(res + 8, a + 8, b); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiply1_333(dReal *res, const dReal *a, const dReal *b) | | ODE_PURE_INLINE void dMultiply1_333(dReal *res, const dReal *a, const dReal
*b) | |
| { | | { | |
| dMultiplyHelper1_133(res + 0, b, a + 0); | | dMultiplyHelper1_133(res + 0, b, a + 0); | |
| dMultiplyHelper1_133(res + 4, b, a + 1); | | dMultiplyHelper1_133(res + 4, b, a + 1); | |
| dMultiplyHelper1_133(res + 8, b, a + 2); | | dMultiplyHelper1_133(res + 8, b, a + 2); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiply2_333(dReal *res, const dReal *a, const dReal *b) | | ODE_PURE_INLINE void dMultiply2_333(dReal *res, const dReal *a, const dReal
*b) | |
| { | | { | |
| dMultiplyHelper0_331(res + 0, b, a + 0); | | dMultiplyHelper0_331(res + 0, b, a + 0); | |
| dMultiplyHelper0_331(res + 4, b, a + 4); | | dMultiplyHelper0_331(res + 4, b, a + 4); | |
| dMultiplyHelper0_331(res + 8, b, a + 8); | | dMultiplyHelper0_331(res + 8, b, a + 8); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyAdd0_331(dReal *res, const dReal *a, const dReal
*b) | | ODE_PURE_INLINE void dMultiplyAdd0_331(dReal *res, const dReal *a, const dR
eal *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dMultiplyHelper0_331(tmp, a, b); | | dMultiplyHelper0_331(tmp, a, b); | |
| dAddVectors3(res, res, tmp); | | dAddVectors3(res, res, tmp); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyAdd1_331(dReal *res, const dReal *a, const dReal
*b) | | ODE_PURE_INLINE void dMultiplyAdd1_331(dReal *res, const dReal *a, const dR
eal *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dMultiplyHelper1_331(tmp, a, b); | | dMultiplyHelper1_331(tmp, a, b); | |
| dAddVectors3(res, res, tmp); | | dAddVectors3(res, res, tmp); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyAdd0_133(dReal *res, const dReal *a, const dReal
*b) | | ODE_PURE_INLINE void dMultiplyAdd0_133(dReal *res, const dReal *a, const dR
eal *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dMultiplyHelper0_133(tmp, a, b); | | dMultiplyHelper0_133(tmp, a, b); | |
| dAddVectors3(res, res, tmp); | | dAddVectors3(res, res, tmp); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyAdd0_333(dReal *res, const dReal *a, const dReal
*b) | | ODE_PURE_INLINE void dMultiplyAdd0_333(dReal *res, const dReal *a, const dR
eal *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dMultiplyHelper0_133(tmp, a + 0, b); | | dMultiplyHelper0_133(tmp, a + 0, b); | |
| dAddVectors3(res+ 0, res + 0, tmp); | | dAddVectors3(res+ 0, res + 0, tmp); | |
| dMultiplyHelper0_133(tmp, a + 4, b); | | dMultiplyHelper0_133(tmp, a + 4, b); | |
| dAddVectors3(res + 4, res + 4, tmp); | | dAddVectors3(res + 4, res + 4, tmp); | |
| dMultiplyHelper0_133(tmp, a + 8, b); | | dMultiplyHelper0_133(tmp, a + 8, b); | |
| dAddVectors3(res + 8, res + 8, tmp); | | dAddVectors3(res + 8, res + 8, tmp); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyAdd1_333(dReal *res, const dReal *a, const dReal
*b) | | ODE_PURE_INLINE void dMultiplyAdd1_333(dReal *res, const dReal *a, const dR
eal *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dMultiplyHelper1_133(tmp, b, a + 0); | | dMultiplyHelper1_133(tmp, b, a + 0); | |
| dAddVectors3(res + 0, res + 0, tmp); | | dAddVectors3(res + 0, res + 0, tmp); | |
| dMultiplyHelper1_133(tmp, b, a + 1); | | dMultiplyHelper1_133(tmp, b, a + 1); | |
| dAddVectors3(res + 4, res + 4, tmp); | | dAddVectors3(res + 4, res + 4, tmp); | |
| dMultiplyHelper1_133(tmp, b, a + 2); | | dMultiplyHelper1_133(tmp, b, a + 2); | |
| dAddVectors3(res + 8, res + 8, tmp); | | dAddVectors3(res + 8, res + 8, tmp); | |
| } | | } | |
| | | | |
|
| PURE_INLINE void dMultiplyAdd2_333(dReal *res, const dReal *a, const dReal
*b) | | ODE_PURE_INLINE void dMultiplyAdd2_333(dReal *res, const dReal *a, const dR
eal *b) | |
| { | | { | |
| dReal tmp[3]; | | dReal tmp[3]; | |
| dMultiplyHelper0_331(tmp, b, a + 0); | | dMultiplyHelper0_331(tmp, b, a + 0); | |
| dAddVectors3(res + 0, res + 0, tmp); | | dAddVectors3(res + 0, res + 0, tmp); | |
| dMultiplyHelper0_331(tmp, b, a + 4); | | dMultiplyHelper0_331(tmp, b, a + 4); | |
| dAddVectors3(res + 4, res + 4, tmp); | | dAddVectors3(res + 4, res + 4, tmp); | |
| dMultiplyHelper0_331(tmp, b, a + 8); | | dMultiplyHelper0_331(tmp, b, a + 8); | |
| dAddVectors3(res + 8, res + 8, tmp); | | dAddVectors3(res + 8, res + 8, tmp); | |
| } | | } | |
| | | | |
|
| // Include legacy macros here | | ODE_PURE_INLINE dReal dCalcMatrix3Det( const dReal* mat ) | |
| | | { | |
| | | dReal det; | |
| | | | |
| | | det = mat[0] * ( mat[5]*mat[10] - mat[9]*mat[6] ) | |
| | | - mat[1] * ( mat[4]*mat[10] - mat[8]*mat[6] ) | |
| | | + mat[2] * ( mat[4]*mat[9] - mat[8]*mat[5] ); | |
| | | | |
| | | return( det ); | |
| | | } | |
| | | | |
| | | /** | |
| | | Closed form matrix inversion, copied from | |
| | | collision_util.h for use in the stepper. | |
| | | | |
| | | Returns the determinant. | |
| | | returns 0 and does nothing | |
| | | if the matrix is singular. | |
| | | */ | |
| | | ODE_PURE_INLINE dReal dInvertMatrix3(dReal *dst, const dReal *ma) | |
| | | { | |
| | | dReal det; | |
| | | dReal detRecip; | |
| | | | |
| | | det = dCalcMatrix3Det( ma ); | |
| | | | |
| | | /* Setting an arbitrary non-zero threshold | |
| | | for the determinant doesn't do anyone | |
| | | any favors. The condition number is the | |
| | | important thing. If all the eigen-values | |
| | | of the matrix are small, so is the | |
| | | determinant, but it can still be well | |
| | | conditioned. | |
| | | A single extremely large eigen-value could | |
| | | push the determinant over threshold, but | |
| | | produce a very unstable result if the other | |
| | | eigen-values are small. So we just say that | |
| | | the determinant must be non-zero and trust the | |
| | | caller to provide well-conditioned matrices. | |
| | | */ | |
| | | if ( det == 0 ) | |
| | | { | |
| | | return 0; | |
| | | } | |
| | | | |
| | | detRecip = dRecip(det); | |
| | | | |
| | | dst[0] = ( ma[5]*ma[10] - ma[6]*ma[9] ) * detRecip; | |
| | | dst[1] = ( ma[9]*ma[2] - ma[1]*ma[10] ) * detRecip; | |
| | | dst[2] = ( ma[1]*ma[6] - ma[5]*ma[2] ) * detRecip; | |
| | | | |
| | | dst[4] = ( ma[6]*ma[8] - ma[4]*ma[10] ) * detRecip; | |
| | | dst[5] = ( ma[0]*ma[10] - ma[8]*ma[2] ) * detRecip; | |
| | | dst[6] = ( ma[4]*ma[2] - ma[0]*ma[6] ) * detRecip; | |
| | | | |
| | | dst[8] = ( ma[4]*ma[9] - ma[8]*ma[5] ) * detRecip; | |
| | | dst[9] = ( ma[8]*ma[1] - ma[0]*ma[9] ) * detRecip; | |
| | | dst[10] = ( ma[0]*ma[5] - ma[1]*ma[4] ) * detRecip; | |
| | | | |
| | | return det; | |
| | | } | |
| | | | |
| | | /* Include legacy macros here */ | |
| #include <ode/odemath_legacy.h> | | #include <ode/odemath_legacy.h> | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| * normalize 3x1 and 4x1 vectors (i.e. scale them to unit length) | | * normalize 3x1 and 4x1 vectors (i.e. scale them to unit length) | |
| */ | | */ | |
| | | | |
|
| // For DLL export | | /* For DLL export*/ | |
| ODE_API int dSafeNormalize3 (dVector3 a); | | ODE_API int dSafeNormalize3 (dVector3 a); | |
| ODE_API int dSafeNormalize4 (dVector4 a); | | ODE_API int dSafeNormalize4 (dVector4 a); | |
|
| ODE_API void dNormalize3 (dVector3 a); // Potentially asserts on zero vec | | ODE_API void dNormalize3 (dVector3 a); /* Potentially asserts on zero vec*/ | |
| ODE_API void dNormalize4 (dVector4 a); // Potentially asserts on zero vec | | ODE_API void dNormalize4 (dVector4 a); /* Potentially asserts on zero vec*/ | |
| | | | |
| #if defined(__ODE__) | | | |
| | | | |
| int _dSafeNormalize3 (dVector3 a); | | | |
| int _dSafeNormalize4 (dVector4 a); | | | |
| | | | |
| PURE_INLINE void _dNormalize3(dVector3 a) | | | |
| { | | | |
| int bNormalizationResult = _dSafeNormalize3(a); | | | |
| dIVERIFY(bNormalizationResult); | | | |
| } | | | |
| | | | |
| PURE_INLINE void _dNormalize4(dVector4 a) | | | |
| { | | | |
| int bNormalizationResult = _dSafeNormalize4(a); | | | |
| dIVERIFY(bNormalizationResult); | | | |
| } | | | |
| | | | |
| // For internal use | | | |
| #define dSafeNormalize3(a) _dSafeNormalize3(a) | | | |
| #define dSafeNormalize4(a) _dSafeNormalize4(a) | | | |
| #define dNormalize3(a) _dNormalize3(a) | | | |
| #define dNormalize4(a) _dNormalize4(a) | | | |
| | | | |
| #endif // defined(__ODE__) | | | |
| | | | |
| /* | | /* | |
| * given a unit length "normal" vector n, generate vectors p and q vectors | | * given a unit length "normal" vector n, generate vectors p and q vectors | |
| * that are an orthonormal basis for the plane space perpendicular to n. | | * that are an orthonormal basis for the plane space perpendicular to n. | |
| * i.e. this makes p,q such that n,p,q are all perpendicular to each other. | | * i.e. this makes p,q such that n,p,q are all perpendicular to each other. | |
| * q will equal n x p. if n is not unit length then p will be unit length b
ut | | * q will equal n x p. if n is not unit length then p will be unit length b
ut | |
| * q wont be. | | * q wont be. | |
| */ | | */ | |
| | | | |
| ODE_API void dPlaneSpace (const dVector3 n, dVector3 p, dVector3 q); | | ODE_API void dPlaneSpace (const dVector3 n, dVector3 p, dVector3 q); | |
| | | | |
End of changes. 55 change blocks. |
| 171 lines changed or deleted | | 197 lines changed or added | |
|
| odemath_legacy.h | | odemath_legacy.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * This library is distributed in the hope that it will be useful, * | | * This library is distributed in the hope that it will be useful, * | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of * | | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * | |
| * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | | * LICENSE.TXT and LICENSE-BSD.TXT for more details. * | |
| * * | | * * | |
| *************************************************************************/ | | *************************************************************************/ | |
| | | | |
| #ifndef _ODE_ODEMATH_LEGACY_H_ | | #ifndef _ODE_ODEMATH_LEGACY_H_ | |
| #define _ODE_ODEMATH_LEGACY_H_ | | #define _ODE_ODEMATH_LEGACY_H_ | |
| | | | |
|
| /////////////////////////////////////////////////////////////////////////// | | /* | |
| //// | | * These macros are not used any more inside of ODE | |
| /////////////////////////////////////////////////////////////////////////// | | * They are kept for backward compatibility with external code that | |
| //// | | * might still be using them. | |
| /////////////////////////////////////////////////////////////////////////// | | */ | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /* | | | |
| * These macros are not used any more inside of ODE | | | |
| * They are kept for backward compatibility with external code that | | | |
| * might still be using them. | | | |
| */ | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| | | | |
| /* | | /* | |
|
| * General purpose vector operations with other vectors or constants. | | * General purpose vector operations with other vectors or constants. | |
| */ | | */ | |
| | | | |
| #define dOP(a,op,b,c) do { \ | | #define dOP(a,op,b,c) do { \ | |
| (a)[0] = ((b)[0]) op ((c)[0]); \ | | (a)[0] = ((b)[0]) op ((c)[0]); \ | |
| (a)[1] = ((b)[1]) op ((c)[1]); \ | | (a)[1] = ((b)[1]) op ((c)[1]); \ | |
| (a)[2] = ((b)[2]) op ((c)[2]); \ | | (a)[2] = ((b)[2]) op ((c)[2]); \ | |
| } while (0) | | } while (0) | |
| #define dOPC(a,op,b,c) do { \ | | #define dOPC(a,op,b,c) do { \ | |
| (a)[0] = ((b)[0]) op (c); \ | | (a)[0] = ((b)[0]) op (c); \ | |
| (a)[1] = ((b)[1]) op (c); \ | | (a)[1] = ((b)[1]) op (c); \ | |
| (a)[2] = ((b)[2]) op (c); \ | | (a)[2] = ((b)[2]) op (c); \ | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 57 | |
| (a)[0] op ((b)[0]); \ | | (a)[0] op ((b)[0]); \ | |
| (a)[1] op ((b)[1]); \ | | (a)[1] op ((b)[1]); \ | |
| (a)[2] op ((b)[2]); \ | | (a)[2] op ((b)[2]); \ | |
| } while (0) | | } while (0) | |
| #define dOPEC(a,op,c) do { \ | | #define dOPEC(a,op,c) do { \ | |
| (a)[0] op (c); \ | | (a)[0] op (c); \ | |
| (a)[1] op (c); \ | | (a)[1] op (c); \ | |
| (a)[2] op (c); \ | | (a)[2] op (c); \ | |
| } while (0) | | } while (0) | |
| | | | |
|
| /// Define an equation with operators | | /* Define an equation with operators | |
| /// For example this function can be used to replace | | * For example this function can be used to replace | |
| /// <PRE> | | * <PRE> | |
| /// for (int i=0; i<3; ++i) | | * for (int i=0; i<3; ++i) | |
| /// a[i] += b[i] + c[i]; | | * a[i] += b[i] + c[i]; | |
| /// </PRE> | | * </PRE> | |
| | | */ | |
| #define dOPE2(a,op1,b,op2,c) do { \ | | #define dOPE2(a,op1,b,op2,c) do { \ | |
| (a)[0] op1 ((b)[0]) op2 ((c)[0]); \ | | (a)[0] op1 ((b)[0]) op2 ((c)[0]); \ | |
| (a)[1] op1 ((b)[1]) op2 ((c)[1]); \ | | (a)[1] op1 ((b)[1]) op2 ((c)[1]); \ | |
| (a)[2] op1 ((b)[2]) op2 ((c)[2]); \ | | (a)[2] op1 ((b)[2]) op2 ((c)[2]); \ | |
| } while (0) | | } while (0) | |
| | | | |
| #define dLENGTHSQUARED(a) dCalcVectorLengthSquare3(a) | | #define dLENGTHSQUARED(a) dCalcVectorLengthSquare3(a) | |
| #define dLENGTH(a) dCalcVectorLength3(a) | | #define dLENGTH(a) dCalcVectorLength3(a) | |
| #define dDISTANCE(a, b) dCalcPointsDistance3(a, b) | | #define dDISTANCE(a, b) dCalcPointsDistance3(a, b) | |
| | | | |
| #define dDOT(a, b) dCalcVectorDot3(a, b) | | #define dDOT(a, b) dCalcVectorDot3(a, b) | |
| #define dDOT13(a, b) dCalcVectorDot3_13(a, b) | | #define dDOT13(a, b) dCalcVectorDot3_13(a, b) | |
| #define dDOT31(a, b) dCalcVectorDot3_31(a, b) | | #define dDOT31(a, b) dCalcVectorDot3_31(a, b) | |
| #define dDOT33(a, b) dCalcVectorDot3_33(a, b) | | #define dDOT33(a, b) dCalcVectorDot3_33(a, b) | |
| #define dDOT14(a, b) dCalcVectorDot3_14(a, b) | | #define dDOT14(a, b) dCalcVectorDot3_14(a, b) | |
| #define dDOT41(a, b) dCalcVectorDot3_41(a, b) | | #define dDOT41(a, b) dCalcVectorDot3_41(a, b) | |
| #define dDOT44(a, b) dCalcVectorDot3_44(a, b) | | #define dDOT44(a, b) dCalcVectorDot3_44(a, b) | |
| | | | |
| /* | | /* | |
|
| * cross product, set a = b x c. dCROSSpqr means that elements of `a', `b' | | * cross product, set a = b x c. dCROSSpqr means that elements of `a', `b' | |
| * and `c' are spaced p, q and r indexes apart respectively. | | * and `c' are spaced p, q and r indexes apart respectively. | |
| * dCROSS() means dCROSS111. `op' is normally `=', but you can set it to | | * dCROSS() means dCROSS111. `op' is normally `=', but you can set it to | |
| * +=, -= etc to get other effects. | | * +=, -= etc to get other effects. | |
| */ | | */ | |
| | | | |
| #define dCROSS(a,op,b,c) \ | | #define dCROSS(a,op,b,c) \ | |
| do { \ | | do { \ | |
| (a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \ | | (a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \ | |
| (a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \ | | (a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \ | |
| (a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]); \ | | (a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]); \ | |
| } while(0) | | } while(0) | |
| #define dCROSSpqr(a,op,b,c,p,q,r) \ | | #define dCROSSpqr(a,op,b,c,p,q,r) \ | |
| do { \ | | do { \ | |
| (a)[ 0] op ((b)[ q]*(c)[2*r] - (b)[2*q]*(c)[ r]); \ | | (a)[ 0] op ((b)[ q]*(c)[2*r] - (b)[2*q]*(c)[ r]); \ | |
| | | | |
| skipping to change at line 155 | | skipping to change at line 146 | |
| #define dMULTIPLY1_333(A, B, C) dMultiply1_333(A, B, C) | | #define dMULTIPLY1_333(A, B, C) dMultiply1_333(A, B, C) | |
| #define dMULTIPLY2_333(A, B, C) dMultiply2_333(A, B, C) | | #define dMULTIPLY2_333(A, B, C) dMultiply2_333(A, B, C) | |
| | | | |
| #define dMULTIPLYADD0_331(A, B, C) dMultiplyAdd0_331(A, B, C) | | #define dMULTIPLYADD0_331(A, B, C) dMultiplyAdd0_331(A, B, C) | |
| #define dMULTIPLYADD1_331(A, B, C) dMultiplyAdd1_331(A, B, C) | | #define dMULTIPLYADD1_331(A, B, C) dMultiplyAdd1_331(A, B, C) | |
| #define dMULTIPLYADD0_133(A, B, C) dMultiplyAdd0_133(A, B, C) | | #define dMULTIPLYADD0_133(A, B, C) dMultiplyAdd0_133(A, B, C) | |
| #define dMULTIPLYADD0_333(A, B, C) dMultiplyAdd0_333(A, B, C) | | #define dMULTIPLYADD0_333(A, B, C) dMultiplyAdd0_333(A, B, C) | |
| #define dMULTIPLYADD1_333(A, B, C) dMultiplyAdd1_333(A, B, C) | | #define dMULTIPLYADD1_333(A, B, C) dMultiplyAdd1_333(A, B, C) | |
| #define dMULTIPLYADD2_333(A, B, C) dMultiplyAdd2_333(A, B, C) | | #define dMULTIPLYADD2_333(A, B, C) dMultiplyAdd2_333(A, B, C) | |
| | | | |
|
| /////////////////////////////////////////////////////////////////////////// | | /* | |
| //// | | * These macros are not used any more inside of ODE | |
| /////////////////////////////////////////////////////////////////////////// | | * They are kept for backward compatibility with external code that | |
| //// | | * might still be using them. | |
| /////////////////////////////////////////////////////////////////////////// | | */ | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /* | | | |
| * These macros are not used any more inside of ODE | | | |
| * They are kept for backward compatibility with external code that | | | |
| * might still be using them. | | | |
| */ | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| /////////////////////////////////////////////////////////////////////////// | | | |
| //// | | | |
| | | | |
|
| #endif // #ifndef _ODE_ODEMATH_LEGACY_H_ | | #endif /* #ifndef _ODE_ODEMATH_LEGACY_H_ */ | |
| | | | |
End of changes. 6 change blocks. |
| 63 lines changed or deleted | | 24 lines changed or added | |
|