source: GTP/trunk/Lib/Geom/OgreStuff/include/ode/mass.h @ 1809

Revision 1809, 3.9 KB checked in by gumbau, 18 years ago (diff)
Line 
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
29extern "C" {
30#endif
31
32struct dMass;
33typedef struct dMass dMass;
34
35
36void dMassSetZero (dMass *);
37
38void dMassSetParameters (dMass *, dReal themass,
39                         dReal cgx, dReal cgy, dReal cgz,
40                         dReal I11, dReal I22, dReal I33,
41                         dReal I12, dReal I13, dReal I23);
42
43void dMassSetSphere (dMass *, dReal density, dReal radius);
44void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
45
46void dMassSetCappedCylinder (dMass *, dReal density, int direction,
47                             dReal radius, dReal length);
48void dMassSetCappedCylinderTotal (dMass *, dReal total_mass, int direction,
49                                  dReal radius, dReal length);
50
51void dMassSetCylinder (dMass *, dReal density, int direction,
52                       dReal radius, dReal length);
53void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
54                            dReal radius, dReal length);
55
56void dMassSetBox (dMass *, dReal density,
57                  dReal lx, dReal ly, dReal lz);
58void dMassSetBoxTotal (dMass *, dReal total_mass,
59                       dReal lx, dReal ly, dReal lz);
60
61void dMassAdjust (dMass *, dReal newmass);
62
63void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
64
65void dMassRotate (dMass *, const dMatrix3 R);
66
67void dMassAdd (dMass *a, const dMass *b);
68
69
70
71struct dMass {
72  dReal mass;
73  dVector4 c;
74  dMatrix3 I;
75
76#ifdef __cplusplus
77  dMass()
78    { dMassSetZero (this); }
79  void setZero()
80    { dMassSetZero (this); }
81  void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
82                      dReal I11, dReal I22, dReal I33,
83                      dReal I12, dReal I13, dReal I23)
84    { dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
85  void setSphere (dReal density, dReal radius)
86    { dMassSetSphere (this,density,radius); }
87  void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
88    { dMassSetCappedCylinder (this,density,direction,a,b); }
89  void setBox (dReal density, dReal lx, dReal ly, dReal lz)
90    { dMassSetBox (this,density,lx,ly,lz); }
91  void adjust (dReal newmass)
92    { dMassAdjust (this,newmass); }
93  void translate (dReal x, dReal y, dReal z)
94    { dMassTranslate (this,x,y,z); }
95  void rotate (const dMatrix3 R)
96    { dMassRotate (this,R); }
97  void add (const dMass *b)
98    { dMassAdd (this,b); }
99#endif
100};
101
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif
Note: See TracBrowser for help on using the repository browser.