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


 collision_space.h   collision_space.h 
skipping to change at line 55 skipping to change at line 55
* that those pairs should not interact. * that those pairs should not interact.
* *
* @ingroup collide * @ingroup collide
*/ */
typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2); typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2);
ODE_API dSpaceID dSimpleSpaceCreate (dSpaceID space); ODE_API dSpaceID dSimpleSpaceCreate (dSpaceID space);
ODE_API dSpaceID dHashSpaceCreate (dSpaceID space); ODE_API dSpaceID dHashSpaceCreate (dSpaceID space);
ODE_API dSpaceID dQuadTreeSpaceCreate (dSpaceID space, const dVector3 Cente r, const dVector3 Extents, int Depth); ODE_API dSpaceID dQuadTreeSpaceCreate (dSpaceID space, const dVector3 Cente r, const dVector3 Extents, int Depth);
// SAP /* SAP */
// Order XZY or ZXY usually works best, if your Y is up. /* Order XZY or ZXY usually works best, if your Y is up. */
#define dSAP_AXES_XYZ ((0)|(1<<2)|(2<<4)) #define dSAP_AXES_XYZ ((0)|(1<<2)|(2<<4))
#define dSAP_AXES_XZY ((0)|(2<<2)|(1<<4)) #define dSAP_AXES_XZY ((0)|(2<<2)|(1<<4))
#define dSAP_AXES_YXZ ((1)|(0<<2)|(2<<4)) #define dSAP_AXES_YXZ ((1)|(0<<2)|(2<<4))
#define dSAP_AXES_YZX ((1)|(2<<2)|(0<<4)) #define dSAP_AXES_YZX ((1)|(2<<2)|(0<<4))
#define dSAP_AXES_ZXY ((2)|(0<<2)|(1<<4)) #define dSAP_AXES_ZXY ((2)|(0<<2)|(1<<4))
#define dSAP_AXES_ZYX ((2)|(1<<2)|(0<<4)) #define dSAP_AXES_ZYX ((2)|(1<<2)|(0<<4))
ODE_API dSpaceID dSweepAndPruneSpaceCreate( dSpaceID space, int axisorder ) ; ODE_API dSpaceID dSweepAndPruneSpaceCreate( dSpaceID space, int axisorder ) ;
ODE_API void dSpaceDestroy (dSpaceID); ODE_API void dSpaceDestroy (dSpaceID);
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 collision_trimesh.h   collision_trimesh.h 
skipping to change at line 153 skipping to change at line 153
/* /*
* Trimesh class * Trimesh class
* Construction. Callbacks are optional. * Construction. Callbacks are optional.
*/ */
ODE_API dGeomID dCreateTriMesh(dSpaceID space, dTriMeshDataID Data, dTriCal lback* Callback, dTriArrayCallback* ArrayCallback, dTriRayCallback* RayCall back); ODE_API dGeomID dCreateTriMesh(dSpaceID space, dTriMeshDataID Data, dTriCal lback* Callback, dTriArrayCallback* ArrayCallback, dTriRayCallback* RayCall back);
ODE_API void dGeomTriMeshSetData(dGeomID g, dTriMeshDataID Data); ODE_API void dGeomTriMeshSetData(dGeomID g, dTriMeshDataID Data);
ODE_API dTriMeshDataID dGeomTriMeshGetData(dGeomID g); ODE_API dTriMeshDataID dGeomTriMeshGetData(dGeomID g);
// enable/disable/check temporal coherence /* enable/disable/check temporal coherence*/
ODE_API void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable); ODE_API void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable);
ODE_API int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass); ODE_API int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass);
/* /*
* Clears the internal temporal coherence caches. When a geom has its * Clears the internal temporal coherence caches. When a geom has its
* collision checked with a trimesh once, data is stored inside the trimesh . * collision checked with a trimesh once, data is stored inside the trimesh .
* With large worlds with lots of seperate objects this list could get huge . * With large worlds with lots of seperate objects this list could get huge .
* We should be able to do this automagically. * We should be able to do this automagically.
*/ */
ODE_API void dGeomTriMeshClearTCCache(dGeomID g); ODE_API void dGeomTriMeshClearTCCache(dGeomID g);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 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


 contact.h   contact.h 
skipping to change at line 33 skipping to change at line 33
#ifndef _ODE_CONTACT_H_ #ifndef _ODE_CONTACT_H_
#define _ODE_CONTACT_H_ #define _ODE_CONTACT_H_
#include <ode/common.h> #include <ode/common.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
enum { enum {
dContactMu2 = 0x001, dContactMu2 = 0x001, /**< Use axis dependent friction */
dContactFDir1 = 0x002, dContactAxisDep = 0x001, /**< Same as above */
dContactBounce = 0x004, dContactFDir1 = 0x002, /**< Use FDir for the first friction
dContactSoftERP = 0x008, value */
dContactSoftCFM = 0x010, dContactBounce = 0x004, /**< Restore collision energy anti-parallel
dContactMotion1 = 0x020, to the normal */
dContactMotion2 = 0x040, dContactSoftERP = 0x008, /**< Don't use global erp for penetration r
dContactMotionN = 0x080, eduction */
dContactSlip1 = 0x100, dContactSoftCFM = 0x010, /**< Don't use global cfm for penetration c
dContactSlip2 = 0x200, onstraint */
dContactMotion1 = 0x020, /**< Use a non-zero target velocity for the
dContactApprox0 = 0x0000, constraint */
dContactApprox1_1 = 0x1000, dContactMotion2 = 0x040,
dContactApprox1_2 = 0x2000, dContactMotionN = 0x080,
dContactApprox1 = 0x3000 dContactSlip1 = 0x100, /**< Force-dependent slip. */
dContactSlip2 = 0x200,
dContactRolling = 0x400, /**< Rolling/Angular friction */
dContactApprox0 = 0x0000,
dContactApprox1_1 = 0x1000,
dContactApprox1_2 = 0x2000,
dContactApprox1_N = 0x4000, /**< For rolling friction */
dContactApprox1 = 0x7000
}; };
typedef struct dSurfaceParameters { typedef struct dSurfaceParameters {
/* must always be defined */ /* must always be defined */
int mode; int mode;
dReal mu; dReal mu;
/* only defined if the corresponding flag is set in mode */ /* only defined if the corresponding flag is set in mode */
dReal mu2; dReal mu2;
dReal bounce; dReal rho; /**< Rolling friction */
dReal bounce_vel; dReal rho2;
dReal rhoN; /**< Spinning friction */
dReal bounce; /**< Coefficient of restitution */
dReal bounce_vel; /**< Bouncing threshold */
dReal soft_erp; dReal soft_erp;
dReal soft_cfm; dReal soft_cfm;
dReal motion1,motion2,motionN; dReal motion1,motion2,motionN;
dReal slip1,slip2; dReal slip1,slip2;
} dSurfaceParameters; } dSurfaceParameters;
/** /**
* @brief Describe the contact point between two geoms. * @brief Describe the contact point between two geoms.
* *
* If two bodies touch, or if a body touches a static feature in its * If two bodies touch, or if a body touches a static feature in its
skipping to change at line 80 skipping to change at line 86
* points", described by dContactGeom. * points", described by dContactGeom.
* *
* The convention is that if body 1 is moved along the normal vector by * The convention is that if body 1 is moved along the normal vector by
* a distance depth (or equivalently if body 2 is moved the same distance * a distance depth (or equivalently if body 2 is moved the same distance
* in the opposite direction) then the contact depth will be reduced to * in the opposite direction) then the contact depth will be reduced to
* zero. This means that the normal vector points "in" to body 1. * zero. This means that the normal vector points "in" to body 1.
* *
* @ingroup collide * @ingroup collide
*/ */
typedef struct dContactGeom { typedef struct dContactGeom {
dVector3 pos; ///< contact position dVector3 pos; /*< contact position*/
dVector3 normal; ///< normal vector dVector3 normal; /*< normal vector*/
dReal depth; ///< penetration depth dReal depth; /*< penetration depth*/
dGeomID g1,g2; ///< the colliding geoms dGeomID g1,g2; /*< the colliding geoms*/
int side1,side2; ///< (to be documented) int side1,side2; /*< (to be documented)*/
} dContactGeom; } dContactGeom;
/* contact info used by contact joint */ /* contact info used by contact joint */
typedef struct dContact { typedef struct dContact {
dSurfaceParameters surface; dSurfaceParameters surface;
dContactGeom geom; dContactGeom geom;
dVector3 fdir1; dVector3 fdir1;
} dContact; } dContact;
 End of changes. 4 change blocks. 
23 lines changed or deleted 34 lines changed or added


 mass.h   mass.h 
skipping to change at line 82 skipping to change at line 82
ODE_API void dMassSetTrimeshTotal (dMass *m, dReal total_mass, dGeomID g); ODE_API void dMassSetTrimeshTotal (dMass *m, dReal total_mass, dGeomID g);
ODE_API void dMassAdjust (dMass *, dReal newmass); ODE_API void dMassAdjust (dMass *, dReal newmass);
ODE_API void dMassTranslate (dMass *, dReal x, dReal y, dReal z); ODE_API void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
ODE_API void dMassRotate (dMass *, const dMatrix3 R); ODE_API void dMassRotate (dMass *, const dMatrix3 R);
ODE_API void dMassAdd (dMass *a, const dMass *b); ODE_API void dMassAdd (dMass *a, const dMass *b);
// Backwards compatible API /* Backwards compatible API */
ODE_API ODE_API_DEPRECATED void dMassSetCappedCylinder(dMass *a, dReal b, i nt c, dReal d, dReal e); ODE_API ODE_API_DEPRECATED void dMassSetCappedCylinder(dMass *a, dReal b, i nt c, dReal d, dReal e);
ODE_API ODE_API_DEPRECATED void dMassSetCappedCylinderTotal(dMass *a, dReal b, int c, dReal d, dReal e); ODE_API ODE_API_DEPRECATED void dMassSetCappedCylinderTotal(dMass *a, dReal b, int c, dReal d, dReal e);
struct dMass { struct dMass {
dReal mass; dReal mass;
dVector3 c; dVector3 c;
dMatrix3 I; dMatrix3 I;
#ifdef __cplusplus #ifdef __cplusplus
dMass() dMass()
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 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


 misc.h   misc.h 
skipping to change at line 56 skipping to change at line 56
/* return a random integer between 0..n-1. the distribution will get worse /* return a random integer between 0..n-1. the distribution will get worse
* as n approaches 2^32. * as n approaches 2^32.
*/ */
ODE_API int dRandInt (int n); ODE_API int dRandInt (int n);
/* return a random real number between 0..1 */ /* return a random real number between 0..1 */
ODE_API dReal dRandReal(void); ODE_API dReal dRandReal(void);
/* print out a matrix */ /* print out a matrix */
#ifdef __cplusplus #ifdef __cplusplus
ODE_API void dPrintMatrix (const dReal *A, int n, int m, char *fmt = "%10.4 f ", ODE_API void dPrintMatrix (const dReal *A, int n, int m, const char *fmt = "%10.4f ",
FILE *f=stdout); FILE *f=stdout);
#else #else
ODE_API void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f ); ODE_API void dPrintMatrix (const dReal *A, int n, int m, const char *fmt, F ILE *f);
#endif #endif
/* make a random vector with entries between +/- range. A has n elements. * / /* make a random vector with entries between +/- range. A has n elements. * /
ODE_API void dMakeRandomVector (dReal *A, int n, dReal range); ODE_API void dMakeRandomVector (dReal *A, int n, dReal range);
/* make a random matrix with entries between +/- range. A has size n*m. */ /* make a random matrix with entries between +/- range. A has size n*m. */
ODE_API void dMakeRandomMatrix (dReal *A, int n, int m, dReal range); ODE_API void dMakeRandomMatrix (dReal *A, int n, int m, dReal range);
/* clear the upper triangle of a square matrix */ /* clear the upper triangle of a square matrix */
ODE_API void dClearUpperTriangle (dReal *A, int n); ODE_API void dClearUpperTriangle (dReal *A, int n);
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 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


 ode.h   ode.h 
skipping to change at line 42 skipping to change at line 42
#include <ode/contact.h> #include <ode/contact.h>
#include <ode/error.h> #include <ode/error.h>
#include <ode/memory.h> #include <ode/memory.h>
#include <ode/odemath.h> #include <ode/odemath.h>
#include <ode/matrix.h> #include <ode/matrix.h>
#include <ode/timer.h> #include <ode/timer.h>
#include <ode/rotation.h> #include <ode/rotation.h>
#include <ode/mass.h> #include <ode/mass.h>
#include <ode/misc.h> #include <ode/misc.h>
#include <ode/objects.h> #include <ode/objects.h>
#include <ode/odecpp.h>
#include <ode/collision_space.h> #include <ode/collision_space.h>
#include <ode/collision.h> #include <ode/collision.h>
#include <ode/odecpp_collision.h> #include <ode/threading.h>
#include <ode/threading_impl.h>
#include <ode/export-dif.h> #include <ode/export-dif.h>
#ifdef __cplusplus
# include <ode/odecpp.h>
# include <ode/odecpp_collision.h>
#endif
#endif #endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 7 lines changed or added


 odeconfig.h   odeconfig.h 
#ifndef ODECONFIG_H /*************************************************************************
#define ODECONFIG_H * *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_ODECONFIG_H_
#define _ODE_ODECONFIG_H_
/* Pull in the standard headers */ /* Pull in the standard headers */
#include <stddef.h> #include <stddef.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <float.h> #include <float.h>
#include <ode/precision.h>
#if defined(ODE_DLL) || defined(ODE_LIB) #if defined(ODE_DLL) || defined(ODE_LIB)
#define __ODE__ #define __ODE__
#endif #endif
/* Define a DLL export symbol for those platforms that need it */ /* Define a DLL export symbol for those platforms that need it */
#if defined(_MSC_VER) #if defined(_MSC_VER) || (defined(__GNUC__) && defined(_WIN32))
#if defined(ODE_DLL) #if defined(ODE_DLL)
#define ODE_API __declspec(dllexport) #define ODE_API __declspec(dllexport)
#elif !defined(ODE_LIB) #elif !defined(ODE_LIB)
#define ODE_DLL_API __declspec(dllimport) #define ODE_DLL_API __declspec(dllimport)
#endif #endif
#endif #endif
#if !defined(ODE_API) #if !defined(ODE_API)
#define ODE_API #define ODE_API
#endif #endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
# define ODE_API_DEPRECATED __declspec(deprecated) # define ODE_API_DEPRECATED __declspec(deprecated)
#elif defined (__GNUC__) && ( (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC _MINOR__ >= 1)) ) #elif defined (__GNUC__) && ( (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC _MINOR__ >= 1)) )
# define ODE_API_DEPRECATED __attribute__((__deprecated__)) # define ODE_API_DEPRECATED __attribute__((__deprecated__))
#else #else
# define ODE_API_DEPRECATED # define ODE_API_DEPRECATED
#endif #endif
#define ODE_PURE_INLINE static __inline
#define ODE_INLINE __inline
#if defined(__cplusplus)
#define ODE_EXTERN_C extern "C"
#else
#define ODE_EXTERN_C
#endif
/* Well-defined common data types...need to define for 64 bit systems */ /* Well-defined common data types...need to define for 64 bit systems */
#if defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(_ _x86_64__) #if defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(_ _x86_64__)
#define X86_64_SYSTEM 1 #define X86_64_SYSTEM 1
typedef int int32; #if defined(_MSC_VER)
typedef unsigned int uint32; typedef __int64 dint64;
typedef short int16; typedef unsigned __int64 duint64;
typedef unsigned short uint16; #else
typedef signed char int8; typedef long long dint64;
typedef unsigned char uint8; typedef unsigned long long duint64;
#else
typedef int int32;
typedef unsigned int uint32;
typedef short int16;
typedef unsigned short uint16;
typedef signed char int8;
typedef unsigned char uint8;
#endif #endif
typedef int dint32;
/* Visual C does not define these functions */ typedef unsigned int duint32;
typedef short dint16;
typedef unsigned short duint16;
typedef signed char dint8;
typedef unsigned char duint8;
#else
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define copysignf(x, y) ((float)_copysign(x, y)) typedef __int64 dint64;
#define copysign(x, y) _copysign(x, y) typedef unsigned __int64 duint64;
#define nextafterf(x, y) _nextafterf(x, y) #else
#define nextafter(x, y) _nextafter(x, y) typedef long long dint64;
#if !defined(_WIN64) typedef unsigned long long duint64;
#define _ODE__NEXTAFTERF_REQUIRED #endif
#endif typedef int dint32;
typedef unsigned int duint32;
typedef short dint16;
typedef unsigned short duint16;
typedef signed char dint8;
typedef unsigned char duint8;
#endif #endif
/* Define the dInfinity macro */ /* Define the dInfinity macro */
#ifdef INFINITY #ifdef INFINITY
#define dInfinity INFINITY #ifdef dSINGLE
#define dInfinity ((float)INFINITY)
#else
#define dInfinity ((double)INFINITY)
#endif
#elif defined(HUGE_VAL) #elif defined(HUGE_VAL)
#ifdef dSINGLE #ifdef dSINGLE
#ifdef HUGE_VALF #ifdef HUGE_VALF
#define dInfinity HUGE_VALF #define dInfinity HUGE_VALF
#else #else
#define dInfinity ((float)HUGE_VAL) #define dInfinity ((float)HUGE_VAL)
#endif #endif
#else #else
#define dInfinity HUGE_VAL #define dInfinity HUGE_VAL
#endif #endif
#else #else
#ifdef dSINGLE #ifdef dSINGLE
#define dInfinity ((float)(1.0/0.0)) #define dInfinity ((float)(1.0/0.0))
#else #else
#define dInfinity (1.0/0.0) #define dInfinity (1.0/0.0)
#endif #endif
#endif #endif
/* Visual C does not define these functions */
#if defined(_MSC_VER)
#define _ode_copysignf(x, y) ((float)_copysign(x, y))
#define _ode_copysign(x, y) _copysign(x, y)
#define _ode_nextafterf(x, y) _nextafterf(x, y)
#define _ode_nextafter(x, y) _nextafter(x, y)
#if !defined(_WIN64) && defined(dSINGLE)
#define _ODE__NEXTAFTERF_REQUIRED
ODE_EXTERN_C float _nextafterf(float x, float y);
#endif
#else
#define _ode_copysignf(x, y) copysignf(x, y)
#define _ode_copysign(x, y) copysign(x, y)
#define _ode_nextafterf(x, y) nextafterf(x, y)
#define _ode_nextafter(x, y) nextafter(x, y)
#endif
#endif #endif
 End of changes. 9 change blocks. 
26 lines changed or deleted 83 lines changed or added


 odecpp.h   odecpp.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 *
* General Public License is included with this library in the * * General Public License is included with this library in the *
* file LICENSE.TXT. * * file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in * * (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. * * the file LICENSE-BSD.TXT. *
* * * *
* 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. *
* * * *
*************************************************************************/ *************************************************************************/
/* C++ interface for non-collision stuff */ /* C++ interface for non-collision stuff */
#ifndef _ODE_ODECPP_H_ #ifndef _ODE_ODECPP_H_
#define _ODE_ODECPP_H_ #define _ODE_ODECPP_H_
#ifdef __cplusplus #ifdef __cplusplus
//namespace ode { //namespace ode {
 End of changes. 2 change blocks. 
18 lines changed or deleted 18 lines changed or added


 odecpp_collision.h   odecpp_collision.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 *
* General Public License is included with this library in the * * General Public License is included with this library in the *
* file LICENSE.TXT. * * file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in * * (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. * * the file LICENSE-BSD.TXT. *
* * * *
* 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. *
* * * *
*************************************************************************/ *************************************************************************/
/* C++ interface for new collision API */ /* C++ interface for new collision API */
#ifndef _ODE_ODECPP_COLLISION_H_ #ifndef _ODE_ODECPP_COLLISION_H_
#define _ODE_ODECPP_COLLISION_H_ #define _ODE_ODECPP_COLLISION_H_
#ifdef __cplusplus #ifdef __cplusplus
//#include <ode/error.h> //#include <ode/error.h>
 End of changes. 2 change blocks. 
18 lines changed or deleted 18 lines changed or added


 odeinit.h   odeinit.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 *
* General Public License is included with this library in the * * General Public License is included with this library in the *
* file LICENSE.TXT. * * file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in * * (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. * * the file LICENSE-BSD.TXT. *
* * * *
* 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. *
* * * *
*************************************************************************/ *************************************************************************/
/* Library initialization/finalization functions. */ /* Library initialization/finalization functions. */
#ifndef _ODE_ODEINIT_H_ #ifndef _ODE_ODEINIT_H_
#define _ODE_ODEINIT_H_ #define _ODE_ODEINIT_H_
#include <ode/common.h> #include <ode/common.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
skipping to change at line 74 skipping to change at line 74
* If @c dInitFlagManualThreadCleanup was not specified during initializati on, * If @c dInitFlagManualThreadCleanup was not specified during initializati on,
* calls to @c dCleanupODEAllDataForThread are not allowed. * calls to @c dCleanupODEAllDataForThread are not allowed.
* *
* @see dInitODE2 * @see dInitODE2
* @see dAllocateODEDataForThread * @see dAllocateODEDataForThread
* @see dSpaceSetManualCleanup * @see dSpaceSetManualCleanup
* @see dCloseODE * @see dCloseODE
* @ingroup init * @ingroup init
*/ */
enum dInitODEFlags { enum dInitODEFlags {
dInitFlagManualThreadCleanup = 0x00000001 //@< Thread local data is to be cleared explicitly on @c dCleanupODEAllDataForThread function call dInitFlagManualThreadCleanup = 0x00000001 /*@< Thread local data is to be cleared explicitly on @c dCleanupODEAllDataForThread function call*/
}; };
/** /**
* @brief Initializes ODE library. * @brief Initializes ODE library.
* *
* @c dInitODE is obsolete. @c dInitODE2 is to be used for library initiali zation. * @c dInitODE is obsolete. @c dInitODE2 is to be used for library initiali zation.
* *
* A call to @c dInitODE is equal to the following initialization sequence * A call to @c dInitODE is equal to the following initialization sequence
* @code * @code
* dInitODE2(0); * dInitODE2(0);
skipping to change at line 143 skipping to change at line 143
* @c dAllocateMaskAll is a mask that can be used for for allocating all po ssible * @c dAllocateMaskAll is a mask that can be used for for allocating all po ssible
* data in cases when it is not known what exactly features of ODE will be used. * data in cases when it is not known what exactly features of ODE will be used.
* The mask may not be used in combination with other flags. It is guarante ed to * The mask may not be used in combination with other flags. It is guarante ed to
* include all the current and future legal allocation flags. However, matu re * include all the current and future legal allocation flags. However, matu re
* applications should use explicit flags they need rather than allocating everything. * applications should use explicit flags they need rather than allocating everything.
* *
* @see dAllocateODEDataForThread * @see dAllocateODEDataForThread
* @ingroup init * @ingroup init
*/ */
enum dAllocateODEDataFlags { enum dAllocateODEDataFlags {
dAllocateFlagBasicData = 0, //@< Allocate basic data required for li brary to operate dAllocateFlagBasicData = 0, /*@< Allocate basic data required for libra ry to operate*/
dAllocateFlagCollisionData = 0x00000001, //@< Allocate data for coll ision detection dAllocateFlagCollisionData = 0x00000001, /*@< Allocate data for collisi on detection*/
dAllocateMaskAll = ~0U //@< Allocate all the possible data that is c urrently defined or will be defined in the future. dAllocateMaskAll = ~0 /*@< Allocate all the possible data that is curre ntly defined or will be defined in the future.*/
}; };
/** /**
* @brief Allocate thread local data to allow the thread calling ODE. * @brief Allocate thread local data to allow the thread calling ODE.
* @param uiAllocateFlags Allocation options bitmask. * @param uiAllocateFlags Allocation options bitmask.
* @return A nonzero if allocation succeeded and zero otherwise. * @return A nonzero if allocation succeeded and zero otherwise.
* *
* The function is required to be called for every thread that is going to use * The function is required to be called for every thread that is going to use
* ODE. This function allocates the data that is required for accessing ODE from * ODE. This function allocates the data that is required for accessing ODE from
* current thread along with optional data required for particular ODE subs ystems. * current thread along with optional data required for particular ODE subs ystems.
skipping to change at line 225 skipping to change at line 225
* before calling @c dCloseODE. In particular it is not allowed to call * before calling @c dCloseODE. In particular it is not allowed to call
* @c dCleanupODEAllDataForThread after @c dCloseODE. * @c dCleanupODEAllDataForThread after @c dCloseODE.
* *
* @see dInitODE2 * @see dInitODE2
* @see dCleanupODEAllDataForThread * @see dCleanupODEAllDataForThread
* @ingroup init * @ingroup init
*/ */
ODE_API void dCloseODE(void); ODE_API void dCloseODE(void);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } /* extern "C" */
#endif #endif
#endif // _ODE_ODEINIT_H_ #endif /* _ODE_ODEINIT_H_ */
 End of changes. 7 change blocks. 
25 lines changed or deleted 25 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

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/