1 /*************************************************************************
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
21 *************************************************************************/
26 #include <ode/common.h>
33 typedef struct dMass dMass;
36 * Check if a mass structure has valid value.
37 * The function check if the mass and innertia matrix are positive definits
39 * @param m A mass structure to check
41 * @return 1 if both codition are met
43 ODE_API int dMassCheck(const dMass *m);
45 ODE_API void dMassSetZero (dMass *);
47 ODE_API void dMassSetParameters (dMass *, dReal themass,
48 dReal cgx, dReal cgy, dReal cgz,
49 dReal I11, dReal I22, dReal I33,
50 dReal I12, dReal I13, dReal I23);
52 ODE_API void dMassSetSphere (dMass *, dReal density, dReal radius);
53 ODE_API void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
55 ODE_API void dMassSetCapsule (dMass *, dReal density, int direction,
56 dReal radius, dReal length);
57 ODE_API void dMassSetCapsuleTotal (dMass *, dReal total_mass, int direction,
58 dReal radius, dReal length);
60 ODE_API void dMassSetCylinder (dMass *, dReal density, int direction,
61 dReal radius, dReal length);
62 ODE_API void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
63 dReal radius, dReal length);
65 ODE_API void dMassSetBox (dMass *, dReal density,
66 dReal lx, dReal ly, dReal lz);
67 ODE_API void dMassSetBoxTotal (dMass *, dReal total_mass,
68 dReal lx, dReal ly, dReal lz);
70 ODE_API void dMassSetTrimesh (dMass *, dReal density, dGeomID g);
72 ODE_API void dMassSetTrimeshTotal (dMass *m, dReal total_mass, dGeomID g);
74 ODE_API void dMassAdjust (dMass *, dReal newmass);
76 ODE_API void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
78 ODE_API void dMassRotate (dMass *, const dMatrix3 R);
80 ODE_API void dMassAdd (dMass *a, const dMass *b);
83 /* Backwards compatible API */
84 ODE_API_DEPRECATED ODE_API void dMassSetCappedCylinder(dMass *a, dReal b, int c, dReal d, dReal e);
85 ODE_API_DEPRECATED ODE_API void dMassSetCappedCylinderTotal(dMass *a, dReal b, int c, dReal d, dReal e);
95 { dMassSetZero (this); }
97 { dMassSetZero (this); }
98 void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
99 dReal I11, dReal I22, dReal I33,
100 dReal I12, dReal I13, dReal I23)
101 { dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
103 void setSphere (dReal density, dReal radius)
104 { dMassSetSphere (this,density,radius); }
105 void setSphereTotal (dReal total, dReal radius)
106 { dMassSetSphereTotal (this,total,radius); }
108 void setCapsule (dReal density, int direction, dReal radius, dReal length)
109 { dMassSetCapsule (this,density,direction,radius,length); }
110 void setCapsuleTotal (dReal total, int direction, dReal radius, dReal length)
111 { dMassSetCapsule (this,total,direction,radius,length); }
113 void setCylinder(dReal density, int direction, dReal radius, dReal length)
114 { dMassSetCylinder (this,density,direction,radius,length); }
115 void setCylinderTotal(dReal total, int direction, dReal radius, dReal length)
116 { dMassSetCylinderTotal (this,total,direction,radius,length); }
118 void setBox (dReal density, dReal lx, dReal ly, dReal lz)
119 { dMassSetBox (this,density,lx,ly,lz); }
120 void setBoxTotal (dReal total, dReal lx, dReal ly, dReal lz)
121 { dMassSetBoxTotal (this,total,lx,ly,lz); }
123 void setTrimesh(dReal density, dGeomID g)
124 { dMassSetTrimesh (this, density, g); }
125 void setTrimeshTotal(dReal total, dGeomID g)
126 { dMassSetTrimeshTotal (this, total, g); }
128 void adjust (dReal newmass)
129 { dMassAdjust (this,newmass); }
130 void translate (dReal x, dReal y, dReal z)
131 { dMassTranslate (this,x,y,z); }
132 void rotate (const dMatrix3 R)
133 { dMassRotate (this,R); }
134 void add (const dMass *b)
135 { dMassAdd (this,b); }