moved files around
This commit is contained in:
172
Extras/ode/include/drawstuff/drawstuff.h
Normal file
172
Extras/ode/include/drawstuff/drawstuff.h
Normal file
@@ -0,0 +1,172 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Open Dynamics Engine, Copyright (C) 2001-2003 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
Draw Stuff
|
||||
----------
|
||||
|
||||
this is a library for rendering simple 3D objects in a virtual environment.
|
||||
|
||||
NOTES
|
||||
-----
|
||||
|
||||
in the virtual world, the z axis is "up" and z=0 is the floor.
|
||||
|
||||
the user is able to click+drag in the main window to move the camera:
|
||||
* left button - pan and tilt.
|
||||
* right button - forward and sideways.
|
||||
* left + right button (or middle button) - sideways and up.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DRAWSTUFF_H__
|
||||
#define __DRAWSTUFF_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <drawstuff/version.h>
|
||||
|
||||
|
||||
/* texture numbers */
|
||||
#define DS_NONE 0 /* uses the current color instead of a texture */
|
||||
#define DS_WOOD 1
|
||||
|
||||
|
||||
typedef struct dsFunctions {
|
||||
int version; /* put DS_VERSION here */
|
||||
/* version 1 data */
|
||||
void (*start)(); /* called before sim loop starts */
|
||||
void (*step) (int pause); /* called before every frame */
|
||||
void (*command) (int cmd); /* called if a command key is pressed */
|
||||
void (*stop)(); /* called after sim loop exits */
|
||||
/* version 2 data */
|
||||
char *path_to_textures; /* if nonzero, path to texture files */
|
||||
} dsFunctions;
|
||||
|
||||
|
||||
/* the main() function should fill in the dsFunctions structure then
|
||||
* call this.
|
||||
*/
|
||||
void dsSimulationLoop (int argc, char **argv,
|
||||
int window_width, int window_height,
|
||||
struct dsFunctions *fn);
|
||||
|
||||
/* these functions display an error message then exit. they take arguments
|
||||
* in the same way as printf(), except you do not have to add a terminating
|
||||
* '\n'. Debug() tries to dump core or start the debugger.
|
||||
*/
|
||||
void dsError (char *msg, ...);
|
||||
void dsDebug (char *msg, ...);
|
||||
|
||||
/* dsPrint() prints out a message. it takes arguments in the same way as
|
||||
* printf() (i.e. you must add a '\n' at the end of every line).
|
||||
*/
|
||||
void dsPrint (char *msg, ...);
|
||||
|
||||
/* set and get the camera position. xyz is the cameria position (x,y,z).
|
||||
* hpr contains heading, pitch and roll numbers in degrees. heading=0
|
||||
* points along the x axis, pitch=0 is looking towards the horizon, and
|
||||
* roll 0 is "unrotated".
|
||||
*/
|
||||
void dsSetViewpoint (float xyz[3], float hpr[3]);
|
||||
void dsGetViewpoint (float xyz[3], float hpr[3]);
|
||||
|
||||
/* stop the simulation loop. calling this from within dsSimulationLoop()
|
||||
* will cause it to exit and return to the caller. it is the same as if the
|
||||
* user used the exit command. using this outside the loop will have no
|
||||
* effect.
|
||||
*/
|
||||
void dsStop();
|
||||
|
||||
/* change the way objects are drawn. these changes will apply to all further
|
||||
* dsDrawXXX() functions. the texture number must be a DS_xxx texture
|
||||
* constant. the red, green, and blue number are between 0 and 1.
|
||||
* alpha is between 0 and 1 - if alpha is not specified it's assubed to be 1.
|
||||
* the current texture is colored according to the current color.
|
||||
* at the start of each frame, the texture is reset to none and the color is
|
||||
* reset to white.
|
||||
*/
|
||||
void dsSetTexture (int texture_number);
|
||||
void dsSetColor (float red, float green, float blue);
|
||||
void dsSetColorAlpha (float red, float green, float blue, float alpha);
|
||||
|
||||
/* draw objects.
|
||||
* - pos[] is the x,y,z of the center of the object.
|
||||
* - R[] is a 3x3 rotation matrix for the object, stored by row like this:
|
||||
* [ R11 R12 R13 0 ]
|
||||
* [ R21 R22 R23 0 ]
|
||||
* [ R31 R32 R33 0 ]
|
||||
* - sides[] is an array of x,y,z side lengths.
|
||||
* - all cylinders are aligned along the z axis.
|
||||
*/
|
||||
void dsDrawBox (const float pos[3], const float R[12], const float sides[3]);
|
||||
void dsDrawSphere (const float pos[3], const float R[12], float radius);
|
||||
void dsDrawTriangle (const float pos[3], const float R[12],
|
||||
const float *v0, const float *v1, const float *v2, int solid);
|
||||
void dsDrawCylinder (const float pos[3], const float R[12],
|
||||
float length, float radius);
|
||||
void dsDrawCone(const float pos[3], const float R[12],
|
||||
float length, float radius);
|
||||
|
||||
void dsDrawCylinder2 (const float pos[3], const float R[12],
|
||||
float length, float radius,float radius2);
|
||||
|
||||
|
||||
|
||||
void dsDrawCappedCylinder (const float pos[3], const float R[12],
|
||||
float length, float radius);
|
||||
void dsDrawLine (const float pos1[3], const float pos2[3]);
|
||||
|
||||
/* these drawing functions are identical to the ones above, except they take
|
||||
* double arrays for `pos' and `R'.
|
||||
*/
|
||||
void dsDrawBoxD (const double pos[3], const double R[12],
|
||||
const double sides[3]);
|
||||
void dsDrawSphereD (const double pos[3], const double R[12],
|
||||
const float radius);
|
||||
void dsDrawTriangleD (const double pos[3], const double R[12],
|
||||
const double *v0, const double *v1, const double *v2, int solid);
|
||||
void dsDrawCylinderD (const double pos[3], const double R[12],
|
||||
float length, float radius);
|
||||
void dsDrawCappedCylinderD (const double pos[3], const double R[12],
|
||||
float length, float radius);
|
||||
void dsDrawLineD (const double pos1[3], const double pos2[3]);
|
||||
|
||||
/* Set the drawn quality of the objects. Higher numbers are higher quality,
|
||||
* but slower to draw. This must be set before the first objects are drawn to
|
||||
* be effective.
|
||||
*/
|
||||
void dsSetSphereQuality (int n); /* default = 1 */
|
||||
void dsSetCappedCylinderQuality (int n); /* default = 3 */
|
||||
|
||||
|
||||
/* closing bracket for extern "C" */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
29
Extras/ode/include/drawstuff/version.h
Normal file
29
Extras/ode/include/drawstuff/version.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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 __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
/* high byte is major version, low byte is minor version */
|
||||
#define DS_VERSION 0x0002
|
||||
|
||||
#endif
|
||||
18
Extras/ode/include/ode/README
Normal file
18
Extras/ode/include/ode/README
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
this is the public C interface to the ODE library.
|
||||
|
||||
all these files should be includable from C, i.e. they should not use any
|
||||
C++ features. everything should be protected with
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
...
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
the only exceptions are the odecpp.h and odecpp_collisioh.h files, which define a C++ wrapper for
|
||||
the C interface. remember to keep this in sync!
|
||||
190
Extras/ode/include/ode/collision.h
Normal file
190
Extras/ode/include/ode/collision.h
Normal file
@@ -0,0 +1,190 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Open Dynamics Engine, Copyright (C) 2001-2003 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_COLLISION_H_
|
||||
#define _ODE_COLLISION_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
#include <ode/collision_space.h>
|
||||
#include <ode/contact.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* general functions */
|
||||
|
||||
void dGeomDestroy (dGeomID);
|
||||
void dGeomSetData (dGeomID, void *);
|
||||
void *dGeomGetData (dGeomID);
|
||||
void dGeomSetBody (dGeomID, dBodyID);
|
||||
dBodyID dGeomGetBody (dGeomID);
|
||||
void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z);
|
||||
void dGeomSetRotation (dGeomID, const dMatrix3 R);
|
||||
void dGeomSetQuaternion (dGeomID, const dQuaternion);
|
||||
const dReal * dGeomGetPosition (dGeomID);
|
||||
const dReal * dGeomGetRotation (dGeomID);
|
||||
void dGeomGetQuaternion (dGeomID, dQuaternion result);
|
||||
void dGeomGetAABB (dGeomID, dReal aabb[6]);
|
||||
int dGeomIsSpace (dGeomID);
|
||||
dSpaceID dGeomGetSpace (dGeomID);
|
||||
int dGeomGetClass (dGeomID);
|
||||
void dGeomSetCategoryBits (dGeomID, unsigned long bits);
|
||||
void dGeomSetCollideBits (dGeomID, unsigned long bits);
|
||||
unsigned long dGeomGetCategoryBits (dGeomID);
|
||||
unsigned long dGeomGetCollideBits (dGeomID);
|
||||
void dGeomEnable (dGeomID);
|
||||
void dGeomDisable (dGeomID);
|
||||
int dGeomIsEnabled (dGeomID);
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* collision detection */
|
||||
|
||||
int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact,
|
||||
int skip);
|
||||
void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback);
|
||||
void dSpaceCollide2 (dGeomID o1, dGeomID o2, void *data,
|
||||
dNearCallback *callback);
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* standard classes */
|
||||
|
||||
/* the maximum number of user classes that are supported */
|
||||
enum {
|
||||
dMaxUserClasses = 4
|
||||
};
|
||||
|
||||
/* class numbers - each geometry object needs a unique number */
|
||||
enum {
|
||||
dSphereClass = 0,
|
||||
dBoxClass,
|
||||
dCCylinderClass,
|
||||
dCylinderClass,
|
||||
dPlaneClass,
|
||||
dRayClass,
|
||||
dGeomTransformClass,
|
||||
dTriMeshClass,
|
||||
dConvexClass,
|
||||
|
||||
dFirstSpaceClass,
|
||||
dSimpleSpaceClass = dFirstSpaceClass,
|
||||
dHashSpaceClass,
|
||||
dQuadTreeSpaceClass,
|
||||
dLastSpaceClass = dQuadTreeSpaceClass,
|
||||
|
||||
dFirstUserClass,
|
||||
dLastUserClass = dFirstUserClass + dMaxUserClasses - 1,
|
||||
dGeomNumClasses
|
||||
};
|
||||
|
||||
|
||||
dGeomID dCreateSphere (dSpaceID space, dReal radius);
|
||||
void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
|
||||
dReal dGeomSphereGetRadius (dGeomID sphere);
|
||||
dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
|
||||
|
||||
dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
|
||||
void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
|
||||
void dGeomBoxGetLengths (dGeomID box, dVector3 result);
|
||||
dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z);
|
||||
|
||||
dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
|
||||
void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
|
||||
void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
|
||||
dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
|
||||
|
||||
dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length);
|
||||
void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length);
|
||||
void dGeomCCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
|
||||
dReal dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
|
||||
|
||||
dGeomID dCreateRay (dSpaceID space, dReal length);
|
||||
void dGeomRaySetLength (dGeomID ray, dReal length);
|
||||
dReal dGeomRayGetLength (dGeomID ray);
|
||||
void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
|
||||
dReal dx, dReal dy, dReal dz);
|
||||
void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir);
|
||||
|
||||
/*
|
||||
* Set/get ray flags that influence ray collision detection.
|
||||
* These flags are currently only noticed by the trimesh collider, because
|
||||
* they can make a major differences there.
|
||||
*/
|
||||
void dGeomRaySetParams (dGeomID g, int FirstContact, int BackfaceCull);
|
||||
void dGeomRayGetParams (dGeomID g, int *FirstContact, int *BackfaceCull);
|
||||
void dGeomRaySetClosestHit (dGeomID g, int closestHit);
|
||||
int dGeomRayGetClosestHit (dGeomID g);
|
||||
|
||||
#include "collision_trimesh.h"
|
||||
|
||||
dGeomID dCreateGeomTransform (dSpaceID space);
|
||||
void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
|
||||
dGeomID dGeomTransformGetGeom (dGeomID g);
|
||||
void dGeomTransformSetCleanup (dGeomID g, int mode);
|
||||
int dGeomTransformGetCleanup (dGeomID g);
|
||||
void dGeomTransformSetInfo (dGeomID g, int mode);
|
||||
int dGeomTransformGetInfo (dGeomID g);
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* utility functions */
|
||||
|
||||
void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
|
||||
const dVector3 b1, const dVector3 b2,
|
||||
dVector3 cp1, dVector3 cp2);
|
||||
|
||||
int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1,
|
||||
const dVector3 side1, const dVector3 _p2,
|
||||
const dMatrix3 R2, const dVector3 side2);
|
||||
|
||||
void dInfiniteAABB (dGeomID geom, dReal aabb[6]);
|
||||
void dCloseODE(void);
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* custom classes */
|
||||
|
||||
typedef void dGetAABBFn (dGeomID, dReal aabb[6]);
|
||||
typedef int dColliderFn (dGeomID o1, dGeomID o2,
|
||||
int flags, dContactGeom *contact, int skip);
|
||||
typedef dColliderFn * dGetColliderFnFn (int num);
|
||||
typedef void dGeomDtorFn (dGeomID o);
|
||||
typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);
|
||||
|
||||
typedef struct dGeomClass {
|
||||
int bytes;
|
||||
dGetColliderFnFn *collider;
|
||||
dGetAABBFn *aabb;
|
||||
dAABBTestFn *aabb_test;
|
||||
dGeomDtorFn *dtor;
|
||||
} dGeomClass;
|
||||
|
||||
int dCreateGeomClass (const dGeomClass *classptr);
|
||||
void * dGeomGetClassData (dGeomID);
|
||||
dGeomID dCreateGeom (int classnum);
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
61
Extras/ode/include/ode/collision_space.h
Normal file
61
Extras/ode/include/ode/collision_space.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Open Dynamics Engine, Copyright (C) 2001-2003 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_COLLISION_SPACE_H_
|
||||
#define _ODE_COLLISION_SPACE_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct dContactGeom;
|
||||
|
||||
typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2);
|
||||
|
||||
|
||||
dSpaceID dSimpleSpaceCreate (dSpaceID space);
|
||||
dSpaceID dHashSpaceCreate (dSpaceID space);
|
||||
dSpaceID dQuadTreeSpaceCreate (dSpaceID space, dVector3 Center, dVector3 Extents, int Depth);
|
||||
|
||||
void dSpaceDestroy (dSpaceID);
|
||||
|
||||
void dHashSpaceSetLevels (dSpaceID space, int minlevel, int maxlevel);
|
||||
void dHashSpaceGetLevels (dSpaceID space, int *minlevel, int *maxlevel);
|
||||
|
||||
void dSpaceSetCleanup (dSpaceID space, int mode);
|
||||
int dSpaceGetCleanup (dSpaceID space);
|
||||
|
||||
void dSpaceAdd (dSpaceID, dGeomID);
|
||||
void dSpaceRemove (dSpaceID, dGeomID);
|
||||
int dSpaceQuery (dSpaceID, dGeomID);
|
||||
void dSpaceClean (dSpaceID);
|
||||
int dSpaceGetNumGeoms (dSpaceID);
|
||||
dGeomID dSpaceGetGeom (dSpaceID, int i);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
184
Extras/ode/include/ode/collision_trimesh.h
Normal file
184
Extras/ode/include/ode/collision_trimesh.h
Normal file
@@ -0,0 +1,184 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Open Dynamics Engine, Copyright (C) 2001-2003 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/*
|
||||
* TriMesh code by Erwin de Vries.
|
||||
*
|
||||
* Trimesh data.
|
||||
* This is where the actual vertexdata (pointers), and BV tree is stored.
|
||||
* Vertices should be single precision!
|
||||
* This should be more sophisticated, so that the user can easyly implement
|
||||
* another collision library, but this is a lot of work, and also costs some
|
||||
* performance because some data has to be copied.
|
||||
*/
|
||||
|
||||
#ifndef _ODE_COLLISION_TRIMESH_H_
|
||||
#define _ODE_COLLISION_TRIMESH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Data storage for triangle meshes.
|
||||
*/
|
||||
struct dxTriMeshData;
|
||||
typedef struct dxTriMeshData* dTriMeshDataID;
|
||||
|
||||
/*
|
||||
* These dont make much sense now, but they will later when we add more
|
||||
* features.
|
||||
*/
|
||||
dTriMeshDataID dGeomTriMeshDataCreate(void);
|
||||
void dGeomTriMeshDataDestroy(dTriMeshDataID g);
|
||||
|
||||
enum { TRIMESH_FACE_NORMALS, TRIMESH_LAST_TRANSFORMATION };
|
||||
void dGeomTriMeshDataSet(dTriMeshDataID g, int data_id, void* in_data);
|
||||
void* dGeomTriMeshDataGet(dTriMeshDataID g, int data_id);
|
||||
|
||||
/*
|
||||
* Build TriMesh data with single pricision used in vertex data .
|
||||
*/
|
||||
void dGeomTriMeshDataBuildSingle(dTriMeshDataID g,
|
||||
const void* Vertices, int VertexStride, int VertexCount,
|
||||
const void* Indices, int IndexCount, int TriStride);
|
||||
/* same again with a normals array (used as trimesh-trimesh optimization) */
|
||||
void dGeomTriMeshDataBuildSingle1(dTriMeshDataID g,
|
||||
const void* Vertices, int VertexStride, int VertexCount,
|
||||
const void* Indices, int IndexCount, int TriStride,
|
||||
const void* Normals);
|
||||
/*
|
||||
* Build TriMesh data with double pricision used in vertex data .
|
||||
*/
|
||||
void dGeomTriMeshDataBuildDouble(dTriMeshDataID g,
|
||||
const void* Vertices, int VertexStride, int VertexCount,
|
||||
const void* Indices, int IndexCount, int TriStride);
|
||||
/* same again with a normals array (used as trimesh-trimesh optimization) */
|
||||
void dGeomTriMeshDataBuildDouble1(dTriMeshDataID g,
|
||||
const void* Vertices, int VertexStride, int VertexCount,
|
||||
const void* Indices, int IndexCount, int TriStride,
|
||||
const void* Normals);
|
||||
|
||||
/*
|
||||
* Simple build. Single/double precision based on dSINGLE/dDOUBLE!
|
||||
*/
|
||||
void dGeomTriMeshDataBuildSimple(dTriMeshDataID g,
|
||||
const dReal* Vertices, int VertexCount,
|
||||
const int* Indices, int IndexCount);
|
||||
/* same again with a normals array (used as trimesh-trimesh optimization) */
|
||||
void dGeomTriMeshDataBuildSimple1(dTriMeshDataID g,
|
||||
const dReal* Vertices, int VertexCount,
|
||||
const int* Indices, int IndexCount,
|
||||
const int* Normals);
|
||||
/*
|
||||
* Per triangle callback. Allows the user to say if he wants a collision with
|
||||
* a particular triangle.
|
||||
*/
|
||||
typedef int dTriCallback(dGeomID TriMesh, dGeomID RefObject, int TriangleIndex);
|
||||
void dGeomTriMeshSetCallback(dGeomID g, dTriCallback* Callback);
|
||||
dTriCallback* dGeomTriMeshGetCallback(dGeomID g);
|
||||
|
||||
/*
|
||||
* Per object callback. Allows the user to get the list of triangles in 1
|
||||
* shot. Maybe we should remove this one.
|
||||
*/
|
||||
typedef void dTriArrayCallback(dGeomID TriMesh, dGeomID RefObject, const int* TriIndices, int TriCount);
|
||||
void dGeomTriMeshSetArrayCallback(dGeomID g, dTriArrayCallback* ArrayCallback);
|
||||
dTriArrayCallback* dGeomTriMeshGetArrayCallback(dGeomID g);
|
||||
|
||||
/*
|
||||
* Ray callback.
|
||||
* Allows the user to say if a ray collides with a triangle on barycentric
|
||||
* coords. The user can for example sample a texture with alpha transparency
|
||||
* to determine if a collision should occur.
|
||||
*/
|
||||
typedef int dTriRayCallback(dGeomID TriMesh, dGeomID Ray, int TriangleIndex, dReal u, dReal v);
|
||||
void dGeomTriMeshSetRayCallback(dGeomID g, dTriRayCallback* Callback);
|
||||
dTriRayCallback* dGeomTriMeshGetRayCallback(dGeomID g);
|
||||
|
||||
/*
|
||||
* Trimesh class
|
||||
* Construction. Callbacks are optional.
|
||||
*/
|
||||
dGeomID dCreateTriMesh(dSpaceID space, dTriMeshDataID Data, dTriCallback* Callback, dTriArrayCallback* ArrayCallback, dTriRayCallback* RayCallback);
|
||||
|
||||
void dGeomTriMeshSetData(dGeomID g, dTriMeshDataID Data);
|
||||
dTriMeshDataID dGeomTriMeshGetData(dGeomID g);
|
||||
|
||||
|
||||
// enable/disable/check temporal coherence
|
||||
void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable);
|
||||
int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass);
|
||||
|
||||
/*
|
||||
* Clears the internal temporal coherence caches. When a geom has its
|
||||
* 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.
|
||||
* We should be able to do this automagically.
|
||||
*/
|
||||
void dGeomTriMeshClearTCCache(dGeomID g);
|
||||
|
||||
|
||||
/*
|
||||
* returns the TriMeshDataID
|
||||
*/
|
||||
dTriMeshDataID dGeomTriMeshGetTriMeshDataID(dGeomID g);
|
||||
|
||||
/*
|
||||
* Gets a triangle.
|
||||
*/
|
||||
void dGeomTriMeshGetTriangle(dGeomID g, int Index, dVector3* v0, dVector3* v1, dVector3* v2);
|
||||
|
||||
/*
|
||||
* Gets the point on the requested triangle and the given barycentric
|
||||
* coordinates.
|
||||
*/
|
||||
void dGeomTriMeshGetPoint(dGeomID g, int Index, dReal u, dReal v, dVector3 Out);
|
||||
|
||||
/*
|
||||
|
||||
This is how the strided data works:
|
||||
|
||||
struct StridedVertex{
|
||||
dVector3 Vertex;
|
||||
// Userdata
|
||||
};
|
||||
int VertexStride = sizeof(StridedVertex);
|
||||
|
||||
struct StridedTri{
|
||||
int Indices[3];
|
||||
// Userdata
|
||||
};
|
||||
int TriStride = sizeof(StridedTri);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int dGeomTriMeshGetTriangleCount (dGeomID g);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ODE_COLLISION_TRIMESH_H_ */
|
||||
|
||||
338
Extras/ode/include/ode/common.h
Normal file
338
Extras/ode/include/ode/common.h
Normal file
@@ -0,0 +1,338 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_COMMON_H_
|
||||
#define _ODE_COMMON_H_
|
||||
|
||||
#include <ode/config.h>
|
||||
#include <ode/error.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* configuration stuff */
|
||||
|
||||
/* the efficient alignment. most platforms align data structures to some
|
||||
* number of bytes, but this is not always the most efficient alignment.
|
||||
* for example, many x86 compilers align to 4 bytes, but on a pentium it
|
||||
* is important to align doubles to 8 byte boundaries (for speed), and
|
||||
* the 4 floats in a SIMD register to 16 byte boundaries. many other
|
||||
* platforms have similar behavior. setting a larger alignment can waste
|
||||
* a (very) small amount of memory. NOTE: this number must be a power of
|
||||
* two. this is set to 16 by default.
|
||||
*/
|
||||
#define EFFICIENT_ALIGNMENT 16
|
||||
|
||||
|
||||
/* constants */
|
||||
|
||||
/* 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)
|
||||
*/
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI REAL(3.1415926535897932384626433832795029)
|
||||
#endif
|
||||
#ifndef M_SQRT1_2
|
||||
#define M_SQRT1_2 REAL(0.7071067811865475244008443621048490)
|
||||
#endif
|
||||
|
||||
|
||||
/* debugging:
|
||||
* IASSERT is an internal assertion, i.e. a consistency check. if it fails
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef dNODEBUG
|
||||
#ifdef __GNUC__
|
||||
#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
|
||||
"assertion \"" #a "\" failed in %s() [%s]",__FUNCTION__,__FILE__);
|
||||
#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
|
||||
msg " in %s()", __FUNCTION__);
|
||||
#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
|
||||
msg " in %s()", __FUNCTION__);
|
||||
#else
|
||||
#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
|
||||
"assertion \"" #a "\" failed in %s:%d",__FILE__,__LINE__);
|
||||
#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
|
||||
msg " (%s:%d)", __FILE__,__LINE__);
|
||||
#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
|
||||
msg " (%s:%d)", __FILE__,__LINE__);
|
||||
#endif
|
||||
#else
|
||||
#define dIASSERT(a) ;
|
||||
#define dUASSERT(a,msg) ;
|
||||
#define dDEBUGMSG(msg) ;
|
||||
#endif
|
||||
#define dAASSERT(a) dUASSERT(a,"Bad argument(s)")
|
||||
|
||||
/* floating point data type, vector, matrix and quaternion types */
|
||||
|
||||
#if defined(dSINGLE)
|
||||
typedef float dReal;
|
||||
#elif defined(dDOUBLE)
|
||||
typedef double dReal;
|
||||
#else
|
||||
#error You must #define dSINGLE or dDOUBLE
|
||||
#endif
|
||||
|
||||
|
||||
/* round an integer up to a multiple of 4, except that 0 and 1 are unmodified
|
||||
* (used to compute matrix leading dimensions)
|
||||
*/
|
||||
#define dPAD(a) (((a) > 1) ? ((((a)-1)|3)+1) : (a))
|
||||
|
||||
/* these types are mainly just used in headers */
|
||||
typedef dReal dVector3[4];
|
||||
typedef dReal dVector4[4];
|
||||
typedef dReal dMatrix3[4*3];
|
||||
typedef dReal dMatrix4[4*4];
|
||||
typedef dReal dMatrix6[8*6];
|
||||
typedef dReal dQuaternion[4];
|
||||
|
||||
|
||||
/* precision dependent scalar math functions */
|
||||
|
||||
#if defined(dSINGLE)
|
||||
|
||||
#define REAL(x) (x ## f) /* form a constant */
|
||||
#define dRecip(x) ((float)(1.0f/(x))) /* reciprocal */
|
||||
#define dSqrt(x) ((float)sqrtf(float(x))) /* square root */
|
||||
#define dRecipSqrt(x) ((float)(1.0f/sqrtf(float(x)))) /* reciprocal square root */
|
||||
#define dSin(x) ((float)sinf(float(x))) /* sine */
|
||||
#define dCos(x) ((float)cosf(float(x))) /* cosine */
|
||||
#define dFabs(x) ((float)fabsf(float(x))) /* absolute value */
|
||||
#define dAtan2(y,x) ((float)atan2f(float(y),float(x))) /* arc tangent with 2 args */
|
||||
#define dFMod(a,b) ((float)fmodf(float(a),float(b))) /* modulo */
|
||||
#define dCopySign(a,b) ((float)copysignf(float(a),float(b)))
|
||||
|
||||
#elif defined(dDOUBLE)
|
||||
|
||||
#define REAL(x) (x)
|
||||
#define dRecip(x) (1.0/(x))
|
||||
#define dSqrt(x) sqrt(x)
|
||||
#define dRecipSqrt(x) (1.0/sqrt(x))
|
||||
#define dSin(x) sin(x)
|
||||
#define dCos(x) cos(x)
|
||||
#define dFabs(x) fabs(x)
|
||||
#define dAtan2(y,x) atan2((y),(x))
|
||||
#define dFMod(a,b) (fmod((a),(b)))
|
||||
#define dCopySign(a,b) (copysign((a),(b)))
|
||||
|
||||
#else
|
||||
#error You must #define dSINGLE or dDOUBLE
|
||||
#endif
|
||||
|
||||
|
||||
/* utility */
|
||||
|
||||
|
||||
/* round something up to be a multiple of the EFFICIENT_ALIGNMENT */
|
||||
|
||||
#define dEFFICIENT_SIZE(x) ((((x)-1)|(EFFICIENT_ALIGNMENT-1))+1)
|
||||
|
||||
|
||||
/* alloca aligned to the EFFICIENT_ALIGNMENT. note that this can waste
|
||||
* up to 15 bytes per allocation, depending on what alloca() returns.
|
||||
*/
|
||||
|
||||
#define dALLOCA16(n) \
|
||||
((char*)dEFFICIENT_SIZE(((size_t)(alloca((n)+(EFFICIENT_ALIGNMENT-1))))))
|
||||
|
||||
|
||||
// Use the error-checking memory allocation system. Becuase this system uses heap
|
||||
// (malloc) instead of stack (alloca), it is slower. However, it allows you to
|
||||
// simulate larger scenes, as well as handle out-of-memory errors in a somewhat
|
||||
// graceful manner
|
||||
|
||||
// #define dUSE_MALLOC_FOR_ALLOCA
|
||||
|
||||
#ifdef dUSE_MALLOC_FOR_ALLOCA
|
||||
enum {
|
||||
d_MEMORY_OK = 0, /* no memory errors */
|
||||
d_MEMORY_OUT_OF_MEMORY /* malloc failed due to out of memory error */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* internal object types (all prefixed with `dx') */
|
||||
|
||||
struct dxWorld; /* dynamics world */
|
||||
struct dxSpace; /* collision space */
|
||||
struct dxBody; /* rigid body (dynamics object) */
|
||||
struct dxGeom; /* geometry (collision object) */
|
||||
struct dxJoint;
|
||||
struct dxJointNode;
|
||||
struct dxJointGroup;
|
||||
|
||||
typedef struct dxWorld *dWorldID;
|
||||
typedef struct dxSpace *dSpaceID;
|
||||
typedef struct dxBody *dBodyID;
|
||||
typedef struct dxGeom *dGeomID;
|
||||
typedef struct dxJoint *dJointID;
|
||||
typedef struct dxJointGroup *dJointGroupID;
|
||||
|
||||
|
||||
/* error numbers */
|
||||
|
||||
enum {
|
||||
d_ERR_UNKNOWN = 0, /* unknown error */
|
||||
d_ERR_IASSERT, /* internal assertion failed */
|
||||
d_ERR_UASSERT, /* user assertion failed */
|
||||
d_ERR_LCP /* user assertion failed */
|
||||
};
|
||||
|
||||
|
||||
/* joint type numbers */
|
||||
|
||||
enum {
|
||||
dJointTypeNone = 0, /* or "unknown" */
|
||||
dJointTypeBall,
|
||||
dJointTypeHinge,
|
||||
dJointTypeSlider,
|
||||
dJointTypeContact,
|
||||
dJointTypeUniversal,
|
||||
dJointTypeHinge2,
|
||||
dJointTypeFixed,
|
||||
dJointTypeNull,
|
||||
dJointTypeAMotor
|
||||
};
|
||||
|
||||
|
||||
/* an alternative way of setting joint parameters, using joint parameter
|
||||
* structures and member constants. we don't actually do this yet.
|
||||
*/
|
||||
|
||||
/*
|
||||
typedef struct dLimot {
|
||||
int mode;
|
||||
dReal lostop, histop;
|
||||
dReal vel, fmax;
|
||||
dReal fudge_factor;
|
||||
dReal bounce, soft;
|
||||
dReal suspension_erp, suspension_cfm;
|
||||
} dLimot;
|
||||
|
||||
enum {
|
||||
dLimotLoStop = 0x0001,
|
||||
dLimotHiStop = 0x0002,
|
||||
dLimotVel = 0x0004,
|
||||
dLimotFMax = 0x0008,
|
||||
dLimotFudgeFactor = 0x0010,
|
||||
dLimotBounce = 0x0020,
|
||||
dLimotSoft = 0x0040
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/* standard joint parameter names. why are these here? - because we don't want
|
||||
* to include all the joint function definitions in joint.cpp. hmmmm.
|
||||
* MSVC complains if we call D_ALL_PARAM_NAMES_X with a blank second argument,
|
||||
* which is why we have the D_ALL_PARAM_NAMES macro as well. please copy and
|
||||
* paste between these two.
|
||||
*/
|
||||
|
||||
#define D_ALL_PARAM_NAMES(start) \
|
||||
/* parameters for limits and motors */ \
|
||||
dParamLoStop = start, \
|
||||
dParamHiStop, \
|
||||
dParamVel, \
|
||||
dParamFMax, \
|
||||
dParamFudgeFactor, \
|
||||
dParamBounce, \
|
||||
dParamCFM, \
|
||||
dParamStopERP, \
|
||||
dParamStopCFM, \
|
||||
/* parameters for suspension */ \
|
||||
dParamSuspensionERP, \
|
||||
dParamSuspensionCFM,
|
||||
|
||||
#define D_ALL_PARAM_NAMES_X(start,x) \
|
||||
/* parameters for limits and motors */ \
|
||||
dParamLoStop ## x = start, \
|
||||
dParamHiStop ## x, \
|
||||
dParamVel ## x, \
|
||||
dParamFMax ## x, \
|
||||
dParamFudgeFactor ## x, \
|
||||
dParamBounce ## x, \
|
||||
dParamCFM ## x, \
|
||||
dParamStopERP ## x, \
|
||||
dParamStopCFM ## x, \
|
||||
/* parameters for suspension */ \
|
||||
dParamSuspensionERP ## x, \
|
||||
dParamSuspensionCFM ## x,
|
||||
|
||||
enum {
|
||||
D_ALL_PARAM_NAMES(0)
|
||||
D_ALL_PARAM_NAMES_X(0x100,2)
|
||||
D_ALL_PARAM_NAMES_X(0x200,3)
|
||||
|
||||
/* add a multiple of this constant to the basic parameter numbers to get
|
||||
* the parameters for the second, third etc axes.
|
||||
*/
|
||||
dParamGroup=0x100
|
||||
};
|
||||
|
||||
|
||||
/* angular motor mode numbers */
|
||||
|
||||
enum{
|
||||
dAMotorUser = 0,
|
||||
dAMotorEuler = 1
|
||||
};
|
||||
|
||||
|
||||
/* joint force feedback information */
|
||||
|
||||
typedef struct dJointFeedback {
|
||||
dVector3 f1; /* force applied to body 1 */
|
||||
dVector3 t1; /* torque applied to body 1 */
|
||||
dVector3 f2; /* force applied to body 2 */
|
||||
dVector3 t2; /* torque applied to body 2 */
|
||||
} dJointFeedback;
|
||||
|
||||
|
||||
/* private functions that must be implemented by the collision library:
|
||||
* (1) indicate that a geom has moved, (2) get the next geom in a body list.
|
||||
* these functions are called whenever the position of geoms connected to a
|
||||
* body have changed, e.g. with dBodySetPosition(), dBodySetRotation(), or
|
||||
* when the ODE step function updates the body state.
|
||||
*/
|
||||
|
||||
void dGeomMoved (dGeomID);
|
||||
dGeomID dGeomGetBodyNext (dGeomID);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
40
Extras/ode/include/ode/compatibility.h
Normal file
40
Extras/ode/include/ode/compatibility.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_COMPATIBILITY_H_
|
||||
#define _ODE_COMPATIBILITY_H_
|
||||
|
||||
/*
|
||||
* ODE's backward compatibility system ensures that as ODE's API
|
||||
* evolves, user code will not break.
|
||||
*/
|
||||
|
||||
/*
|
||||
* These new rotation function names are more consistent with the
|
||||
* rest of the API.
|
||||
*/
|
||||
#define dQtoR(q,R) dRfromQ((R),(q))
|
||||
#define dRtoQ(R,q) dQfromR((q),(R))
|
||||
#define dWtoDQ(w,q,dq) dDQfromW((dq),(w),(q))
|
||||
|
||||
|
||||
#endif
|
||||
53
Extras/ode/include/ode/config.h
Normal file
53
Extras/ode/include/ode/config.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* per-machine configuration. this file is automatically generated. */
|
||||
|
||||
#ifndef _ODE_CONFIG_H_
|
||||
#define _ODE_CONFIG_H_
|
||||
|
||||
/* standard system headers */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <malloc.h>
|
||||
#include <float.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* is this a pentium on a gcc-based platform? */
|
||||
/* #define PENTIUM 1 -- not a pentium */
|
||||
|
||||
/* integer types (we assume int >= 32 bits) */
|
||||
typedef char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
|
||||
/* an integer type that we can safely cast a pointer to and
|
||||
* from without loss of bits.
|
||||
*/
|
||||
typedef unsigned int intP;
|
||||
|
||||
/* select the base floating point type */
|
||||
#define dSINGLE 1
|
||||
|
||||
/* the floating point infinity */
|
||||
#define dInfinity FLT_MAX
|
||||
|
||||
|
||||
|
||||
|
||||
/* available functions */
|
||||
#define copysignf _copysign
|
||||
#define copysign _copysign
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
90
Extras/ode/include/ode/contact.h
Normal file
90
Extras/ode/include/ode/contact.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_CONTACT_H_
|
||||
#define _ODE_CONTACT_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
dContactMu2 = 0x001,
|
||||
dContactFDir1 = 0x002,
|
||||
dContactBounce = 0x004,
|
||||
dContactSoftERP = 0x008,
|
||||
dContactSoftCFM = 0x010,
|
||||
dContactMotion1 = 0x020,
|
||||
dContactMotion2 = 0x040,
|
||||
dContactSlip1 = 0x080,
|
||||
dContactSlip2 = 0x100,
|
||||
|
||||
dContactApprox0 = 0x0000,
|
||||
dContactApprox1_1 = 0x1000,
|
||||
dContactApprox1_2 = 0x2000,
|
||||
dContactApprox1 = 0x3000
|
||||
};
|
||||
|
||||
|
||||
typedef struct dSurfaceParameters {
|
||||
/* must always be defined */
|
||||
int mode;
|
||||
dReal mu;
|
||||
|
||||
/* only defined if the corresponding flag is set in mode */
|
||||
dReal mu2;
|
||||
dReal bounce;
|
||||
dReal bounce_vel;
|
||||
dReal soft_erp;
|
||||
dReal soft_cfm;
|
||||
dReal motion1,motion2;
|
||||
dReal slip1,slip2;
|
||||
} dSurfaceParameters;
|
||||
|
||||
|
||||
/* contact info set by collision functions */
|
||||
|
||||
typedef struct dContactGeom {
|
||||
dVector3 pos;
|
||||
dVector3 normal;
|
||||
dReal depth;
|
||||
dGeomID g1,g2;
|
||||
} dContactGeom;
|
||||
|
||||
|
||||
/* contact info used by contact joint */
|
||||
|
||||
typedef struct dContact {
|
||||
dSurfaceParameters surface;
|
||||
dContactGeom geom;
|
||||
dVector3 fdir1;
|
||||
} dContact;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
63
Extras/ode/include/ode/error.h
Normal file
63
Extras/ode/include/ode/error.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/* this comes from the `reuse' library. copy any changes back to the source */
|
||||
|
||||
#ifndef _ODE_ERROR_H_
|
||||
#define _ODE_ERROR_H_
|
||||
|
||||
#include <ode/config.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* all user defined error functions have this type. error and debug functions
|
||||
* should not return.
|
||||
*/
|
||||
typedef void dMessageFunction (int errnum, const char *msg, va_list ap);
|
||||
|
||||
/* set a new error, debug or warning handler. if fn is 0, the default handlers
|
||||
* are used.
|
||||
*/
|
||||
void dSetErrorHandler (dMessageFunction *fn);
|
||||
void dSetDebugHandler (dMessageFunction *fn);
|
||||
void dSetMessageHandler (dMessageFunction *fn);
|
||||
|
||||
/* return the current error, debug or warning handler. if the return value is
|
||||
* 0, the default handlers are in place.
|
||||
*/
|
||||
dMessageFunction *dGetErrorHandler(void);
|
||||
dMessageFunction *dGetDebugHandler(void);
|
||||
dMessageFunction *dGetMessageHandler(void);
|
||||
|
||||
/* generate a fatal error, debug trap or a message. */
|
||||
void dError (int num, const char *msg, ...);
|
||||
void dDebug (int num, const char *msg, ...);
|
||||
void dMessage (int num, const char *msg, ...);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
32
Extras/ode/include/ode/export-dif.h
Normal file
32
Extras/ode/include/ode/export-dif.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_EXPORT_DIF_
|
||||
#define _ODE_EXPORT_DIF_
|
||||
|
||||
#include <ode/common.h>
|
||||
|
||||
|
||||
void dWorldExportDIF (dWorldID w, FILE *file, const char *world_name);
|
||||
|
||||
|
||||
#endif
|
||||
107
Extras/ode/include/ode/mass.h
Normal file
107
Extras/ode/include/ode/mass.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_MASS_H_
|
||||
#define _ODE_MASS_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct dMass;
|
||||
typedef struct dMass dMass;
|
||||
|
||||
|
||||
void dMassSetZero (dMass *);
|
||||
|
||||
void dMassSetParameters (dMass *, dReal themass,
|
||||
dReal cgx, dReal cgy, dReal cgz,
|
||||
dReal I11, dReal I22, dReal I33,
|
||||
dReal I12, dReal I13, dReal I23);
|
||||
|
||||
void dMassSetSphere (dMass *, dReal density, dReal radius);
|
||||
void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
|
||||
|
||||
void dMassSetCappedCylinder (dMass *, dReal density, int direction,
|
||||
dReal radius, dReal length);
|
||||
void dMassSetCappedCylinderTotal (dMass *, dReal total_mass, int direction,
|
||||
dReal radius, dReal length);
|
||||
|
||||
void dMassSetCylinder (dMass *, dReal density, int direction,
|
||||
dReal radius, dReal length);
|
||||
void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
|
||||
dReal radius, dReal length);
|
||||
|
||||
void dMassSetBox (dMass *, dReal density,
|
||||
dReal lx, dReal ly, dReal lz);
|
||||
void dMassSetBoxTotal (dMass *, dReal total_mass,
|
||||
dReal lx, dReal ly, dReal lz);
|
||||
|
||||
void dMassAdjust (dMass *, dReal newmass);
|
||||
|
||||
void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
|
||||
|
||||
void dMassRotate (dMass *, const dMatrix3 R);
|
||||
|
||||
void dMassAdd (dMass *a, const dMass *b);
|
||||
|
||||
|
||||
|
||||
struct dMass {
|
||||
dReal mass;
|
||||
dVector4 c;
|
||||
dMatrix3 I;
|
||||
|
||||
#ifdef __cplusplus
|
||||
dMass()
|
||||
{ dMassSetZero (this); }
|
||||
void setZero()
|
||||
{ dMassSetZero (this); }
|
||||
void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
|
||||
dReal I11, dReal I22, dReal I33,
|
||||
dReal I12, dReal I13, dReal I23)
|
||||
{ dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
|
||||
void setSphere (dReal density, dReal radius)
|
||||
{ dMassSetSphere (this,density,radius); }
|
||||
void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
|
||||
{ dMassSetCappedCylinder (this,density,direction,a,b); }
|
||||
void setBox (dReal density, dReal lx, dReal ly, dReal lz)
|
||||
{ dMassSetBox (this,density,lx,ly,lz); }
|
||||
void adjust (dReal newmass)
|
||||
{ dMassAdjust (this,newmass); }
|
||||
void translate (dReal x, dReal y, dReal z)
|
||||
{ dMassTranslate (this,x,y,z); }
|
||||
void rotate (const dMatrix3 R)
|
||||
{ dMassRotate (this,R); }
|
||||
void add (const dMass *b)
|
||||
{ dMassAdd (this,b); }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
194
Extras/ode/include/ode/matrix.h
Normal file
194
Extras/ode/include/ode/matrix.h
Normal file
@@ -0,0 +1,194 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/* optimized and unoptimized vector and matrix functions */
|
||||
|
||||
#ifndef _ODE_MATRIX_H_
|
||||
#define _ODE_MATRIX_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* set a vector/matrix of size n to all zeros, or to a specific value. */
|
||||
|
||||
void dSetZero (dReal *a, int n);
|
||||
void dSetValue (dReal *a, int n, dReal value);
|
||||
|
||||
|
||||
/* get the dot product of two n*1 vectors. if n <= 0 then
|
||||
* zero will be returned (in which case a and b need not be valid).
|
||||
*/
|
||||
|
||||
dReal dDot (const dReal *a, const dReal *b, int n);
|
||||
|
||||
|
||||
/* get the dot products of (a0,b), (a1,b), etc and return them in outsum.
|
||||
* all vectors are n*1. if n <= 0 then zeroes will be returned (in which case
|
||||
* the input vectors need not be valid). this function is somewhat faster
|
||||
* than calling dDot() for all of the combinations separately.
|
||||
*/
|
||||
|
||||
/* NOT INCLUDED in the library for now.
|
||||
void dMultidot2 (const dReal *a0, const dReal *a1,
|
||||
const dReal *b, dReal *outsum, int n);
|
||||
*/
|
||||
|
||||
|
||||
/* matrix multiplication. all matrices are stored in standard row format.
|
||||
* the digit refers to the argument that is transposed:
|
||||
* 0: A = B * C (sizes: A:p*r B:p*q C:q*r)
|
||||
* 1: A = B' * C (sizes: A:p*r B:q*p C:q*r)
|
||||
* 2: A = B * C' (sizes: A:p*r B:p*q C:r*q)
|
||||
* case 1,2 are equivalent to saying that the operation is A=B*C but
|
||||
* B or C are stored in standard column format.
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/* do an in-place cholesky decomposition on the lower triangle of the n*n
|
||||
* symmetric matrix A (which is stored by rows). the resulting lower triangle
|
||||
* will be such that L*L'=A. return 1 on success and 0 on failure (on failure
|
||||
* the matrix is not positive definite).
|
||||
*/
|
||||
|
||||
int dFactorCholesky (dReal *A, int n);
|
||||
|
||||
|
||||
/* solve for x: L*L'*x = b, and put the result back into x.
|
||||
* L is size n*n, b is size n*1. only the lower triangle of L is considered.
|
||||
*/
|
||||
|
||||
void dSolveCholesky (const dReal *L, dReal *b, int n);
|
||||
|
||||
|
||||
/* compute the inverse of the n*n positive definite matrix A and put it in
|
||||
* Ainv. this is not especially fast. this returns 1 on success (A was
|
||||
* positive definite) or 0 on failure (not PD).
|
||||
*/
|
||||
|
||||
int dInvertPDMatrix (const dReal *A, dReal *Ainv, int n);
|
||||
|
||||
|
||||
/* check whether an n*n matrix A is positive definite, return 1/0 (yes/no).
|
||||
* positive definite means that x'*A*x > 0 for any x. this performs a
|
||||
* cholesky decomposition of A. if the decomposition fails then the matrix
|
||||
* is not positive definite. A is stored by rows. A is not altered.
|
||||
*/
|
||||
|
||||
int dIsPositiveDefinite (const dReal *A, int n);
|
||||
|
||||
|
||||
/* factorize a matrix A into L*D*L', where L is lower triangular with ones on
|
||||
* the diagonal, and D is diagonal.
|
||||
* A is an n*n matrix stored by rows, with a leading dimension of n rounded
|
||||
* up to 4. L is written into the strict lower triangle of A (the ones are not
|
||||
* written) and the reciprocal of the diagonal elements of D are written into
|
||||
* d.
|
||||
*/
|
||||
void dFactorLDLT (dReal *A, dReal *d, int n, int nskip);
|
||||
|
||||
|
||||
/* solve L*x=b, where L is n*n lower triangular with ones on the diagonal,
|
||||
* and x,b are n*1. b is overwritten with x.
|
||||
* the leading dimension of L is `nskip'.
|
||||
*/
|
||||
void dSolveL1 (const dReal *L, dReal *b, int n, int nskip);
|
||||
|
||||
|
||||
/* solve L'*x=b, where L is n*n lower triangular with ones on the diagonal,
|
||||
* and x,b are n*1. b is overwritten with x.
|
||||
* the leading dimension of L is `nskip'.
|
||||
*/
|
||||
void dSolveL1T (const dReal *L, dReal *b, int n, int nskip);
|
||||
|
||||
|
||||
/* in matlab syntax: a(1:n) = a(1:n) .* d(1:n) */
|
||||
|
||||
void dVectorScale (dReal *a, const dReal *d, int n);
|
||||
|
||||
|
||||
/* given `L', a n*n lower triangular matrix with ones on the diagonal,
|
||||
* and `d', a n*1 vector of the reciprocal diagonal elements of an n*n matrix
|
||||
* D, solve L*D*L'*x=b where x,b are n*1. x overwrites b.
|
||||
* the leading dimension of L is `nskip'.
|
||||
*/
|
||||
|
||||
void dSolveLDLT (const dReal *L, const dReal *d, dReal *b, int n, int nskip);
|
||||
|
||||
|
||||
/* given an L*D*L' factorization of an n*n matrix A, return the updated
|
||||
* factorization L2*D2*L2' of A plus the following "top left" matrix:
|
||||
*
|
||||
* [ b a' ] <-- b is a[0]
|
||||
* [ a 0 ] <-- a is a[1..n-1]
|
||||
*
|
||||
* - L has size n*n, its leading dimension is nskip. L is lower triangular
|
||||
* with ones on the diagonal. only the lower triangle of L is referenced.
|
||||
* - d has size n. d contains the reciprocal diagonal elements of D.
|
||||
* - a has size n.
|
||||
* the result is written into L, except that the left column of L and d[0]
|
||||
* are not actually modified. see ldltaddTL.m for further comments.
|
||||
*/
|
||||
void dLDLTAddTL (dReal *L, dReal *d, const dReal *a, int n, int nskip);
|
||||
|
||||
|
||||
/* given an L*D*L' factorization of a permuted matrix A, produce a new
|
||||
* factorization for row and column `r' removed.
|
||||
* - A has size n1*n1, its leading dimension in nskip. A is symmetric and
|
||||
* positive definite. only the lower triangle of A is referenced.
|
||||
* A itself may actually be an array of row pointers.
|
||||
* - L has size n2*n2, its leading dimension in nskip. L is lower triangular
|
||||
* with ones on the diagonal. only the lower triangle of L is referenced.
|
||||
* - d has size n2. d contains the reciprocal diagonal elements of D.
|
||||
* - p is a permutation vector. it contains n2 indexes into A. each index
|
||||
* must be in the range 0..n1-1.
|
||||
* - r is the row/column of L to remove.
|
||||
* the new L will be written within the old L, i.e. will have the same leading
|
||||
* dimension. the last row and column of L, and the last element of d, are
|
||||
* undefined on exit.
|
||||
*
|
||||
* a fast O(n^2) algorithm is used. see ldltremove.m for further comments.
|
||||
*/
|
||||
void dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d,
|
||||
int n1, int n2, int r, int nskip);
|
||||
|
||||
|
||||
/* given an n*n matrix A (with leading dimension nskip), remove the r'th row
|
||||
* 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.
|
||||
*/
|
||||
void dRemoveRowCol (dReal *A, int n, int nskip, int r);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
59
Extras/ode/include/ode/memory.h
Normal file
59
Extras/ode/include/ode/memory.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/* this comes from the `reuse' library. copy any changes back to the source */
|
||||
|
||||
#ifndef _ODE_MEMORY_H_
|
||||
#define _ODE_MEMORY_H_
|
||||
|
||||
#include "ode/config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* function types to allocate and free memory */
|
||||
typedef void * dAllocFunction (size_t size);
|
||||
typedef void * dReallocFunction (void *ptr, size_t oldsize, size_t newsize);
|
||||
typedef void dFreeFunction (void *ptr, size_t size);
|
||||
|
||||
/* set new memory management functions. if fn is 0, the default handlers are
|
||||
* used. */
|
||||
void dSetAllocHandler (dAllocFunction *fn);
|
||||
void dSetReallocHandler (dReallocFunction *fn);
|
||||
void dSetFreeHandler (dFreeFunction *fn);
|
||||
|
||||
/* get current memory management functions */
|
||||
dAllocFunction *dGetAllocHandler (void);
|
||||
dReallocFunction *dGetReallocHandler (void);
|
||||
dFreeFunction *dGetFreeHandler (void);
|
||||
|
||||
/* allocate and free memory. */
|
||||
void * dAlloc (size_t size);
|
||||
void * dRealloc (void *ptr, size_t oldsize, size_t newsize);
|
||||
void dFree (void *ptr, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
85
Extras/ode/include/ode/misc.h
Normal file
85
Extras/ode/include/ode/misc.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/* miscellaneous math functions. these are mostly useful for testing */
|
||||
|
||||
#ifndef _ODE_MISC_H_
|
||||
#define _ODE_MISC_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* return 1 if the random number generator is working. */
|
||||
int dTestRand(void);
|
||||
|
||||
/* return next 32 bit random number. this uses a not-very-random linear
|
||||
* congruential method.
|
||||
*/
|
||||
unsigned long dRand(void);
|
||||
|
||||
/* get and set the current random number seed. */
|
||||
unsigned long dRandGetSeed(void);
|
||||
void dRandSetSeed (unsigned long s);
|
||||
|
||||
/* return a random integer between 0..n-1. the distribution will get worse
|
||||
* as n approaches 2^32.
|
||||
*/
|
||||
int dRandInt (int n);
|
||||
|
||||
/* return a random real number between 0..1 */
|
||||
dReal dRandReal(void);
|
||||
|
||||
/* print out a matrix */
|
||||
#ifdef __cplusplus
|
||||
void dPrintMatrix (const dReal *A, int n, int m, char *fmt = "%10.4f ",
|
||||
FILE *f=stdout);
|
||||
#else
|
||||
void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f);
|
||||
#endif
|
||||
|
||||
/* make a random vector with entries between +/- range. A has n elements. */
|
||||
void dMakeRandomVector (dReal *A, int n, dReal range);
|
||||
|
||||
/* make a random matrix with entries between +/- range. A has size n*m. */
|
||||
void dMakeRandomMatrix (dReal *A, int n, int m, dReal range);
|
||||
|
||||
/* clear the upper triangle of a square matrix */
|
||||
void dClearUpperTriangle (dReal *A, int n);
|
||||
|
||||
/* return the maximum element difference between the two n*m matrices */
|
||||
dReal dMaxDifference (const dReal *A, const dReal *B, int n, int m);
|
||||
|
||||
/* return the maximum element difference between the lower triangle of two
|
||||
* n*n matrices */
|
||||
dReal dMaxDifferenceLowerTriangle (const dReal *A, const dReal *B, int n);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
269
Extras/ode/include/ode/objects.h
Normal file
269
Extras/ode/include/ode/objects.h
Normal file
@@ -0,0 +1,269 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_OBJECTS_H_
|
||||
#define _ODE_OBJECTS_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
#include <ode/mass.h>
|
||||
#include <ode/contact.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* world */
|
||||
|
||||
dWorldID dWorldCreate(void);
|
||||
void dWorldDestroy (dWorldID);
|
||||
|
||||
void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z);
|
||||
void dWorldGetGravity (dWorldID, dVector3 gravity);
|
||||
void dWorldSetERP (dWorldID, dReal erp);
|
||||
dReal dWorldGetERP (dWorldID);
|
||||
void dWorldSetCFM (dWorldID, dReal cfm);
|
||||
dReal dWorldGetCFM (dWorldID);
|
||||
void dWorldStep (dWorldID, dReal stepsize);
|
||||
void dWorldImpulseToForce (dWorldID, dReal stepsize,
|
||||
dReal ix, dReal iy, dReal iz, dVector3 force);
|
||||
|
||||
/* World QuickStep functions */
|
||||
|
||||
void dWorldQuickStep (dWorldID w, dReal stepsize);
|
||||
void dWorldSetQuickStepNumIterations (dWorldID, int num);
|
||||
int dWorldGetQuickStepNumIterations (dWorldID);
|
||||
void dWorldSetQuickStepW (dWorldID, dReal param);
|
||||
dReal dWorldGetQuickStepW (dWorldID);
|
||||
|
||||
/* World contact parameter functions */
|
||||
|
||||
void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel);
|
||||
dReal dWorldGetContactMaxCorrectingVel (dWorldID);
|
||||
void dWorldSetContactSurfaceLayer (dWorldID, dReal depth);
|
||||
dReal dWorldGetContactSurfaceLayer (dWorldID);
|
||||
|
||||
/* StepFast1 functions */
|
||||
|
||||
void dWorldStepFast1(dWorldID, dReal stepsize, int maxiterations);
|
||||
void dWorldSetAutoEnableDepthSF1(dWorldID, int autoEnableDepth);
|
||||
int dWorldGetAutoEnableDepthSF1(dWorldID);
|
||||
|
||||
/* Auto-disable functions */
|
||||
|
||||
dReal dWorldGetAutoDisableLinearThreshold (dWorldID);
|
||||
void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold);
|
||||
dReal dWorldGetAutoDisableAngularThreshold (dWorldID);
|
||||
void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold);
|
||||
int dWorldGetAutoDisableSteps (dWorldID);
|
||||
void dWorldSetAutoDisableSteps (dWorldID, int steps);
|
||||
dReal dWorldGetAutoDisableTime (dWorldID);
|
||||
void dWorldSetAutoDisableTime (dWorldID, dReal time);
|
||||
int dWorldGetAutoDisableFlag (dWorldID);
|
||||
void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable);
|
||||
|
||||
dReal dBodyGetAutoDisableLinearThreshold (dBodyID);
|
||||
void dBodySetAutoDisableLinearThreshold (dBodyID, dReal linear_threshold);
|
||||
dReal dBodyGetAutoDisableAngularThreshold (dBodyID);
|
||||
void dBodySetAutoDisableAngularThreshold (dBodyID, dReal angular_threshold);
|
||||
int dBodyGetAutoDisableSteps (dBodyID);
|
||||
void dBodySetAutoDisableSteps (dBodyID, int steps);
|
||||
dReal dBodyGetAutoDisableTime (dBodyID);
|
||||
void dBodySetAutoDisableTime (dBodyID, dReal time);
|
||||
int dBodyGetAutoDisableFlag (dBodyID);
|
||||
void dBodySetAutoDisableFlag (dBodyID, int do_auto_disable);
|
||||
void dBodySetAutoDisableDefaults (dBodyID);
|
||||
|
||||
/* bodies */
|
||||
|
||||
dBodyID dBodyCreate (dWorldID);
|
||||
void dBodyDestroy (dBodyID);
|
||||
|
||||
void dBodySetData (dBodyID, void *data);
|
||||
void *dBodyGetData (dBodyID);
|
||||
|
||||
void dBodySetPosition (dBodyID, dReal x, dReal y, dReal z);
|
||||
void dBodySetRotation (dBodyID, const dMatrix3 R);
|
||||
void dBodySetQuaternion (dBodyID, const dQuaternion q);
|
||||
void dBodySetLinearVel (dBodyID, dReal x, dReal y, dReal z);
|
||||
void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z);
|
||||
const dReal * dBodyGetPosition (dBodyID);
|
||||
const dReal * dBodyGetRotation (dBodyID); /* ptr to 4x3 rot matrix */
|
||||
const dReal * dBodyGetQuaternion (dBodyID);
|
||||
const dReal * dBodyGetLinearVel (dBodyID);
|
||||
const dReal * dBodyGetAngularVel (dBodyID);
|
||||
|
||||
void dBodySetMass (dBodyID, const dMass *mass);
|
||||
void dBodyGetMass (dBodyID, dMass *mass);
|
||||
|
||||
void dBodyAddForce (dBodyID, dReal fx, dReal fy, dReal fz);
|
||||
void dBodyAddTorque (dBodyID, dReal fx, dReal fy, dReal fz);
|
||||
void dBodyAddRelForce (dBodyID, dReal fx, dReal fy, dReal fz);
|
||||
void dBodyAddRelTorque (dBodyID, dReal fx, dReal fy, dReal fz);
|
||||
void dBodyAddForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz);
|
||||
void dBodyAddForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz);
|
||||
void dBodyAddRelForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz);
|
||||
void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz);
|
||||
|
||||
const dReal * dBodyGetForce (dBodyID);
|
||||
const dReal * dBodyGetTorque (dBodyID);
|
||||
void dBodySetForce (dBodyID b, dReal x, dReal y, dReal z);
|
||||
void dBodySetTorque (dBodyID b, dReal x, dReal y, dReal z);
|
||||
|
||||
void dBodyGetRelPointPos (dBodyID, dReal px, dReal py, dReal pz,
|
||||
dVector3 result);
|
||||
void dBodyGetRelPointVel (dBodyID, dReal px, dReal py, dReal pz,
|
||||
dVector3 result);
|
||||
void dBodyGetPointVel (dBodyID, dReal px, dReal py, dReal pz,
|
||||
dVector3 result);
|
||||
void dBodyGetPosRelPoint (dBodyID, dReal px, dReal py, dReal pz,
|
||||
dVector3 result);
|
||||
void dBodyVectorToWorld (dBodyID, dReal px, dReal py, dReal pz,
|
||||
dVector3 result);
|
||||
void dBodyVectorFromWorld (dBodyID, dReal px, dReal py, dReal pz,
|
||||
dVector3 result);
|
||||
|
||||
void dBodySetFiniteRotationMode (dBodyID, int mode);
|
||||
void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z);
|
||||
|
||||
int dBodyGetFiniteRotationMode (dBodyID);
|
||||
void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result);
|
||||
|
||||
int dBodyGetNumJoints (dBodyID b);
|
||||
dJointID dBodyGetJoint (dBodyID, int index);
|
||||
|
||||
void dBodyEnable (dBodyID);
|
||||
void dBodyDisable (dBodyID);
|
||||
int dBodyIsEnabled (dBodyID);
|
||||
|
||||
void dBodySetGravityMode (dBodyID b, int mode);
|
||||
int dBodyGetGravityMode (dBodyID b);
|
||||
|
||||
|
||||
/* joints */
|
||||
|
||||
dJointID dJointCreateBall (dWorldID, dJointGroupID);
|
||||
dJointID dJointCreateHinge (dWorldID, dJointGroupID);
|
||||
dJointID dJointCreateSlider (dWorldID, dJointGroupID);
|
||||
dJointID dJointCreateContact (dWorldID, dJointGroupID, const dContact *);
|
||||
dJointID dJointCreateHinge2 (dWorldID, dJointGroupID);
|
||||
dJointID dJointCreateUniversal (dWorldID, dJointGroupID);
|
||||
dJointID dJointCreateFixed (dWorldID, dJointGroupID);
|
||||
dJointID dJointCreateNull (dWorldID, dJointGroupID);
|
||||
dJointID dJointCreateAMotor (dWorldID, dJointGroupID);
|
||||
|
||||
void dJointDestroy (dJointID);
|
||||
|
||||
dJointGroupID dJointGroupCreate (int max_size);
|
||||
void dJointGroupDestroy (dJointGroupID);
|
||||
void dJointGroupEmpty (dJointGroupID);
|
||||
|
||||
void dJointAttach (dJointID, dBodyID body1, dBodyID body2);
|
||||
void dJointSetData (dJointID, void *data);
|
||||
void *dJointGetData (dJointID);
|
||||
int dJointGetType (dJointID);
|
||||
dBodyID dJointGetBody (dJointID, int index);
|
||||
|
||||
void dJointSetFeedback (dJointID, dJointFeedback *);
|
||||
dJointFeedback *dJointGetFeedback (dJointID);
|
||||
|
||||
void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetBallAnchor2 (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetHingeAnchorDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
|
||||
void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetHingeParam (dJointID, int parameter, dReal value);
|
||||
void dJointAddHingeTorque(dJointID joint, dReal torque);
|
||||
void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetSliderAxisDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
|
||||
void dJointSetSliderParam (dJointID, int parameter, dReal value);
|
||||
void dJointAddSliderForce(dJointID joint, dReal force);
|
||||
void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetHinge2Param (dJointID, int parameter, dReal value);
|
||||
void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2);
|
||||
void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z);
|
||||
void dJointSetUniversalParam (dJointID, int parameter, dReal value);
|
||||
void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2);
|
||||
void dJointSetFixed (dJointID);
|
||||
void dJointSetAMotorNumAxes (dJointID, int num);
|
||||
void dJointSetAMotorAxis (dJointID, int anum, int rel,
|
||||
dReal x, dReal y, dReal z);
|
||||
void dJointSetAMotorAngle (dJointID, int anum, dReal angle);
|
||||
void dJointSetAMotorParam (dJointID, int parameter, dReal value);
|
||||
void dJointSetAMotorMode (dJointID, int mode);
|
||||
void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3);
|
||||
|
||||
void dJointGetBallAnchor (dJointID, dVector3 result);
|
||||
void dJointGetBallAnchor2 (dJointID, dVector3 result);
|
||||
void dJointGetHingeAnchor (dJointID, dVector3 result);
|
||||
void dJointGetHingeAnchor2 (dJointID, dVector3 result);
|
||||
void dJointGetHingeAxis (dJointID, dVector3 result);
|
||||
dReal dJointGetHingeParam (dJointID, int parameter);
|
||||
dReal dJointGetHingeAngle (dJointID);
|
||||
dReal dJointGetHingeAngleRate (dJointID);
|
||||
dReal dJointGetSliderPosition (dJointID);
|
||||
dReal dJointGetSliderPositionRate (dJointID);
|
||||
void dJointGetSliderAxis (dJointID, dVector3 result);
|
||||
dReal dJointGetSliderParam (dJointID, int parameter);
|
||||
void dJointGetHinge2Anchor (dJointID, dVector3 result);
|
||||
void dJointGetHinge2Anchor2 (dJointID, dVector3 result);
|
||||
void dJointGetHinge2Axis1 (dJointID, dVector3 result);
|
||||
void dJointGetHinge2Axis2 (dJointID, dVector3 result);
|
||||
dReal dJointGetHinge2Param (dJointID, int parameter);
|
||||
dReal dJointGetHinge2Angle1 (dJointID);
|
||||
dReal dJointGetHinge2Angle1Rate (dJointID);
|
||||
dReal dJointGetHinge2Angle2Rate (dJointID);
|
||||
void dJointGetUniversalAnchor (dJointID, dVector3 result);
|
||||
void dJointGetUniversalAnchor2 (dJointID, dVector3 result);
|
||||
void dJointGetUniversalAxis1 (dJointID, dVector3 result);
|
||||
void dJointGetUniversalAxis2 (dJointID, dVector3 result);
|
||||
dReal dJointGetUniversalParam (dJointID, int parameter);
|
||||
dReal dJointGetUniversalAngle1 (dJointID);
|
||||
dReal dJointGetUniversalAngle2 (dJointID);
|
||||
dReal dJointGetUniversalAngle1Rate (dJointID);
|
||||
dReal dJointGetUniversalAngle2Rate (dJointID);
|
||||
int dJointGetAMotorNumAxes (dJointID);
|
||||
void dJointGetAMotorAxis (dJointID, int anum, dVector3 result);
|
||||
int dJointGetAMotorAxisRel (dJointID, int anum);
|
||||
dReal dJointGetAMotorAngle (dJointID, int anum);
|
||||
dReal dJointGetAMotorAngleRate (dJointID, int anum);
|
||||
dReal dJointGetAMotorParam (dJointID, int parameter);
|
||||
int dJointGetAMotorMode (dJointID);
|
||||
|
||||
dJointID dConnectingJoint (dBodyID, dBodyID);
|
||||
int dConnectingJointList (dBodyID, dBodyID, dJointID*);
|
||||
int dAreConnected (dBodyID, dBodyID);
|
||||
int dAreConnectedExcluding (dBodyID, dBodyID, int joint_type);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
47
Extras/ode/include/ode/ode.h
Normal file
47
Extras/ode/include/ode/ode.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_ODE_H_
|
||||
#define _ODE_ODE_H_
|
||||
|
||||
/* include *everything* here */
|
||||
|
||||
#include <ode/config.h>
|
||||
#include <ode/compatibility.h>
|
||||
#include <ode/common.h>
|
||||
#include <ode/contact.h>
|
||||
#include <ode/error.h>
|
||||
#include <ode/memory.h>
|
||||
#include <ode/odemath.h>
|
||||
#include <ode/matrix.h>
|
||||
#include <ode/timer.h>
|
||||
#include <ode/rotation.h>
|
||||
#include <ode/mass.h>
|
||||
#include <ode/misc.h>
|
||||
#include <ode/objects.h>
|
||||
#include <ode/odecpp.h>
|
||||
#include <ode/collision_space.h>
|
||||
#include <ode/collision.h>
|
||||
#include <ode/odecpp_collision.h>
|
||||
#include <ode/export-dif.h>
|
||||
|
||||
#endif
|
||||
621
Extras/ode/include/ode/odecpp.h
Normal file
621
Extras/ode/include/ode/odecpp.h
Normal file
@@ -0,0 +1,621 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/* C++ interface for non-collision stuff */
|
||||
|
||||
|
||||
#ifndef _ODE_ODECPP_H_
|
||||
#define _ODE_ODECPP_H_
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ode/error.h>
|
||||
|
||||
|
||||
class dWorld {
|
||||
dWorldID _id;
|
||||
|
||||
// intentionally undefined, don't use these
|
||||
dWorld (const dWorld &);
|
||||
void operator= (const dWorld &);
|
||||
|
||||
public:
|
||||
dWorld()
|
||||
{ _id = dWorldCreate(); }
|
||||
~dWorld()
|
||||
{ dWorldDestroy (_id); }
|
||||
|
||||
dWorldID id() const
|
||||
{ return _id; }
|
||||
operator dWorldID() const
|
||||
{ return _id; }
|
||||
|
||||
void setGravity (dReal x, dReal y, dReal z)
|
||||
{ dWorldSetGravity (_id,x,y,z); }
|
||||
void getGravity (dVector3 g) const
|
||||
{ dWorldGetGravity (_id,g); }
|
||||
|
||||
void setERP (dReal erp)
|
||||
{ dWorldSetERP(_id, erp); }
|
||||
dReal getERP() const
|
||||
{ return dWorldGetERP(_id); }
|
||||
|
||||
void setCFM (dReal cfm)
|
||||
{ dWorldSetCFM(_id, cfm); }
|
||||
dReal getCFM() const
|
||||
{ return dWorldGetCFM(_id); }
|
||||
|
||||
void step (dReal stepsize)
|
||||
{ dWorldStep (_id,stepsize); }
|
||||
|
||||
void stepFast1 (dReal stepsize, int maxiterations)
|
||||
{ dWorldStepFast1 (_id,stepsize,maxiterations); }
|
||||
void setAutoEnableDepthSF1(dWorldID, int depth)
|
||||
{ dWorldSetAutoEnableDepthSF1 (_id, depth); }
|
||||
int getAutoEnableDepthSF1(dWorldID)
|
||||
{ return dWorldGetAutoEnableDepthSF1 (_id); }
|
||||
|
||||
void setAutoDisableLinearThreshold (dReal threshold)
|
||||
{ dWorldSetAutoDisableLinearThreshold (_id,threshold); }
|
||||
dReal getAutoDisableLinearThreshold()
|
||||
{ return dWorldGetAutoDisableLinearThreshold (_id); }
|
||||
void setAutoDisableAngularThreshold (dReal threshold)
|
||||
{ dWorldSetAutoDisableAngularThreshold (_id,threshold); }
|
||||
dReal getAutoDisableAngularThreshold()
|
||||
{ return dWorldGetAutoDisableAngularThreshold (_id); }
|
||||
void setAutoDisableSteps (int steps)
|
||||
{ dWorldSetAutoDisableSteps (_id,steps); }
|
||||
int getAutoDisableSteps()
|
||||
{ return dWorldGetAutoDisableSteps (_id); }
|
||||
void setAutoDisableTime (dReal time)
|
||||
{ dWorldSetAutoDisableTime (_id,time); }
|
||||
dReal getAutoDisableTime()
|
||||
{ return dWorldGetAutoDisableTime (_id); }
|
||||
void setAutoDisableFlag (int do_auto_disable)
|
||||
{ dWorldSetAutoDisableFlag (_id,do_auto_disable); }
|
||||
int getAutoDisableFlag()
|
||||
{ return dWorldGetAutoDisableFlag (_id); }
|
||||
|
||||
void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
|
||||
dVector3 force)
|
||||
{ dWorldImpulseToForce (_id,stepsize,ix,iy,iz,force); }
|
||||
};
|
||||
|
||||
|
||||
class dBody {
|
||||
dBodyID _id;
|
||||
|
||||
// intentionally undefined, don't use these
|
||||
dBody (const dBody &);
|
||||
void operator= (const dBody &);
|
||||
|
||||
public:
|
||||
dBody()
|
||||
{ _id = 0; }
|
||||
dBody (dWorldID world)
|
||||
{ _id = dBodyCreate (world); }
|
||||
~dBody()
|
||||
{ if (_id) dBodyDestroy (_id); }
|
||||
|
||||
void create (dWorldID world) {
|
||||
if (_id) dBodyDestroy (_id);
|
||||
_id = dBodyCreate (world);
|
||||
}
|
||||
|
||||
dBodyID id() const
|
||||
{ return _id; }
|
||||
operator dBodyID() const
|
||||
{ return _id; }
|
||||
|
||||
void setData (void *data)
|
||||
{ dBodySetData (_id,data); }
|
||||
void *getData() const
|
||||
{ return dBodyGetData (_id); }
|
||||
|
||||
void setPosition (dReal x, dReal y, dReal z)
|
||||
{ dBodySetPosition (_id,x,y,z); }
|
||||
void setRotation (const dMatrix3 R)
|
||||
{ dBodySetRotation (_id,R); }
|
||||
void setQuaternion (const dQuaternion q)
|
||||
{ dBodySetQuaternion (_id,q); }
|
||||
void setLinearVel (dReal x, dReal y, dReal z)
|
||||
{ dBodySetLinearVel (_id,x,y,z); }
|
||||
void setAngularVel (dReal x, dReal y, dReal z)
|
||||
{ dBodySetAngularVel (_id,x,y,z); }
|
||||
|
||||
const dReal * getPosition() const
|
||||
{ return dBodyGetPosition (_id); }
|
||||
const dReal * getRotation() const
|
||||
{ return dBodyGetRotation (_id); }
|
||||
const dReal * getQuaternion() const
|
||||
{ return dBodyGetQuaternion (_id); }
|
||||
const dReal * getLinearVel() const
|
||||
{ return dBodyGetLinearVel (_id); }
|
||||
const dReal * getAngularVel() const
|
||||
{ return dBodyGetAngularVel (_id); }
|
||||
|
||||
void setMass (const dMass *mass)
|
||||
{ dBodySetMass (_id,mass); }
|
||||
void getMass (dMass *mass) const
|
||||
{ dBodyGetMass (_id,mass); }
|
||||
|
||||
void addForce (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddForce (_id, fx, fy, fz); }
|
||||
void addTorque (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddTorque (_id, fx, fy, fz); }
|
||||
void addRelForce (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddRelForce (_id, fx, fy, fz); }
|
||||
void addRelTorque (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddRelTorque (_id, fx, fy, fz); }
|
||||
void addForceAtPos (dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz)
|
||||
{ dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
|
||||
void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz)
|
||||
{ dBodyAddForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
|
||||
void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz)
|
||||
{ dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
|
||||
void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz)
|
||||
{ dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
|
||||
|
||||
const dReal * getForce() const
|
||||
{ return dBodyGetForce(_id); }
|
||||
const dReal * getTorque() const
|
||||
{ return dBodyGetTorque(_id); }
|
||||
void setForce (dReal x, dReal y, dReal z)
|
||||
{ dBodySetForce (_id,x,y,z); }
|
||||
void setTorque (dReal x, dReal y, dReal z)
|
||||
{ dBodySetTorque (_id,x,y,z); }
|
||||
|
||||
void enable()
|
||||
{ dBodyEnable (_id); }
|
||||
void disable()
|
||||
{ dBodyDisable (_id); }
|
||||
int isEnabled() const
|
||||
{ return dBodyIsEnabled (_id); }
|
||||
|
||||
void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
|
||||
{ dBodyGetRelPointPos (_id, px, py, pz, result); }
|
||||
void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
|
||||
{ dBodyGetRelPointVel (_id, px, py, pz, result); }
|
||||
void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
|
||||
{ dBodyGetPointVel (_id,px,py,pz,result); }
|
||||
void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
|
||||
{ dBodyGetPosRelPoint (_id,px,py,pz,result); }
|
||||
void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
|
||||
{ dBodyVectorToWorld (_id,px,py,pz,result); }
|
||||
void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
|
||||
{ dBodyVectorFromWorld (_id,px,py,pz,result); }
|
||||
|
||||
void setFiniteRotationMode (int mode)
|
||||
{ dBodySetFiniteRotationMode (_id, mode); }
|
||||
void setFiniteRotationAxis (dReal x, dReal y, dReal z)
|
||||
{ dBodySetFiniteRotationAxis (_id, x, y, z); }
|
||||
|
||||
int getFiniteRotationMode() const
|
||||
{ return dBodyGetFiniteRotationMode (_id); }
|
||||
void getFiniteRotationAxis (dVector3 result) const
|
||||
{ dBodyGetFiniteRotationAxis (_id, result); }
|
||||
|
||||
int getNumJoints() const
|
||||
{ return dBodyGetNumJoints (_id); }
|
||||
dJointID getJoint (int index) const
|
||||
{ return dBodyGetJoint (_id, index); }
|
||||
|
||||
void setGravityMode (int mode)
|
||||
{ dBodySetGravityMode (_id,mode); }
|
||||
int getGravityMode() const
|
||||
{ return dBodyGetGravityMode (_id); }
|
||||
|
||||
int isConnectedTo (dBodyID body) const
|
||||
{ return dAreConnected (_id, body); }
|
||||
|
||||
void setAutoDisableLinearThreshold (dReal threshold)
|
||||
{ dBodySetAutoDisableLinearThreshold (_id,threshold); }
|
||||
dReal getAutoDisableLinearThreshold()
|
||||
{ return dBodyGetAutoDisableLinearThreshold (_id); }
|
||||
void setAutoDisableAngularThreshold (dReal threshold)
|
||||
{ dBodySetAutoDisableAngularThreshold (_id,threshold); }
|
||||
dReal getAutoDisableAngularThreshold()
|
||||
{ return dBodyGetAutoDisableAngularThreshold (_id); }
|
||||
void setAutoDisableSteps (int steps)
|
||||
{ dBodySetAutoDisableSteps (_id,steps); }
|
||||
int getAutoDisableSteps()
|
||||
{ return dBodyGetAutoDisableSteps (_id); }
|
||||
void setAutoDisableTime (dReal time)
|
||||
{ dBodySetAutoDisableTime (_id,time); }
|
||||
dReal getAutoDisableTime()
|
||||
{ return dBodyGetAutoDisableTime (_id); }
|
||||
void setAutoDisableFlag (int do_auto_disable)
|
||||
{ dBodySetAutoDisableFlag (_id,do_auto_disable); }
|
||||
int getAutoDisableFlag()
|
||||
{ return dBodyGetAutoDisableFlag (_id); }
|
||||
};
|
||||
|
||||
|
||||
class dJointGroup {
|
||||
dJointGroupID _id;
|
||||
|
||||
// intentionally undefined, don't use these
|
||||
dJointGroup (const dJointGroup &);
|
||||
void operator= (const dJointGroup &);
|
||||
|
||||
public:
|
||||
dJointGroup (int dummy_arg=0)
|
||||
{ _id = dJointGroupCreate (0); }
|
||||
~dJointGroup()
|
||||
{ dJointGroupDestroy (_id); }
|
||||
void create (int dummy_arg=0) {
|
||||
if (_id) dJointGroupDestroy (_id);
|
||||
_id = dJointGroupCreate (0);
|
||||
}
|
||||
|
||||
dJointGroupID id() const
|
||||
{ return _id; }
|
||||
operator dJointGroupID() const
|
||||
{ return _id; }
|
||||
|
||||
void empty()
|
||||
{ dJointGroupEmpty (_id); }
|
||||
};
|
||||
|
||||
|
||||
class dJoint {
|
||||
private:
|
||||
// intentionally undefined, don't use these
|
||||
dJoint (const dJoint &) ;
|
||||
void operator= (const dJoint &);
|
||||
|
||||
protected:
|
||||
dJointID _id;
|
||||
|
||||
public:
|
||||
dJoint()
|
||||
{ _id = 0; }
|
||||
~dJoint()
|
||||
{ if (_id) dJointDestroy (_id); }
|
||||
|
||||
dJointID id() const
|
||||
{ return _id; }
|
||||
operator dJointID() const
|
||||
{ return _id; }
|
||||
|
||||
void attach (dBodyID body1, dBodyID body2)
|
||||
{ dJointAttach (_id, body1, body2); }
|
||||
|
||||
void setData (void *data)
|
||||
{ dJointSetData (_id, data); }
|
||||
void *getData() const
|
||||
{ return dJointGetData (_id); }
|
||||
|
||||
int getType() const
|
||||
{ return dJointGetType (_id); }
|
||||
|
||||
dBodyID getBody (int index) const
|
||||
{ return dJointGetBody (_id, index); }
|
||||
};
|
||||
|
||||
|
||||
class dBallJoint : public dJoint {
|
||||
private:
|
||||
// intentionally undefined, don't use these
|
||||
dBallJoint (const dBallJoint &);
|
||||
void operator= (const dBallJoint &);
|
||||
|
||||
public:
|
||||
dBallJoint() { }
|
||||
dBallJoint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateBall (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateBall (world, group);
|
||||
}
|
||||
|
||||
void setAnchor (dReal x, dReal y, dReal z)
|
||||
{ dJointSetBallAnchor (_id, x, y, z); }
|
||||
void getAnchor (dVector3 result) const
|
||||
{ dJointGetBallAnchor (_id, result); }
|
||||
void getAnchor2 (dVector3 result) const
|
||||
{ dJointGetBallAnchor2 (_id, result); }
|
||||
} ;
|
||||
|
||||
|
||||
class dHingeJoint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dHingeJoint (const dHingeJoint &);
|
||||
void operator = (const dHingeJoint &);
|
||||
|
||||
public:
|
||||
dHingeJoint() { }
|
||||
dHingeJoint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateHinge (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateHinge (world, group);
|
||||
}
|
||||
|
||||
void setAnchor (dReal x, dReal y, dReal z)
|
||||
{ dJointSetHingeAnchor (_id, x, y, z); }
|
||||
void getAnchor (dVector3 result) const
|
||||
{ dJointGetHingeAnchor (_id, result); }
|
||||
void getAnchor2 (dVector3 result) const
|
||||
{ dJointGetHingeAnchor2 (_id, result); }
|
||||
|
||||
void setAxis (dReal x, dReal y, dReal z)
|
||||
{ dJointSetHingeAxis (_id, x, y, z); }
|
||||
void getAxis (dVector3 result) const
|
||||
{ dJointGetHingeAxis (_id, result); }
|
||||
|
||||
dReal getAngle() const
|
||||
{ return dJointGetHingeAngle (_id); }
|
||||
dReal getAngleRate() const
|
||||
{ return dJointGetHingeAngleRate (_id); }
|
||||
|
||||
void setParam (int parameter, dReal value)
|
||||
{ dJointSetHingeParam (_id, parameter, value); }
|
||||
dReal getParam (int parameter) const
|
||||
{ return dJointGetHingeParam (_id, parameter); }
|
||||
|
||||
void addTorque (dReal torque)
|
||||
{ dJointAddHingeTorque(_id, torque); }
|
||||
};
|
||||
|
||||
|
||||
class dSliderJoint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dSliderJoint (const dSliderJoint &);
|
||||
void operator = (const dSliderJoint &);
|
||||
|
||||
public:
|
||||
dSliderJoint() { }
|
||||
dSliderJoint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateSlider (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateSlider (world, group);
|
||||
}
|
||||
|
||||
void setAxis (dReal x, dReal y, dReal z)
|
||||
{ dJointSetSliderAxis (_id, x, y, z); }
|
||||
void getAxis (dVector3 result) const
|
||||
{ dJointGetSliderAxis (_id, result); }
|
||||
|
||||
dReal getPosition() const
|
||||
{ return dJointGetSliderPosition (_id); }
|
||||
dReal getPositionRate() const
|
||||
{ return dJointGetSliderPositionRate (_id); }
|
||||
|
||||
void setParam (int parameter, dReal value)
|
||||
{ dJointSetSliderParam (_id, parameter, value); }
|
||||
dReal getParam (int parameter) const
|
||||
{ return dJointGetSliderParam (_id, parameter); }
|
||||
|
||||
void addForce (dReal force)
|
||||
{ dJointAddSliderForce(_id, force); }
|
||||
};
|
||||
|
||||
|
||||
class dUniversalJoint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dUniversalJoint (const dUniversalJoint &);
|
||||
void operator = (const dUniversalJoint &);
|
||||
|
||||
public:
|
||||
dUniversalJoint() { }
|
||||
dUniversalJoint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateUniversal (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateUniversal (world, group);
|
||||
}
|
||||
|
||||
void setAnchor (dReal x, dReal y, dReal z)
|
||||
{ dJointSetUniversalAnchor (_id, x, y, z); }
|
||||
void setAxis1 (dReal x, dReal y, dReal z)
|
||||
{ dJointSetUniversalAxis1 (_id, x, y, z); }
|
||||
void setAxis2 (dReal x, dReal y, dReal z)
|
||||
{ dJointSetUniversalAxis2 (_id, x, y, z); }
|
||||
void setParam (int parameter, dReal value)
|
||||
{ dJointSetUniversalParam (_id, parameter, value); }
|
||||
|
||||
void getAnchor (dVector3 result) const
|
||||
{ dJointGetUniversalAnchor (_id, result); }
|
||||
void getAnchor2 (dVector3 result) const
|
||||
{ dJointGetUniversalAnchor2 (_id, result); }
|
||||
void getAxis1 (dVector3 result) const
|
||||
{ dJointGetUniversalAxis1 (_id, result); }
|
||||
void getAxis2 (dVector3 result) const
|
||||
{ dJointGetUniversalAxis2 (_id, result); }
|
||||
dReal getParam (int parameter) const
|
||||
{ return dJointGetUniversalParam (_id, parameter); }
|
||||
dReal getAngle1() const
|
||||
{ return dJointGetUniversalAngle1 (_id); }
|
||||
dReal getAngle1Rate() const
|
||||
{ return dJointGetUniversalAngle1Rate (_id); }
|
||||
dReal getAngle2() const
|
||||
{ return dJointGetUniversalAngle2 (_id); }
|
||||
dReal getAngle2Rate() const
|
||||
{ return dJointGetUniversalAngle2Rate (_id); }
|
||||
|
||||
void addTorques (dReal torque1, dReal torque2)
|
||||
{ dJointAddUniversalTorques(_id, torque1, torque2); }
|
||||
};
|
||||
|
||||
|
||||
class dHinge2Joint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dHinge2Joint (const dHinge2Joint &);
|
||||
void operator = (const dHinge2Joint &);
|
||||
|
||||
public:
|
||||
dHinge2Joint() { }
|
||||
dHinge2Joint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateHinge2 (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateHinge2 (world, group);
|
||||
}
|
||||
|
||||
void setAnchor (dReal x, dReal y, dReal z)
|
||||
{ dJointSetHinge2Anchor (_id, x, y, z); }
|
||||
void setAxis1 (dReal x, dReal y, dReal z)
|
||||
{ dJointSetHinge2Axis1 (_id, x, y, z); }
|
||||
void setAxis2 (dReal x, dReal y, dReal z)
|
||||
{ dJointSetHinge2Axis2 (_id, x, y, z); }
|
||||
|
||||
void getAnchor (dVector3 result) const
|
||||
{ dJointGetHinge2Anchor (_id, result); }
|
||||
void getAnchor2 (dVector3 result) const
|
||||
{ dJointGetHinge2Anchor2 (_id, result); }
|
||||
void getAxis1 (dVector3 result) const
|
||||
{ dJointGetHinge2Axis1 (_id, result); }
|
||||
void getAxis2 (dVector3 result) const
|
||||
{ dJointGetHinge2Axis2 (_id, result); }
|
||||
|
||||
dReal getAngle1() const
|
||||
{ return dJointGetHinge2Angle1 (_id); }
|
||||
dReal getAngle1Rate() const
|
||||
{ return dJointGetHinge2Angle1Rate (_id); }
|
||||
dReal getAngle2Rate() const
|
||||
{ return dJointGetHinge2Angle2Rate (_id); }
|
||||
|
||||
void setParam (int parameter, dReal value)
|
||||
{ dJointSetHinge2Param (_id, parameter, value); }
|
||||
dReal getParam (int parameter) const
|
||||
{ return dJointGetHinge2Param (_id, parameter); }
|
||||
|
||||
void addTorques(dReal torque1, dReal torque2)
|
||||
{ dJointAddHinge2Torques(_id, torque1, torque2); }
|
||||
};
|
||||
|
||||
|
||||
class dFixedJoint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dFixedJoint (const dFixedJoint &);
|
||||
void operator = (const dFixedJoint &);
|
||||
|
||||
public:
|
||||
dFixedJoint() { }
|
||||
dFixedJoint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateFixed (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateFixed (world, group);
|
||||
}
|
||||
|
||||
void set()
|
||||
{ dJointSetFixed (_id); }
|
||||
};
|
||||
|
||||
|
||||
class dContactJoint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dContactJoint (const dContactJoint &);
|
||||
void operator = (const dContactJoint &);
|
||||
|
||||
public:
|
||||
dContactJoint() { }
|
||||
dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
|
||||
{ _id = dJointCreateContact (world, group, contact); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group, dContact *contact) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateContact (world, group, contact);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class dNullJoint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dNullJoint (const dNullJoint &);
|
||||
void operator = (const dNullJoint &);
|
||||
|
||||
public:
|
||||
dNullJoint() { }
|
||||
dNullJoint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateNull (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateNull (world, group);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class dAMotorJoint : public dJoint {
|
||||
// intentionally undefined, don't use these
|
||||
dAMotorJoint (const dAMotorJoint &);
|
||||
void operator = (const dAMotorJoint &);
|
||||
|
||||
public:
|
||||
dAMotorJoint() { }
|
||||
dAMotorJoint (dWorldID world, dJointGroupID group=0)
|
||||
{ _id = dJointCreateAMotor (world, group); }
|
||||
|
||||
void create (dWorldID world, dJointGroupID group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateAMotor (world, group);
|
||||
}
|
||||
|
||||
void setMode (int mode)
|
||||
{ dJointSetAMotorMode (_id, mode); }
|
||||
int getMode() const
|
||||
{ return dJointGetAMotorMode (_id); }
|
||||
|
||||
void setNumAxes (int num)
|
||||
{ dJointSetAMotorNumAxes (_id, num); }
|
||||
int getNumAxes() const
|
||||
{ return dJointGetAMotorNumAxes (_id); }
|
||||
|
||||
void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
|
||||
{ dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
|
||||
void getAxis (int anum, dVector3 result) const
|
||||
{ dJointGetAMotorAxis (_id, anum, result); }
|
||||
int getAxisRel (int anum) const
|
||||
{ return dJointGetAMotorAxisRel (_id, anum); }
|
||||
|
||||
void setAngle (int anum, dReal angle)
|
||||
{ dJointSetAMotorAngle (_id, anum, angle); }
|
||||
dReal getAngle (int anum) const
|
||||
{ return dJointGetAMotorAngle (_id, anum); }
|
||||
dReal getAngleRate (int anum)
|
||||
{ return dJointGetAMotorAngleRate (_id,anum); }
|
||||
|
||||
void setParam (int parameter, dReal value)
|
||||
{ dJointSetAMotorParam (_id, parameter, value); }
|
||||
dReal getParam (int parameter) const
|
||||
{ return dJointGetAMotorParam (_id, parameter); }
|
||||
|
||||
void addTorques(dReal torque1, dReal torque2, dReal torque3)
|
||||
{ dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
346
Extras/ode/include/ode/odecpp_collision.h
Normal file
346
Extras/ode/include/ode/odecpp_collision.h
Normal file
@@ -0,0 +1,346 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/* C++ interface for new collision API */
|
||||
|
||||
|
||||
#ifndef _ODE_ODECPP_COLLISION_H_
|
||||
#define _ODE_ODECPP_COLLISION_H_
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ode/error.h>
|
||||
|
||||
|
||||
class dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dGeom (dGeom &);
|
||||
void operator= (dGeom &);
|
||||
|
||||
protected:
|
||||
dGeomID _id;
|
||||
|
||||
public:
|
||||
dGeom()
|
||||
{ _id = 0; }
|
||||
~dGeom()
|
||||
{ if (_id) dGeomDestroy (_id); }
|
||||
|
||||
dGeomID id() const
|
||||
{ return _id; }
|
||||
operator dGeomID() const
|
||||
{ return _id; }
|
||||
|
||||
void destroy() {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = 0;
|
||||
}
|
||||
|
||||
int getClass() const
|
||||
{ return dGeomGetClass (_id); }
|
||||
|
||||
dSpaceID getSpace() const
|
||||
{ return dGeomGetSpace (_id); }
|
||||
|
||||
void setData (void *data)
|
||||
{ dGeomSetData (_id,data); }
|
||||
void *getData() const
|
||||
{ return dGeomGetData (_id); }
|
||||
|
||||
void setBody (dBodyID b)
|
||||
{ dGeomSetBody (_id,b); }
|
||||
dBodyID getBody() const
|
||||
{ return dGeomGetBody (_id); }
|
||||
|
||||
void setPosition (dReal x, dReal y, dReal z)
|
||||
{ dGeomSetPosition (_id,x,y,z); }
|
||||
const dReal * getPosition() const
|
||||
{ return dGeomGetPosition (_id); }
|
||||
|
||||
void setRotation (const dMatrix3 R)
|
||||
{ dGeomSetRotation (_id,R); }
|
||||
const dReal * getRotation() const
|
||||
{ return dGeomGetRotation (_id); }
|
||||
|
||||
void setQuaternion (const dQuaternion quat)
|
||||
{ dGeomSetQuaternion (_id,quat); }
|
||||
void getQuaternion (dQuaternion quat) const
|
||||
{ dGeomGetQuaternion (_id,quat); }
|
||||
|
||||
void getAABB (dReal aabb[6]) const
|
||||
{ dGeomGetAABB (_id, aabb); }
|
||||
|
||||
int isSpace()
|
||||
{ return dGeomIsSpace (_id); }
|
||||
|
||||
void setCategoryBits (unsigned long bits)
|
||||
{ dGeomSetCategoryBits (_id, bits); }
|
||||
void setCollideBits (unsigned long bits)
|
||||
{ dGeomSetCollideBits (_id, bits); }
|
||||
unsigned long getCategoryBits()
|
||||
{ return dGeomGetCategoryBits (_id); }
|
||||
unsigned long getCollideBits()
|
||||
{ return dGeomGetCollideBits (_id); }
|
||||
|
||||
void enable()
|
||||
{ dGeomEnable (_id); }
|
||||
void disable()
|
||||
{ dGeomDisable (_id); }
|
||||
int isEnabled()
|
||||
{ return dGeomIsEnabled (_id); }
|
||||
|
||||
void collide2 (dGeomID g, void *data, dNearCallback *callback)
|
||||
{ dSpaceCollide2 (_id,g,data,callback); }
|
||||
};
|
||||
|
||||
|
||||
class dSpace : public dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dSpace (dSpace &);
|
||||
void operator= (dSpace &);
|
||||
|
||||
protected:
|
||||
// the default constructor is protected so that you
|
||||
// can't instance this class. you must instance one
|
||||
// of its subclasses instead.
|
||||
dSpace () { _id = 0; }
|
||||
|
||||
public:
|
||||
dSpaceID id() const
|
||||
{ return (dSpaceID) _id; }
|
||||
operator dSpaceID() const
|
||||
{ return (dSpaceID) _id; }
|
||||
|
||||
void setCleanup (int mode)
|
||||
{ dSpaceSetCleanup (id(), mode); }
|
||||
int getCleanup()
|
||||
{ return dSpaceGetCleanup (id()); }
|
||||
|
||||
void add (dGeomID x)
|
||||
{ dSpaceAdd (id(), x); }
|
||||
void remove (dGeomID x)
|
||||
{ dSpaceRemove (id(), x); }
|
||||
int query (dGeomID x)
|
||||
{ return dSpaceQuery (id(),x); }
|
||||
|
||||
int getNumGeoms()
|
||||
{ return dSpaceGetNumGeoms (id()); }
|
||||
dGeomID getGeom (int i)
|
||||
{ return dSpaceGetGeom (id(),i); }
|
||||
|
||||
void collide (void *data, dNearCallback *callback)
|
||||
{ dSpaceCollide (id(),data,callback); }
|
||||
};
|
||||
|
||||
|
||||
class dSimpleSpace : public dSpace {
|
||||
// intentionally undefined, don't use these
|
||||
dSimpleSpace (dSimpleSpace &);
|
||||
void operator= (dSimpleSpace &);
|
||||
|
||||
public:
|
||||
dSimpleSpace (dSpaceID space)
|
||||
{ _id = (dGeomID) dSimpleSpaceCreate (space); }
|
||||
};
|
||||
|
||||
|
||||
class dHashSpace : public dSpace {
|
||||
// intentionally undefined, don't use these
|
||||
dHashSpace (dHashSpace &);
|
||||
void operator= (dHashSpace &);
|
||||
|
||||
public:
|
||||
dHashSpace (dSpaceID space)
|
||||
{ _id = (dGeomID) dHashSpaceCreate (space); }
|
||||
void setLevels (int minlevel, int maxlevel)
|
||||
{ dHashSpaceSetLevels (id(),minlevel,maxlevel); }
|
||||
};
|
||||
|
||||
|
||||
class dQuadTreeSpace : public dSpace {
|
||||
// intentionally undefined, don't use these
|
||||
dQuadTreeSpace (dQuadTreeSpace &);
|
||||
void operator= (dQuadTreeSpace &);
|
||||
|
||||
public:
|
||||
dQuadTreeSpace (dSpaceID space, dVector3 center, dVector3 extents, int depth)
|
||||
{ _id = (dGeomID) dQuadTreeSpaceCreate (space,center,extents,depth); }
|
||||
};
|
||||
|
||||
|
||||
class dSphere : public dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dSphere (dSphere &);
|
||||
void operator= (dSphere &);
|
||||
|
||||
public:
|
||||
dSphere () { }
|
||||
dSphere (dSpaceID space, dReal radius)
|
||||
{ _id = dCreateSphere (space, radius); }
|
||||
|
||||
void create (dSpaceID space, dReal radius) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateSphere (space, radius);
|
||||
}
|
||||
|
||||
void setRadius (dReal radius)
|
||||
{ dGeomSphereSetRadius (_id, radius); }
|
||||
dReal getRadius() const
|
||||
{ return dGeomSphereGetRadius (_id); }
|
||||
};
|
||||
|
||||
|
||||
class dBox : public dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dBox (dBox &);
|
||||
void operator= (dBox &);
|
||||
|
||||
public:
|
||||
dBox () { }
|
||||
dBox (dSpaceID space, dReal lx, dReal ly, dReal lz)
|
||||
{ _id = dCreateBox (space,lx,ly,lz); }
|
||||
|
||||
void create (dSpaceID space, dReal lx, dReal ly, dReal lz) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateBox (space,lx,ly,lz);
|
||||
}
|
||||
|
||||
void setLengths (dReal lx, dReal ly, dReal lz)
|
||||
{ dGeomBoxSetLengths (_id, lx, ly, lz); }
|
||||
void getLengths (dVector3 result) const
|
||||
{ dGeomBoxGetLengths (_id,result); }
|
||||
};
|
||||
|
||||
|
||||
class dPlane : public dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dPlane (dPlane &);
|
||||
void operator= (dPlane &);
|
||||
|
||||
public:
|
||||
dPlane() { }
|
||||
dPlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d)
|
||||
{ _id = dCreatePlane (space,a,b,c,d); }
|
||||
|
||||
void create (dSpaceID space, dReal a, dReal b, dReal c, dReal d) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreatePlane (space,a,b,c,d);
|
||||
}
|
||||
|
||||
void setParams (dReal a, dReal b, dReal c, dReal d)
|
||||
{ dGeomPlaneSetParams (_id, a, b, c, d); }
|
||||
void getParams (dVector4 result) const
|
||||
{ dGeomPlaneGetParams (_id,result); }
|
||||
};
|
||||
|
||||
|
||||
class dCCylinder : public dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dCCylinder (dCCylinder &);
|
||||
void operator= (dCCylinder &);
|
||||
|
||||
public:
|
||||
dCCylinder() { }
|
||||
dCCylinder (dSpaceID space, dReal radius, dReal length)
|
||||
{ _id = dCreateCCylinder (space,radius,length); }
|
||||
|
||||
void create (dSpaceID space, dReal radius, dReal length) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateCCylinder (space,radius,length);
|
||||
}
|
||||
|
||||
void setParams (dReal radius, dReal length)
|
||||
{ dGeomCCylinderSetParams (_id, radius, length); }
|
||||
void getParams (dReal *radius, dReal *length) const
|
||||
{ dGeomCCylinderGetParams (_id,radius,length); }
|
||||
};
|
||||
|
||||
|
||||
class dRay : public dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dRay (dRay &);
|
||||
void operator= (dRay &);
|
||||
|
||||
public:
|
||||
dRay() { }
|
||||
dRay (dSpaceID space, dReal length)
|
||||
{ _id = dCreateRay (space,length); }
|
||||
|
||||
void create (dSpaceID space, dReal length) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateRay (space,length);
|
||||
}
|
||||
|
||||
void setLength (dReal length)
|
||||
{ dGeomRaySetLength (_id, length); }
|
||||
dReal getLength()
|
||||
{ return dGeomRayGetLength (_id); }
|
||||
|
||||
void set (dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz)
|
||||
{ dGeomRaySet (_id, px, py, pz, dx, dy, dz); }
|
||||
void get (dVector3 start, dVector3 dir)
|
||||
{ dGeomRayGet (_id, start, dir); }
|
||||
|
||||
void setParams (int firstContact, int backfaceCull)
|
||||
{ dGeomRaySetParams (_id, firstContact, backfaceCull); }
|
||||
void getParams (int *firstContact, int *backfaceCull)
|
||||
{ dGeomRayGetParams (_id, firstContact, backfaceCull); }
|
||||
void setClosestHit (int closestHit)
|
||||
{ dGeomRaySetClosestHit (_id, closestHit); }
|
||||
int getClosestHit()
|
||||
{ return dGeomRayGetClosestHit (_id); }
|
||||
};
|
||||
|
||||
|
||||
class dGeomTransform : public dGeom {
|
||||
// intentionally undefined, don't use these
|
||||
dGeomTransform (dGeomTransform &);
|
||||
void operator= (dGeomTransform &);
|
||||
|
||||
public:
|
||||
dGeomTransform() { }
|
||||
dGeomTransform (dSpaceID space)
|
||||
{ _id = dCreateGeomTransform (space); }
|
||||
|
||||
void create (dSpaceID space=0) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateGeomTransform (space);
|
||||
}
|
||||
|
||||
void setGeom (dGeomID geom)
|
||||
{ dGeomTransformSetGeom (_id, geom); }
|
||||
dGeomID getGeom() const
|
||||
{ return dGeomTransformGetGeom (_id); }
|
||||
|
||||
void setCleanup (int mode)
|
||||
{ dGeomTransformSetCleanup (_id,mode); }
|
||||
int getCleanup ()
|
||||
{ return dGeomTransformGetCleanup (_id); }
|
||||
|
||||
void setInfo (int mode)
|
||||
{ dGeomTransformSetInfo (_id,mode); }
|
||||
int getInfo()
|
||||
{ return dGeomTransformGetInfo (_id); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
316
Extras/ode/include/ode/odecpp_old.h
Normal file
316
Extras/ode/include/ode/odecpp_old.h
Normal file
@@ -0,0 +1,316 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/* this is the old C++ interface, the new C++ interface is not quite
|
||||
* compatible with this. but this file is kept around in case you were
|
||||
* using the old interface.
|
||||
*/
|
||||
|
||||
#ifndef _ODE_ODECPP_H_
|
||||
#define _ODE_ODECPP_H_
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ode/error.h>
|
||||
|
||||
|
||||
class dWorld {
|
||||
dWorldID _id;
|
||||
|
||||
dWorld (dWorld &) { dDebug (0,"bad"); }
|
||||
void operator= (dWorld &) { dDebug (0,"bad"); }
|
||||
|
||||
public:
|
||||
dWorld()
|
||||
{ _id = dWorldCreate(); }
|
||||
~dWorld()
|
||||
{ dWorldDestroy (_id); }
|
||||
dWorldID id()
|
||||
{ return _id; }
|
||||
|
||||
void setGravity (dReal x, dReal y, dReal z)
|
||||
{ dWorldSetGravity (_id,x,y,z); }
|
||||
void getGravity (dVector3 g)
|
||||
{ dWorldGetGravity (_id,g); }
|
||||
void step (dReal stepsize)
|
||||
{ dWorldStep (_id,stepsize); }
|
||||
};
|
||||
|
||||
|
||||
class dBody {
|
||||
dBodyID _id;
|
||||
|
||||
dBody (dBody &) { dDebug (0,"bad"); }
|
||||
void operator= (dBody &) { dDebug (0,"bad"); }
|
||||
|
||||
public:
|
||||
dBody()
|
||||
{ _id = 0; }
|
||||
dBody (dWorld &world)
|
||||
{ _id = dBodyCreate (world.id()); }
|
||||
~dBody()
|
||||
{ dBodyDestroy (_id); }
|
||||
void create (dWorld &world)
|
||||
{ if (_id) dBodyDestroy (_id); _id = dBodyCreate (world.id()); }
|
||||
dBodyID id()
|
||||
{ return _id; }
|
||||
|
||||
void setData (void *data)
|
||||
{ dBodySetData (_id,data); }
|
||||
void *getData()
|
||||
{ return dBodyGetData (_id); }
|
||||
|
||||
void setPosition (dReal x, dReal y, dReal z)
|
||||
{ dBodySetPosition (_id,x,y,z); }
|
||||
void setRotation (const dMatrix3 R)
|
||||
{ dBodySetRotation (_id,R); }
|
||||
void setQuaternion (const dQuaternion q)
|
||||
{ dBodySetQuaternion (_id,q); }
|
||||
void setLinearVel (dReal x, dReal y, dReal z)
|
||||
{ dBodySetLinearVel (_id,x,y,z); }
|
||||
void setAngularVel (dReal x, dReal y, dReal z)
|
||||
{ dBodySetAngularVel (_id,x,y,z); }
|
||||
|
||||
const dReal * getPosition()
|
||||
{ return dBodyGetPosition (_id); }
|
||||
const dReal * getRotation()
|
||||
{ return dBodyGetRotation (_id); }
|
||||
const dReal * getQuaternion()
|
||||
{ return dBodyGetQuaternion (_id); }
|
||||
const dReal * getLinearVel()
|
||||
{ return dBodyGetLinearVel (_id); }
|
||||
const dReal * getAngularVel()
|
||||
{ return dBodyGetAngularVel (_id); }
|
||||
|
||||
void setMass (const dMass *mass)
|
||||
{ dBodySetMass (_id,mass); }
|
||||
void getMass (dMass *mass)
|
||||
{ dBodyGetMass (_id,mass); }
|
||||
|
||||
void addForce (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddForce (_id, fx, fy, fz); }
|
||||
void addTorque (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddTorque (_id, fx, fy, fz); }
|
||||
void addRelForce (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddRelForce (_id, fx, fy, fz); }
|
||||
void addRelTorque (dReal fx, dReal fy, dReal fz)
|
||||
{ dBodyAddRelTorque (_id, fx, fy, fz); }
|
||||
void addForceAtPos (dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz)
|
||||
{ dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
|
||||
void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz)
|
||||
{ dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
|
||||
void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
|
||||
dReal px, dReal py, dReal pz)
|
||||
{ dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
|
||||
|
||||
void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result)
|
||||
{ dBodyGetRelPointPos (_id, px, py, pz, result); }
|
||||
void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result)
|
||||
{ dBodyGetRelPointVel (_id, px, py, pz, result); }
|
||||
|
||||
int isConnectedTo (const dBody &b)
|
||||
{ return dAreConnected (_id,b._id); }
|
||||
};
|
||||
|
||||
|
||||
class dJointGroup {
|
||||
dJointGroupID _id;
|
||||
|
||||
dJointGroup (dJointGroup &) { dDebug (0,"bad"); }
|
||||
void operator= (dJointGroup &) { dDebug (0,"bad"); }
|
||||
|
||||
public:
|
||||
dJointGroup()
|
||||
{ _id = 0; }
|
||||
dJointGroup (int max_size)
|
||||
{ _id = dJointGroupCreate (max_size); }
|
||||
~dJointGroup()
|
||||
{ dJointGroupDestroy (_id); }
|
||||
void create (int max_size)
|
||||
{ if (_id) dJointGroupDestroy (_id); _id = dJointGroupCreate (max_size); }
|
||||
dJointGroupID id()
|
||||
{ return _id; }
|
||||
|
||||
void empty()
|
||||
{ dJointGroupEmpty (_id); }
|
||||
};
|
||||
|
||||
|
||||
class dJoint {
|
||||
dJointID _id;
|
||||
|
||||
dJoint (dJoint &) { dDebug (0,"bad"); }
|
||||
void operator= (dJoint &) { dDebug (0,"bad"); }
|
||||
|
||||
public:
|
||||
dJoint()
|
||||
{ _id = 0; }
|
||||
~dJoint()
|
||||
{ dJointDestroy (_id); }
|
||||
dJointID id()
|
||||
{ return _id; }
|
||||
|
||||
void createBall (dWorld &world, dJointGroup *group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateBall (world.id(), group ? group->id() : 0);
|
||||
}
|
||||
void createHinge (dWorld &world, dJointGroup *group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateHinge (world.id(), group ? group->id() : 0);
|
||||
}
|
||||
void createSlider (dWorld &world, dJointGroup *group=0) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateSlider (world.id(), group ? group->id() : 0);
|
||||
}
|
||||
void createContact (dWorld &world, dJointGroup *group, dContact *contact) {
|
||||
if (_id) dJointDestroy (_id);
|
||||
_id = dJointCreateContact (world.id(), group ? group->id() : 0, contact);
|
||||
}
|
||||
|
||||
void attach (dBody &body1, dBody &body2)
|
||||
{ dJointAttach (_id, body1.id(), body2.id()); }
|
||||
|
||||
void setBallAnchor (dReal x, dReal y, dReal z)
|
||||
{ dJointSetBallAnchor (_id, x, y, z); }
|
||||
void setHingeAnchor (dReal x, dReal y, dReal z)
|
||||
{ dJointSetHingeAnchor (_id, x, y, z); }
|
||||
|
||||
void setHingeAxis (dReal x, dReal y, dReal z)
|
||||
{ dJointSetHingeAxis (_id, x, y, z); }
|
||||
void setSliderAxis (dReal x, dReal y, dReal z)
|
||||
{ dJointSetSliderAxis (_id, x, y, z); }
|
||||
|
||||
void getBallAnchor (dVector3 result)
|
||||
{ dJointGetBallAnchor (_id, result); }
|
||||
void getHingeAnchor (dVector3 result)
|
||||
{ dJointGetHingeAnchor (_id, result); }
|
||||
|
||||
void getHingeAxis (dVector3 result)
|
||||
{ dJointGetHingeAxis (_id, result); }
|
||||
void getSliderAxis (dVector3 result)
|
||||
{ dJointGetSliderAxis (_id, result); }
|
||||
};
|
||||
|
||||
|
||||
class dSpace {
|
||||
dSpaceID _id;
|
||||
|
||||
dSpace (dSpace &) { dDebug (0,"bad"); }
|
||||
void operator= (dSpace &) { dDebug (0,"bad"); }
|
||||
|
||||
public:
|
||||
dSpace ()
|
||||
{ _id = dHashSpaceCreate(); }
|
||||
~dSpace()
|
||||
{ dSpaceDestroy (_id); }
|
||||
dSpaceID id()
|
||||
{ return _id; }
|
||||
void collide (void *data, dNearCallback *callback)
|
||||
{ dSpaceCollide (_id,data,callback); }
|
||||
};
|
||||
|
||||
|
||||
class dGeom {
|
||||
dGeomID _id;
|
||||
|
||||
dGeom (dGeom &) { dDebug (0,"bad"); }
|
||||
void operator= (dGeom &) { dDebug (0,"bad"); }
|
||||
|
||||
public:
|
||||
dGeom()
|
||||
{ _id = 0; }
|
||||
~dGeom()
|
||||
{ dGeomDestroy (_id); }
|
||||
dGeomID id()
|
||||
{ return _id; }
|
||||
|
||||
void createSphere (dSpace &space, dReal radius) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateSphere (space.id(),radius);
|
||||
}
|
||||
|
||||
void createBox (dSpace &space, dReal lx, dReal ly, dReal lz) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateBox (space.id(),lx,ly,lz);
|
||||
}
|
||||
|
||||
void createPlane (dSpace &space, dReal a, dReal b, dReal c, dReal d) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreatePlane (space.id(),a,b,c,d);
|
||||
}
|
||||
|
||||
void createCCylinder (dSpace &space, dReal radius, dReal length) {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = dCreateCCylinder (space.id(),radius,length);
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
if (_id) dGeomDestroy (_id);
|
||||
_id = 0;
|
||||
}
|
||||
|
||||
int getClass()
|
||||
{ return dGeomGetClass (_id); }
|
||||
|
||||
dReal sphereGetRadius()
|
||||
{ return dGeomSphereGetRadius (_id); }
|
||||
|
||||
void boxGetLengths (dVector3 result)
|
||||
{ dGeomBoxGetLengths (_id,result); }
|
||||
|
||||
void planeGetParams (dVector4 result)
|
||||
{ dGeomPlaneGetParams (_id,result); }
|
||||
|
||||
void CCylinderGetParams (dReal *radius, dReal *length)
|
||||
{ dGeomCCylinderGetParams (_id,radius,length); }
|
||||
|
||||
void setData (void *data)
|
||||
{ dGeomSetData (_id,data); }
|
||||
|
||||
void *getData()
|
||||
{ return dGeomGetData (_id); }
|
||||
|
||||
void setBody (dBody &b)
|
||||
{ dGeomSetBody (_id,b.id()); }
|
||||
void setBody (dBodyID b)
|
||||
{ dGeomSetBody (_id,b); }
|
||||
|
||||
dBodyID getBody()
|
||||
{ return dGeomGetBody (_id); }
|
||||
|
||||
void setPosition (dReal x, dReal y, dReal z)
|
||||
{ dGeomSetPosition (_id,x,y,z); }
|
||||
|
||||
void setRotation (const dMatrix3 R)
|
||||
{ dGeomSetRotation (_id,R); }
|
||||
|
||||
const dReal * getPosition()
|
||||
{ return dGeomGetPosition (_id); }
|
||||
|
||||
const dReal * getRotation()
|
||||
{ return dGeomGetRotation (_id); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
258
Extras/ode/include/ode/odemath.h
Normal file
258
Extras/ode/include/ode/odemath.h
Normal file
@@ -0,0 +1,258 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_ODEMATH_H_
|
||||
#define _ODE_ODEMATH_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define PURE_INLINE extern inline
|
||||
#else
|
||||
#define PURE_INLINE inline
|
||||
#endif
|
||||
|
||||
/*
|
||||
* macro to access elements i,j in an NxM matrix A, independent of the
|
||||
* matrix storage convention.
|
||||
*/
|
||||
#define dACCESS33(A,i,j) ((A)[(i)*4+(j)])
|
||||
|
||||
|
||||
/*
|
||||
* 3-way dot product. dDOTpq means that elements of `a' and `b' are spaced
|
||||
* p and q indexes apart respectively. dDOT() means dDOT11.
|
||||
* in C++ we could use function templates to get all the versions of these
|
||||
* functions - but on some compilers this will result in sub-optimal code.
|
||||
*/
|
||||
|
||||
#define dDOTpq(a,b,p,q) ((a)[0]*(b)[0] + (a)[p]*(b)[q] + (a)[2*(p)]*(b)[2*(q)])
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
PURE_INLINE dReal dDOT (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,1); }
|
||||
PURE_INLINE dReal dDOT13 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,3); }
|
||||
PURE_INLINE dReal dDOT31 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,1); }
|
||||
PURE_INLINE dReal dDOT33 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,3); }
|
||||
PURE_INLINE dReal dDOT14 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,4); }
|
||||
PURE_INLINE dReal dDOT41 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,1); }
|
||||
PURE_INLINE dReal dDOT44 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,4); }
|
||||
|
||||
#else
|
||||
|
||||
#define dDOT(a,b) dDOTpq(a,b,1,1)
|
||||
#define dDOT13(a,b) dDOTpq(a,b,1,3)
|
||||
#define dDOT31(a,b) dDOTpq(a,b,3,1)
|
||||
#define dDOT33(a,b) dDOTpq(a,b,3,3)
|
||||
#define dDOT14(a,b) dDOTpq(a,b,1,4)
|
||||
#define dDOT41(a,b) dDOTpq(a,b,4,1)
|
||||
#define dDOT44(a,b) dDOTpq(a,b,4,4)
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* dCROSS() means dCROSS111. `op' is normally `=', but you can set it to
|
||||
* +=, -= etc to get other effects.
|
||||
*/
|
||||
|
||||
#define dCROSS(a,op,b,c) \
|
||||
do { \
|
||||
(a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \
|
||||
(a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \
|
||||
(a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]); \
|
||||
} while(0)
|
||||
#define dCROSSpqr(a,op,b,c,p,q,r) \
|
||||
do { \
|
||||
(a)[ 0] op ((b)[ q]*(c)[2*r] - (b)[2*q]*(c)[ r]); \
|
||||
(a)[ p] op ((b)[2*q]*(c)[ 0] - (b)[ 0]*(c)[2*r]); \
|
||||
(a)[2*p] op ((b)[ 0]*(c)[ r] - (b)[ q]*(c)[ 0]); \
|
||||
} while(0)
|
||||
#define dCROSS114(a,op,b,c) dCROSSpqr(a,op,b,c,1,1,4)
|
||||
#define dCROSS141(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,1)
|
||||
#define dCROSS144(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,4)
|
||||
#define dCROSS411(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,1)
|
||||
#define dCROSS414(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,4)
|
||||
#define dCROSS441(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,1)
|
||||
#define dCROSS444(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,4)
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
* 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 negative version will be written.
|
||||
*/
|
||||
|
||||
#define dCROSSMAT(A,a,skip,plus,minus) \
|
||||
do { \
|
||||
(A)[1] = minus (a)[2]; \
|
||||
(A)[2] = plus (a)[1]; \
|
||||
(A)[(skip)+0] = plus (a)[2]; \
|
||||
(A)[(skip)+2] = minus (a)[0]; \
|
||||
(A)[2*(skip)+0] = minus (a)[1]; \
|
||||
(A)[2*(skip)+1] = plus (a)[0]; \
|
||||
} while(0)
|
||||
|
||||
|
||||
/*
|
||||
* compute the distance between two 3-vectors
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
PURE_INLINE float dDISTANCE (const float a[3], const float b[3])
|
||||
{ return (float) dSqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) + (a[2]-b[2])*(a[2]-b[2]) ); }
|
||||
PURE_INLINE double dDISTANCE (const double a[3], const double b[3])
|
||||
{ return dSqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) + (a[2]-b[2])*(a[2]-b[2]) ); }
|
||||
#else
|
||||
#define dDISTANCE(a,b) \
|
||||
(dSqrt( ((a)[0]-(b)[0])*((a)[0]-(b)[0]) + ((a)[1]-(b)[1])*((a)[1]-(b)[1]) + ((a)[2]-(b)[2])*((a)[2]-(b)[2]) ))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* special case matrix multipication, with operator selection
|
||||
*/
|
||||
|
||||
#define dMULTIPLYOP0_331(A,op,B,C) \
|
||||
do { \
|
||||
(A)[0] op dDOT((B),(C)); \
|
||||
(A)[1] op dDOT((B+4),(C)); \
|
||||
(A)[2] op dDOT((B+8),(C)); \
|
||||
} while(0)
|
||||
#define dMULTIPLYOP1_331(A,op,B,C) \
|
||||
do { \
|
||||
(A)[0] op dDOT41((B),(C)); \
|
||||
(A)[1] op dDOT41((B+1),(C)); \
|
||||
(A)[2] op dDOT41((B+2),(C)); \
|
||||
} while(0)
|
||||
#define dMULTIPLYOP0_133(A,op,B,C) \
|
||||
do { \
|
||||
(A)[0] op dDOT14((B),(C)); \
|
||||
(A)[1] op dDOT14((B),(C+1)); \
|
||||
(A)[2] op dDOT14((B),(C+2)); \
|
||||
} while(0)
|
||||
#define dMULTIPLYOP0_333(A,op,B,C) \
|
||||
do { \
|
||||
(A)[0] op dDOT14((B),(C)); \
|
||||
(A)[1] op dDOT14((B),(C+1)); \
|
||||
(A)[2] op dDOT14((B),(C+2)); \
|
||||
(A)[4] op dDOT14((B+4),(C)); \
|
||||
(A)[5] op dDOT14((B+4),(C+1)); \
|
||||
(A)[6] op dDOT14((B+4),(C+2)); \
|
||||
(A)[8] op dDOT14((B+8),(C)); \
|
||||
(A)[9] op dDOT14((B+8),(C+1)); \
|
||||
(A)[10] op dDOT14((B+8),(C+2)); \
|
||||
} while(0)
|
||||
#define dMULTIPLYOP1_333(A,op,B,C) \
|
||||
do { \
|
||||
(A)[0] op dDOT44((B),(C)); \
|
||||
(A)[1] op dDOT44((B),(C+1)); \
|
||||
(A)[2] op dDOT44((B),(C+2)); \
|
||||
(A)[4] op dDOT44((B+1),(C)); \
|
||||
(A)[5] op dDOT44((B+1),(C+1)); \
|
||||
(A)[6] op dDOT44((B+1),(C+2)); \
|
||||
(A)[8] op dDOT44((B+2),(C)); \
|
||||
(A)[9] op dDOT44((B+2),(C+1)); \
|
||||
(A)[10] op dDOT44((B+2),(C+2)); \
|
||||
} while(0)
|
||||
#define dMULTIPLYOP2_333(A,op,B,C) \
|
||||
do { \
|
||||
(A)[0] op dDOT((B),(C)); \
|
||||
(A)[1] op dDOT((B),(C+4)); \
|
||||
(A)[2] op dDOT((B),(C+8)); \
|
||||
(A)[4] op dDOT((B+4),(C)); \
|
||||
(A)[5] op dDOT((B+4),(C+4)); \
|
||||
(A)[6] op dDOT((B+4),(C+8)); \
|
||||
(A)[8] op dDOT((B+8),(C)); \
|
||||
(A)[9] op dDOT((B+8),(C+4)); \
|
||||
(A)[10] op dDOT((B+8),(C+8)); \
|
||||
} while(0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define DECL template <class TA, class TB, class TC> PURE_INLINE void
|
||||
|
||||
DECL dMULTIPLY0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,=,B,C); }
|
||||
DECL dMULTIPLY1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,=,B,C); }
|
||||
DECL dMULTIPLY0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,=,B,C); }
|
||||
DECL dMULTIPLY0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,=,B,C); }
|
||||
DECL dMULTIPLY1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,=,B,C); }
|
||||
DECL dMULTIPLY2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,=,B,C); }
|
||||
|
||||
DECL dMULTIPLYADD0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,+=,B,C); }
|
||||
DECL dMULTIPLYADD1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,+=,B,C); }
|
||||
DECL dMULTIPLYADD0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,+=,B,C); }
|
||||
DECL dMULTIPLYADD0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,+=,B,C); }
|
||||
DECL dMULTIPLYADD1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,+=,B,C); }
|
||||
DECL dMULTIPLYADD2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,+=,B,C); }
|
||||
|
||||
#undef DECL
|
||||
|
||||
#else
|
||||
|
||||
#define dMULTIPLY0_331(A,B,C) dMULTIPLYOP0_331(A,=,B,C)
|
||||
#define dMULTIPLY1_331(A,B,C) dMULTIPLYOP1_331(A,=,B,C)
|
||||
#define dMULTIPLY0_133(A,B,C) dMULTIPLYOP0_133(A,=,B,C)
|
||||
#define dMULTIPLY0_333(A,B,C) dMULTIPLYOP0_333(A,=,B,C)
|
||||
#define dMULTIPLY1_333(A,B,C) dMULTIPLYOP1_333(A,=,B,C)
|
||||
#define dMULTIPLY2_333(A,B,C) dMULTIPLYOP2_333(A,=,B,C)
|
||||
|
||||
#define dMULTIPLYADD0_331(A,B,C) dMULTIPLYOP0_331(A,+=,B,C)
|
||||
#define dMULTIPLYADD1_331(A,B,C) dMULTIPLYOP1_331(A,+=,B,C)
|
||||
#define dMULTIPLYADD0_133(A,B,C) dMULTIPLYOP0_133(A,+=,B,C)
|
||||
#define dMULTIPLYADD0_333(A,B,C) dMULTIPLYOP0_333(A,+=,B,C)
|
||||
#define dMULTIPLYADD1_333(A,B,C) dMULTIPLYOP1_333(A,+=,B,C)
|
||||
#define dMULTIPLYADD2_333(A,B,C) dMULTIPLYOP2_333(A,+=,B,C)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* normalize 3x1 and 4x1 vectors (i.e. scale them to unit length)
|
||||
*/
|
||||
void dNormalize3 (dVector3 a);
|
||||
void dNormalize4 (dVector4 a);
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* 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 but
|
||||
* q wont be.
|
||||
*/
|
||||
|
||||
void dPlaneSpace (const dVector3 n, dVector3 p, dVector3 q);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
70
Extras/ode/include/ode/rotation.h
Normal file
70
Extras/ode/include/ode/rotation.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_ROTATION_H_
|
||||
#define _ODE_ROTATION_H_
|
||||
|
||||
#include <ode/common.h>
|
||||
#include <ode/compatibility.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void dRSetIdentity (dMatrix3 R);
|
||||
|
||||
void dRFromAxisAndAngle (dMatrix3 R, dReal ax, dReal ay, dReal az,
|
||||
dReal angle);
|
||||
|
||||
void dRFromEulerAngles (dMatrix3 R, dReal phi, dReal theta, dReal psi);
|
||||
|
||||
void dRFrom2Axes (dMatrix3 R, dReal ax, dReal ay, dReal az,
|
||||
dReal bx, dReal by, dReal bz);
|
||||
|
||||
void dRFromZAxis (dMatrix3 R, dReal ax, dReal ay, dReal az);
|
||||
|
||||
void dQSetIdentity (dQuaternion q);
|
||||
|
||||
void dQFromAxisAndAngle (dQuaternion q, dReal ax, dReal ay, dReal az,
|
||||
dReal angle);
|
||||
|
||||
/* Quaternion multiplication, analogous to the matrix multiplication routines. */
|
||||
/* qa = rotate by qc, then qb */
|
||||
void dQMultiply0 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
|
||||
/* qa = rotate by qc, then by inverse of qb */
|
||||
void dQMultiply1 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
|
||||
/* qa = rotate by inverse of qc, then by qb */
|
||||
void dQMultiply2 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
|
||||
/* qa = rotate by inverse of qc, then by inverse of qb */
|
||||
void dQMultiply3 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
|
||||
|
||||
void dRfromQ (dMatrix3 R, const dQuaternion q);
|
||||
void dQfromR (dQuaternion q, const dMatrix3 R);
|
||||
void dDQfromW (dReal dq[4], const dVector3 w, const dQuaternion q);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
76
Extras/ode/include/ode/timer.h
Normal file
76
Extras/ode/include/ode/timer.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* 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_TIMER_H_
|
||||
#define _ODE_TIMER_H_
|
||||
|
||||
#include <ode/config.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* stop watch objects */
|
||||
|
||||
typedef struct dStopwatch {
|
||||
double time; /* total clock count */
|
||||
unsigned long cc[2]; /* clock count since last `start' */
|
||||
} dStopwatch;
|
||||
|
||||
void dStopwatchReset (dStopwatch *);
|
||||
void dStopwatchStart (dStopwatch *);
|
||||
void dStopwatchStop (dStopwatch *);
|
||||
double dStopwatchTime (dStopwatch *); /* returns total time in secs */
|
||||
|
||||
|
||||
/* code timers */
|
||||
|
||||
void dTimerStart (const char *description); /* pass a static string here */
|
||||
void dTimerNow (const char *description); /* pass a static string here */
|
||||
void dTimerEnd(void);
|
||||
|
||||
/* print out a timer report. if `average' is nonzero, print out the average
|
||||
* time for each slot (this is only meaningful if the same start-now-end
|
||||
* calls are being made repeatedly.
|
||||
*/
|
||||
void dTimerReport (FILE *fout, int average);
|
||||
|
||||
|
||||
/* resolution */
|
||||
|
||||
/* returns the timer ticks per second implied by the timing hardware or API.
|
||||
* the actual timer resolution may not be this great.
|
||||
*/
|
||||
double dTimerTicksPerSecond(void);
|
||||
|
||||
/* returns an estimate of the actual timer resolution, in seconds. this may
|
||||
* be greater than 1/ticks_per_second.
|
||||
*/
|
||||
double dTimerResolution(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user