00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _ODE_MASS_H_
00024 #define _ODE_MASS_H_
00025
00026 #include <ode/common.h>
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00032 struct dMass;
00033 typedef struct dMass dMass;
00034
00035
00036 ODE_API void dMassSetZero (dMass *);
00037
00038 ODE_API void dMassSetParameters (dMass *, dReal themass,
00039 dReal cgx, dReal cgy, dReal cgz,
00040 dReal I11, dReal I22, dReal I33,
00041 dReal I12, dReal I13, dReal I23);
00042
00043 ODE_API void dMassSetSphere (dMass *, dReal density, dReal radius);
00044 ODE_API void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
00045
00046 ODE_API void dMassSetCapsule (dMass *, dReal density, int direction,
00047 dReal radius, dReal length);
00048 ODE_API void dMassSetCapsuleTotal (dMass *, dReal total_mass, int direction,
00049 dReal radius, dReal length);
00050
00051 ODE_API void dMassSetCylinder (dMass *, dReal density, int direction,
00052 dReal radius, dReal length);
00053 ODE_API void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
00054 dReal radius, dReal length);
00055
00056 ODE_API void dMassSetBox (dMass *, dReal density,
00057 dReal lx, dReal ly, dReal lz);
00058 ODE_API void dMassSetBoxTotal (dMass *, dReal total_mass,
00059 dReal lx, dReal ly, dReal lz);
00060
00061 ODE_API void dMassAdjust (dMass *, dReal newmass);
00062
00063 ODE_API void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
00064
00065 ODE_API void dMassRotate (dMass *, const dMatrix3 R);
00066
00067 ODE_API void dMassAdd (dMass *a, const dMass *b);
00068
00069
00070 #define dMassSetCappedCylinder dMassSetCapsule
00071 #define dMassSetCappedCylinderTotal dMassSetCapsuleTotal
00072
00073
00074 struct dMass {
00075 dReal mass;
00076 dVector4 c;
00077 dMatrix3 I;
00078
00079 #ifdef __cplusplus
00080 dMass()
00081 { dMassSetZero (this); }
00082 void setZero()
00083 { dMassSetZero (this); }
00084 void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
00085 dReal I11, dReal I22, dReal I33,
00086 dReal I12, dReal I13, dReal I23)
00087 { dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
00088 void setSphere (dReal density, dReal radius)
00089 { dMassSetSphere (this,density,radius); }
00090 void setCapsule (dReal density, int direction, dReal a, dReal b)
00091 { dMassSetCappedCylinder (this,density,direction,a,b); }
00092 void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
00093 { setCapsule(density, direction, a, b); }
00094 void setBox (dReal density, dReal lx, dReal ly, dReal lz)
00095 { dMassSetBox (this,density,lx,ly,lz); }
00096 void adjust (dReal newmass)
00097 { dMassAdjust (this,newmass); }
00098 void translate (dReal x, dReal y, dReal z)
00099 { dMassTranslate (this,x,y,z); }
00100 void rotate (const dMatrix3 R)
00101 { dMassRotate (this,R); }
00102 void add (const dMass *b)
00103 { dMassAdd (this,b); }
00104 #endif
00105 };
00106
00107
00108 #ifdef __cplusplus
00109 }
00110 #endif
00111
00112 #endif