Panda3D

odeMass.h

00001 // Filename: odeMass.h
00002 // Created by:  joswilso (27Dec06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef ODEMASS_H
00016 #define ODEMASS_H
00017 
00018 #include "pandabase.h"
00019 #include "typedReferenceCount.h"
00020 #include "luse.h"
00021 
00022 #include "ode_includes.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : OdeMass
00026 // Description : 
00027 ////////////////////////////////////////////////////////////////////
00028 class EXPCL_PANDAODE OdeMass : public TypedReferenceCount {
00029 PUBLISHED:
00030   OdeMass();
00031   OdeMass(const OdeMass &copy);
00032   virtual ~OdeMass();
00033   
00034   INLINE int check();
00035   INLINE void set_zero();
00036   INLINE void set_parameters(dReal themass,
00037                              dReal cgx, dReal cgy, dReal cgz,
00038                              dReal I11, dReal I22, dReal I33,
00039                              dReal I12, dReal I13, dReal I23);
00040   INLINE void set_parameters(dReal themass,
00041                              const LVecBase3f &center,
00042                              const LMatrix3f &r);
00043   INLINE void set_sphere(dReal density, dReal radius);
00044   INLINE void set_sphere_total(dReal total_mass, dReal radius);
00045   INLINE void set_capsule(dReal density, int direction,
00046                           dReal radius, dReal length);
00047   INLINE void set_capsule_total(dReal total_mass, int direction,
00048                                 dReal radius, dReal length);
00049   INLINE void set_cylinder(dReal density, int direction,
00050                            dReal radius, dReal length);
00051   INLINE void set_cylinder_total(dReal total_mass, int direction,
00052                                  dReal radius, dReal length);
00053   INLINE void set_box(dReal density,
00054                       dReal lx, dReal ly, dReal lz);
00055   INLINE void set_box(dReal density,
00056                       const LVecBase3f &size);
00057   INLINE void set_box_total(dReal total_mass,
00058                             dReal lx, dReal ly, dReal lz);
00059   INLINE void set_box_total(dReal total_mass,
00060                             const LVecBase3f &size);
00061   INLINE void adjust(dReal newmass);
00062   INLINE void translate(dReal x, dReal y, dReal z);
00063   INLINE void translate(const LVecBase3f &pos);
00064   INLINE void rotate(const LMatrix3f &r);
00065   INLINE void add(OdeMass &other);
00066 
00067   INLINE dReal get_magnitude() const;
00068   INLINE LPoint3f get_center() const;
00069   INLINE LMatrix3f get_inertial_tensor() const;
00070 
00071   virtual void write(ostream &out = cout, unsigned int indent=0) const;
00072 
00073 public:
00074   dMass* get_mass_ptr();
00075 
00076 private:
00077   void operator = (const OdeMass &copy);
00078   dMass _mass;
00079 
00080 public:
00081   static TypeHandle get_class_type() {
00082     return _type_handle;
00083   }
00084   static void init_type() {
00085     TypedReferenceCount::init_type();
00086     register_type(_type_handle, "OdeMass",
00087                   TypedReferenceCount::get_class_type());
00088   }
00089   virtual TypeHandle get_type() const {
00090     return get_class_type();
00091   }
00092   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00093 
00094 private:
00095   static TypeHandle _type_handle;
00096 };
00097 
00098 #include "odeMass.I"
00099 
00100 #endif
 All Classes Functions Variables Enumerations