diff options
author | dan miller | 2007-10-19 05:24:38 +0000 |
---|---|---|
committer | dan miller | 2007-10-19 05:24:38 +0000 |
commit | f205de7847da7ae1c10212d82e7042d0100b4ce0 (patch) | |
tree | 9acc9608a6880502aaeda43af52c33e278e95b9c /libraries/ode-0.9/include/ode/mass.h | |
parent | trying to fix my screwup part deux (diff) | |
download | opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.zip opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.gz opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.bz2 opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.xz |
from the start... checking in ode-0.9
Diffstat (limited to 'libraries/ode-0.9/include/ode/mass.h')
-rw-r--r-- | libraries/ode-0.9/include/ode/mass.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/libraries/ode-0.9/include/ode/mass.h b/libraries/ode-0.9/include/ode/mass.h new file mode 100644 index 0000000..19740fc --- /dev/null +++ b/libraries/ode-0.9/include/ode/mass.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /************************************************************************* | ||
2 | * * | ||
3 | * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * | ||
4 | * All rights reserved. Email: russ@q12.org Web: www.q12.org * | ||
5 | * * | ||
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 * | ||
12 | * file LICENSE.TXT. * | ||
13 | * (2) The BSD-style license that is included with this library in * | ||
14 | * the file LICENSE-BSD.TXT. * | ||
15 | * * | ||
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. * | ||
20 | * * | ||
21 | *************************************************************************/ | ||
22 | |||
23 | #ifndef _ODE_MASS_H_ | ||
24 | #define _ODE_MASS_H_ | ||
25 | |||
26 | #include <ode/common.h> | ||
27 | |||
28 | #ifdef __cplusplus | ||
29 | extern "C" { | ||
30 | #endif | ||
31 | |||
32 | struct dMass; | ||
33 | typedef struct dMass dMass; | ||
34 | |||
35 | /** | ||
36 | * Check if a mass structure has valid value. | ||
37 | * The function check if the mass and innertia matrix are positive definits | ||
38 | * | ||
39 | * @param m A mass structure to check | ||
40 | * | ||
41 | * @return 1 if both codition are met | ||
42 | */ | ||
43 | ODE_API int dMassCheck(const dMass *m); | ||
44 | |||
45 | ODE_API void dMassSetZero (dMass *); | ||
46 | |||
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); | ||
51 | |||
52 | ODE_API void dMassSetSphere (dMass *, dReal density, dReal radius); | ||
53 | ODE_API void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius); | ||
54 | |||
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); | ||
59 | |||
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); | ||
64 | |||
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); | ||
69 | |||
70 | ODE_API void dMassSetTrimesh (dMass *, dReal density, dGeomID g); | ||
71 | |||
72 | ODE_API void dMassSetTrimeshTotal (dMass *m, dReal total_mass, dGeomID g); | ||
73 | |||
74 | ODE_API void dMassAdjust (dMass *, dReal newmass); | ||
75 | |||
76 | ODE_API void dMassTranslate (dMass *, dReal x, dReal y, dReal z); | ||
77 | |||
78 | ODE_API void dMassRotate (dMass *, const dMatrix3 R); | ||
79 | |||
80 | ODE_API void dMassAdd (dMass *a, const dMass *b); | ||
81 | |||
82 | // Backwards compatible API | ||
83 | #define dMassSetCappedCylinder dMassSetCapsule | ||
84 | #define dMassSetCappedCylinderTotal dMassSetCapsuleTotal | ||
85 | |||
86 | |||
87 | struct dMass { | ||
88 | dReal mass; | ||
89 | dVector4 c; | ||
90 | dMatrix3 I; | ||
91 | |||
92 | #ifdef __cplusplus | ||
93 | dMass() | ||
94 | { dMassSetZero (this); } | ||
95 | void setZero() | ||
96 | { dMassSetZero (this); } | ||
97 | void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz, | ||
98 | dReal I11, dReal I22, dReal I33, | ||
99 | dReal I12, dReal I13, dReal I23) | ||
100 | { dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); } | ||
101 | void setSphere (dReal density, dReal radius) | ||
102 | { dMassSetSphere (this,density,radius); } | ||
103 | void setCapsule (dReal density, int direction, dReal a, dReal b) | ||
104 | { dMassSetCappedCylinder (this,density,direction,a,b); } | ||
105 | void setCappedCylinder (dReal density, int direction, dReal a, dReal b) | ||
106 | { setCapsule(density, direction, a, b); } | ||
107 | void setBox (dReal density, dReal lx, dReal ly, dReal lz) | ||
108 | { dMassSetBox (this,density,lx,ly,lz); } | ||
109 | void adjust (dReal newmass) | ||
110 | { dMassAdjust (this,newmass); } | ||
111 | void translate (dReal x, dReal y, dReal z) | ||
112 | { dMassTranslate (this,x,y,z); } | ||
113 | void rotate (const dMatrix3 R) | ||
114 | { dMassRotate (this,R); } | ||
115 | void add (const dMass *b) | ||
116 | { dMassAdd (this,b); } | ||
117 | #endif | ||
118 | }; | ||
119 | |||
120 | |||
121 | #ifdef __cplusplus | ||
122 | } | ||
123 | #endif | ||
124 | |||
125 | #endif | ||