SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
TaoDeMassProp.h
1 /* Copyright (c) 2005 Arachi, Inc. and Stanford University. All rights reserved.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject
9  * to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef _deMassProp_h
24 #define _deMassProp_h
25 
26 #include <tao/matrix/TaoDeTypes.h>
27 #include <tao/matrix/TaoDeMath.h>
28 
34 // @{
35 #define DE_DENSITY_AIR (-1.2062f)
36 #define DE_DENSITY_ALUMINUM (-2690.0f)
37 #define DE_DENSITY_CONCRETE (-2400.0f)
38 #define DE_DENSITY_COPPER (-8910.0f)
39 #define DE_DENSITY_EARTH_WET (-1760.0f)
40 #define DE_DENSITY_EARTH_DRY (-1280.0f)
41 #define DE_DENSITY_GLASS (-2590.0f)
42 #define DE_DENSITY_GOLD (-19300.0f)
43 #define DE_DENSITY_ICE (-900.0f)
44 #define DE_DENSITY_IRON (-7210.0f)
45 #define DE_DENSITY_LEAD (-11370.0f)
46 #define DE_DENSITY_MERCURY (-13570.0f)
47 #define DE_DENSITY_OIL (-900.0f)
48 #define DE_DENSITY_STEEL (-7830.0f)
49 #define DE_DENSITY_TITANIUM (-3080.0f)
50 #define DE_DENSITY_WATER (-1000.0f)
51 #define DE_DENSITY_WATER_SALT (-1030.0f)
52 #define DE_DENSITY_WOOD_SOFTPINE (-480.0f)
53 #define DE_DENSITY_WOOD_HARDOAK (-800.0f)
54 // @}
55 
61 {
62  public:
64  inline deMassProp() { zero(); }
65 
66  inline deMassProp(deMassProp const & orig) {
67  _m = orig._m;
68  _center = orig._center;
69  _inertia = orig._inertia;
70  }
71 
73  void zero() {
74  _m = 0;
75  _center.zero();
76  _inertia.zero();
77  }
79  void set(const deFloat* mass, const deVector3* center, const deMatrix3* inertia)
80  {
81  _m = *mass;
82  _center = *center;
83  _inertia = *inertia;
84  }
86  void get(deFloat* mass, deVector3* center, deMatrix3* inertia) const
87  {
88  *mass = _m;
89  *center = _center;
90  *inertia = _inertia;
91  }
98  deInt isDensity(deFloat m) { return (m < 0); }
99 
105  deFloat* mass() { return &_m; }
106  deFloat const * mass() const { return &_m; }
107 
109  deMatrix3* inertia() { return &_inertia; }
110  deMatrix3 const * inertia() const { return &_inertia; }
111 
113  deVector3* center() { return &_center; }
114  deVector3 const * center() const { return &_center; }
115 
121  void mass(const deFloat m, const deFrame* f = NULL);
128  void inertia(const deMatrix3* inertia, const deFrame* f = NULL);
131  void inertia(const deVector3* diag, const deFrame* f = NULL);
134  void inertia(const deFloat Ixx,const deFloat Iyy,const deFloat Izz, const deFrame* f = NULL);
144  void cylinder(const deFloat mp, const deFloat h, const deFloat r, const deFrame* f = NULL);
154  void cone(const deFloat mp, const deFloat h, const deFloat r, const deFrame* f = NULL);
165  void pyramid(const deFloat mp, const deFloat a, const deFloat b, const deFloat h, const deFrame* f = NULL);
177  void block(const deFloat mp, const deFloat a, const deFloat b, const deFloat c, const deFrame* f = NULL);
188  void sphere(const deFloat mp, const deFloat r, const deFrame* f = NULL);
197  void hemisphere(const deFloat mp, const deFloat r, const deFrame* f = NULL);
207  void ellipsoid(const deFloat mp, const deFloat a, const deFloat b, const deFloat c, const deFrame* f = NULL);
218  void rod(const deFloat mp, const deFloat l, const deFrame* f = NULL);
228  void disk(const deFloat mp, const deFloat r, const deFrame* f = NULL);
238  void plate(const deFloat mp, const deFloat a, const deFloat b, const deFrame* f = NULL);
249  void cylinderShell(const deFloat mp, const deFloat h, const deFloat r, const deFrame* f = NULL);
259  void coneShell(const deFloat mp, const deFloat h, const deFloat r, const deFrame* f = NULL);
270  void sphereShell(const deFloat mp, const deFloat r, const deFrame* f = NULL);
279  void hemisphereShell(const deFloat mp, const deFloat r, const deFrame* f = NULL);
293  void scale(const deFloat m);
298 
299  private:
300  deFloat _m;
301  deVector3 _center;
302  deMatrix3 _inertia;
303 };
304 #endif
void block(const deFloat mp, const deFloat a, const deFloat b, const deFloat c, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:156
deVector3 * center()
Definition: TaoDeMassProp.h:113
3x1 vector classThis is a C++ wrapper class of deVector3f.
Definition: TaoDeVector3.h:32
Compute Mass parameters.
Definition: TaoDeMassProp.h:60
deMatrix3 * inertia()
Definition: TaoDeMassProp.h:109
void set(const deFloat *mass, const deVector3 *center, const deMatrix3 *inertia)
set members with given values
Definition: TaoDeMassProp.h:79
void hemisphere(const deFloat mp, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:186
deFloat * mass()
Definition: TaoDeMassProp.h:105
deInt isDensity(deFloat m)
indicates if m is a density.
Definition: TaoDeMassProp.h:98
DE_MATH_API void zero()
this = zero matrix
Definition: TaoDeMatrix3Inl.h:29
void disk(const deFloat mp, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:232
void sphere(const deFloat mp, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:172
void cone(const deFloat mp, const deFloat h, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:120
void hemisphereShell(const deFloat mp, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:309
void scale(const deFloat m)
Definition: TaoDeMassProp.cpp:26
void rod(const deFloat mp, const deFloat l, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:219
void cylinderShell(const deFloat mp, const deFloat h, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:265
Transformation class using quaternionThis class consists of a quaternion for rotation and a vector fo...
Definition: TaoDeFrame.h:36
void pyramid(const deFloat mp, const deFloat a, const deFloat b, const deFloat h, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:138
void plate(const deFloat mp, const deFloat a, const deFloat b, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:248
void ellipsoid(const deFloat mp, const deFloat a, const deFloat b, const deFloat c, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:203
void sphereShell(const deFloat mp, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:295
void coneShell(const deFloat mp, const deFloat h, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:281
3x3 matrix classThis is a C++ wrapper class of deMatrix3f.
Definition: TaoDeMatrix3.h:33
void zero()
set members to zero
Definition: TaoDeMassProp.h:73
DE_MATH_API void zero()
this = 0
Definition: TaoDeVector3Inl.h:38
deMassProp()
constructor
Definition: TaoDeMassProp.h:64
void cylinder(const deFloat mp, const deFloat h, const deFloat r, const deFrame *f=NULL)
Definition: TaoDeMassProp.cpp:104