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
00043 ODE_API int dMassCheck(const dMass *m);
00044
00045 ODE_API void dMassSetZero (dMass *);
00046
00047 ODE_API void dMassSetParameters (dMass *, dReal themass,
00048 dReal cgx, dReal cgy, dReal cgz,
00049 dReal I11, dReal I22, dReal I33,
00050 dReal I12, dReal I13, dReal I23);
00051
00052 ODE_API void dMassSetSphere (dMass *, dReal density, dReal radius);
00053 ODE_API void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
00054
00055 ODE_API void dMassSetCapsule (dMass *, dReal density, int direction,
00056 dReal radius, dReal length);
00057 ODE_API void dMassSetCapsuleTotal (dMass *, dReal total_mass, int direction,
00058 dReal radius, dReal length);
00059
00060 ODE_API void dMassSetCylinder (dMass *, dReal density, int direction,
00061 dReal radius, dReal length);
00062 ODE_API void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
00063 dReal radius, dReal length);
00064
00065 ODE_API void dMassSetBox (dMass *, dReal density,
00066 dReal lx, dReal ly, dReal lz);
00067 ODE_API void dMassSetBoxTotal (dMass *, dReal total_mass,
00068 dReal lx, dReal ly, dReal lz);
00069
00070 ODE_API void dMassSetTrimesh (dMass *, dReal density, dGeomID g);
00071
00072 ODE_API void dMassSetTrimeshTotal (dMass *m, dReal total_mass, dGeomID g);
00073
00074 ODE_API void dMassAdjust (dMass *, dReal newmass);
00075
00076 ODE_API void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
00077
00078 ODE_API void dMassRotate (dMass *, const dMatrix3 R);
00079
00080 ODE_API void dMassAdd (dMass *a, const dMass *b);
00081
00082
00083
00084 ODE_API ODE_API_DEPRECATED void dMassSetCappedCylinder(dMass *a, dReal b, int c, dReal d, dReal e);
00085 ODE_API ODE_API_DEPRECATED void dMassSetCappedCylinderTotal(dMass *a, dReal b, int c, dReal d, dReal e);
00086
00087
00088 struct dMass {
00089 dReal mass;
00090 dVector3 c;
00091 dMatrix3 I;
00092
00093 #ifdef __cplusplus
00094 dMass()
00095 { dMassSetZero (this); }
00096 void setZero()
00097 { dMassSetZero (this); }
00098 void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
00099 dReal I11, dReal I22, dReal I33,
00100 dReal I12, dReal I13, dReal I23)
00101 { dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
00102
00103 void setSphere (dReal density, dReal radius)
00104 { dMassSetSphere (this,density,radius); }
00105 void setSphereTotal (dReal total, dReal radius)
00106 { dMassSetSphereTotal (this,total,radius); }
00107
00108 void setCapsule (dReal density, int direction, dReal radius, dReal length)
00109 { dMassSetCapsule (this,density,direction,radius,length); }
00110 void setCapsuleTotal (dReal total, int direction, dReal radius, dReal length)
00111 { dMassSetCapsule (this,total,direction,radius,length); }
00112
00113 void setCylinder(dReal density, int direction, dReal radius, dReal length)
00114 { dMassSetCylinder (this,density,direction,radius,length); }
00115 void setCylinderTotal(dReal total, int direction, dReal radius, dReal length)
00116 { dMassSetCylinderTotal (this,total,direction,radius,length); }
00117
00118 void setBox (dReal density, dReal lx, dReal ly, dReal lz)
00119 { dMassSetBox (this,density,lx,ly,lz); }
00120 void setBoxTotal (dReal total, dReal lx, dReal ly, dReal lz)
00121 { dMassSetBoxTotal (this,total,lx,ly,lz); }
00122
00123 void setTrimesh(dReal density, dGeomID g)
00124 { dMassSetTrimesh (this, density, g); }
00125 void setTrimeshTotal(dReal total, dGeomID g)
00126 { dMassSetTrimeshTotal (this, total, g); }
00127
00128 void adjust (dReal newmass)
00129 { dMassAdjust (this,newmass); }
00130 void translate (dReal x, dReal y, dReal z)
00131 { dMassTranslate (this,x,y,z); }
00132 void rotate (const dMatrix3 R)
00133 { dMassRotate (this,R); }
00134 void add (const dMass *b)
00135 { dMassAdd (this,b); }
00136 #endif
00137 };
00138
00139
00140 #ifdef __cplusplus
00141 }
00142 #endif
00143
00144 #endif