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