Physics::Mass Class Reference

Wrapper for mass parameters. More...

#include <Body.h>

List of all members.

Public Types

enum  EAxis { X_AXIS = 1, Y_AXIS = 2, Z_AXIS = 3 }
enum  EDirectInit {
  SPHERE, SPHERE_TOTAL, BOX, BOX_TOTAL,
  CYLINDER, CYLINDER_TOTAL, CAPSULE, CAPSULE_TOTAL
}

Public Member Functions

 Mass ()
 Creates an uninitialized mass.
 Mass (EDirectInit init_mode, dReal value, const osg::Vec3 &size)
 Creates and initializes the mass for BOX and BOX_TOTAL.
 Mass (EDirectInit init_mode, dReal value, dReal radius)
 Creates and initializes the mass for SPHERE and SPHERE_TOTAL.
 Mass (EDirectInit init_mode, dReal value, EAxis axis, dReal radius, dReal length)
 Creates and initializes the mass for CYLINDER/CAPSULE and CYLINDER_TOTAL/CAPSULE_TOTAL.
Massoperator= (const Mass &v)
dReal getMass () const
osg::Matrix getInertiaTensor () const
osg::Vec3 getCenter ()
 Gets the center of mass.
osg::Vec3 centerMass ()
 Sets the center of mass to be (0,0,0) and returns the translation that has occured.
void adjust (dReal mass)
 Sets mass and adjusts the inertia matrix (to keep data consistent).
void addMass (const Mass &m2)
 Add some mass to the current mass (when adding or removing somme matter).
Massoperator+= (const Mass &m2)
void translateMass (const osg::Vec3 &vec)
void rotateMass (const osg::Quat &q)
void rotateMass (const osg::Matrix &m)
void setSphere (dReal density, dReal radius)
 Computes everything that is needed for the mass to behave as a sphere.
void setSphereTotal (dReal totalMass, dReal radius)
 Same as setSphere() but the first argument is the mass, not the density.
void setBox (dReal density, const osg::Vec3 &size)
void setBoxTotal (dReal totalMass, const osg::Vec3 &size)
void setCylinder (dReal density, EAxis axis, dReal radius, dReal length)
void setCylinderTotal (dReal totalMass, EAxis axis, dReal radius, dReal length)
void setCapsule (dReal density, EAxis axis, dReal radius, dReal length)
void setCapsuleTotal (dReal totalMass, EAxis axis, dReal radius, dReal length)
void setZero ()
 Sets mass to zero.

Protected Member Functions

 operator dMass ()

Protected Attributes

dBodyID idBody
 Body in which this structure is.

Friends

class Body


Detailed Description

Wrapper for mass parameters.

The underlaying dMass structure is hidden to allow mass modification without having to re-set body masses afterwards.

Author:
Sukender

Definition at line 53 of file Body.h.


Member Enumeration Documentation

Enumerator:
X_AXIS 
Y_AXIS 
Z_AXIS 

Definition at line 55 of file Body.h.

Enumerator:
SPHERE 
SPHERE_TOTAL 
BOX 
BOX_TOTAL 
CYLINDER 
CYLINDER_TOTAL 
CAPSULE 
CAPSULE_TOTAL 

Definition at line 61 of file Body.h.


Constructor & Destructor Documentation

Physics::Mass::Mass (  )  [inline]

Creates an uninitialized mass.

Definition at line 73 of file Body.h.

Physics::Mass::Mass ( EDirectInit  init_mode,
dReal  value,
const osg::Vec3 &  size 
)

Creates and initializes the mass for BOX and BOX_TOTAL.

Definition at line 35 of file Body.cpp.

References BOX, BOX_TOTAL, setBox(), setBoxTotal(), and THROW_TRACED_EXCEPTION.

Physics::Mass::Mass ( EDirectInit  init_mode,
dReal  value,
dReal  radius 
)

Creates and initializes the mass for SPHERE and SPHERE_TOTAL.

Definition at line 40 of file Body.cpp.

References setSphere(), setSphereTotal(), SPHERE, SPHERE_TOTAL, and THROW_TRACED_EXCEPTION.

Physics::Mass::Mass ( EDirectInit  init_mode,
dReal  value,
EAxis  axis,
dReal  radius,
dReal  length 
)

Creates and initializes the mass for CYLINDER/CAPSULE and CYLINDER_TOTAL/CAPSULE_TOTAL.

Definition at line 45 of file Body.cpp.

References CAPSULE, CAPSULE_TOTAL, CYLINDER, CYLINDER_TOTAL, setCapsule(), setCapsuleTotal(), setCylinder(), setCylinderTotal(), and THROW_TRACED_EXCEPTION.


Member Function Documentation

void Physics::Mass::addMass ( const Mass m2  )  [inline]

Add some mass to the current mass (when adding or removing somme matter).

Definition at line 96 of file Body.h.

References idBody.

void Physics::Mass::adjust ( dReal  mass  )  [inline]

Sets mass and adjusts the inertia matrix (to keep data consistent).

Definition at line 94 of file Body.h.

References idBody.

osg::Vec3 Physics::Mass::centerMass (  )  [inline]

Sets the center of mass to be (0,0,0) and returns the translation that has occured.

Definition at line 91 of file Body.h.

References translateMass().

osg::Vec3 Physics::Mass::getCenter (  )  [inline]

Gets the center of mass.

Definition at line 89 of file Body.h.

osg::Matrix Physics::Mass::getInertiaTensor (  )  const [inline]

Definition at line 87 of file Body.h.

References Physics::toGraphMatInertia().

dReal Physics::Mass::getMass (  )  const [inline]

Definition at line 86 of file Body.h.

Referenced by Physics::NearCallback::operator()().

Physics::Mass::operator dMass (  )  [inline, protected]

Definition at line 126 of file Body.h.

Mass& Physics::Mass::operator+= ( const Mass m2  )  [inline]

Add some mass to the current mass (when adding or removing somme matter).

Definition at line 98 of file Body.h.

References idBody.

Mass& Physics::Mass::operator= ( const Mass v  )  [inline]

Definition at line 81 of file Body.h.

void Physics::Mass::rotateMass ( const osg::Matrix &  m  )  [inline]

Definition at line 102 of file Body.h.

References idBody, and Physics::toPhyMatRotation().

void Physics::Mass::rotateMass ( const osg::Quat &  q  )  [inline]

Definition at line 101 of file Body.h.

References idBody, and Physics::toPhyMatRotation().

void Physics::Mass::setBox ( dReal  density,
const osg::Vec3 &  size 
) [inline]

Definition at line 109 of file Body.h.

References idBody.

Referenced by Mass().

void Physics::Mass::setBoxTotal ( dReal  totalMass,
const osg::Vec3 &  size 
) [inline]

Definition at line 110 of file Body.h.

References idBody.

Referenced by Physics::createCanonicalBox(), and Mass().

void Physics::Mass::setCapsule ( dReal  density,
EAxis  axis,
dReal  radius,
dReal  length 
) [inline]

Definition at line 115 of file Body.h.

References idBody.

Referenced by Mass().

void Physics::Mass::setCapsuleTotal ( dReal  totalMass,
EAxis  axis,
dReal  radius,
dReal  length 
) [inline]

Definition at line 116 of file Body.h.

References idBody.

Referenced by Physics::createCanonicalCapsule(), and Mass().

void Physics::Mass::setCylinder ( dReal  density,
EAxis  axis,
dReal  radius,
dReal  length 
) [inline]

Definition at line 112 of file Body.h.

References idBody.

Referenced by Mass().

void Physics::Mass::setCylinderTotal ( dReal  totalMass,
EAxis  axis,
dReal  radius,
dReal  length 
) [inline]

Definition at line 113 of file Body.h.

References idBody.

Referenced by Physics::createCanonicalCylinder(), and Mass().

void Physics::Mass::setSphere ( dReal  density,
dReal  radius 
) [inline]

Computes everything that is needed for the mass to behave as a sphere.

Definition at line 105 of file Body.h.

References idBody.

Referenced by Physics::Body::Body(), and Mass().

void Physics::Mass::setSphereTotal ( dReal  totalMass,
dReal  radius 
) [inline]

Same as setSphere() but the first argument is the mass, not the density.

Definition at line 107 of file Body.h.

References idBody.

Referenced by Physics::createCanonicalSphere(), and Mass().

void Physics::Mass::setZero (  )  [inline]

Sets mass to zero.

Definition at line 122 of file Body.h.

void Physics::Mass::translateMass ( const osg::Vec3 &  vec  )  [inline]

Definition at line 100 of file Body.h.

References idBody.

Referenced by centerMass().


Friends And Related Function Documentation

friend class Body [friend]

Definition at line 125 of file Body.h.


Member Data Documentation

dBodyID Physics::Mass::idBody [protected]


The documentation for this class was generated from the following files:

Generated on Sun Jan 17 11:39:35 2010 for PVLE (Pro-Vocation Light Engine) by  doxygen 1.5.9