Panda3D
 All Classes Functions Variables Enumerations
odeMass.h
1 // Filename: odeMass.h
2 // Created by: joswilso (27Dec06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef ODEMASS_H
16 #define ODEMASS_H
17 
18 #include "pandabase.h"
19 #include "typedReferenceCount.h"
20 #include "luse.h"
21 
22 #include "ode_includes.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : OdeMass
26 // Description :
27 ////////////////////////////////////////////////////////////////////
28 class EXPCL_PANDAODE OdeMass : public TypedReferenceCount {
29 PUBLISHED:
30  OdeMass();
31  OdeMass(const OdeMass &copy);
32  virtual ~OdeMass();
33 
34  INLINE int check();
35  INLINE void set_zero();
36  INLINE void set_parameters(dReal themass,
37  dReal cgx, dReal cgy, dReal cgz,
38  dReal I11, dReal I22, dReal I33,
39  dReal I12, dReal I13, dReal I23);
40  INLINE void set_parameters(dReal themass,
41  const LVecBase3f &center,
42  const LMatrix3f &r);
43  INLINE void set_sphere(dReal density, dReal radius);
44  INLINE void set_sphere_total(dReal total_mass, dReal radius);
45  INLINE void set_capsule(dReal density, int direction,
46  dReal radius, dReal length);
47  INLINE void set_capsule_total(dReal total_mass, int direction,
48  dReal radius, dReal length);
49  INLINE void set_cylinder(dReal density, int direction,
50  dReal radius, dReal length);
51  INLINE void set_cylinder_total(dReal total_mass, int direction,
52  dReal radius, dReal length);
53  INLINE void set_box(dReal density,
54  dReal lx, dReal ly, dReal lz);
55  INLINE void set_box(dReal density,
56  const LVecBase3f &size);
57  INLINE void set_box_total(dReal total_mass,
58  dReal lx, dReal ly, dReal lz);
59  INLINE void set_box_total(dReal total_mass,
60  const LVecBase3f &size);
61  INLINE void adjust(dReal newmass);
62  INLINE void translate(dReal x, dReal y, dReal z);
63  INLINE void translate(const LVecBase3f &pos);
64  INLINE void rotate(const LMatrix3f &r);
65  INLINE void add(OdeMass &other);
66 
67  INLINE dReal get_magnitude() const;
68  INLINE LPoint3f get_center() const;
69  INLINE LMatrix3f get_inertial_tensor() const;
70 
71  virtual void write(ostream &out = cout, unsigned int indent=0) const;
72 
73 public:
74  dMass* get_mass_ptr();
75 
76 private:
77  void operator = (const OdeMass &copy);
78  dMass _mass;
79 
80 public:
81  static TypeHandle get_class_type() {
82  return _type_handle;
83  }
84  static void init_type() {
85  TypedReferenceCount::init_type();
86  register_type(_type_handle, "OdeMass",
87  TypedReferenceCount::get_class_type());
88  }
89  virtual TypeHandle get_type() const {
90  return get_class_type();
91  }
92  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
93 
94 private:
95  static TypeHandle _type_handle;
96 };
97 
98 #include "odeMass.I"
99 
100 #endif
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This is a 3-by-3 transform matrix.
Definition: lmatrix.h:110