#include <Body.h>
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. | |
| Mass & | operator= (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). | |
| Mass & | operator+= (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 |
The underlaying dMass structure is hidden to allow mass modification without having to re-set body masses afterwards.
Definition at line 53 of file Body.h.
| enum Physics::Mass::EAxis |
| Physics::Mass::Mass | ( | ) | [inline] |
| 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.
| void Physics::Mass::addMass | ( | const Mass & | m2 | ) | [inline] |
| void Physics::Mass::adjust | ( | dReal | mass | ) | [inline] |
| 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] |
| osg::Matrix Physics::Mass::getInertiaTensor | ( | ) | const [inline] |
| dReal Physics::Mass::getMass | ( | ) | const [inline] |
| void Physics::Mass::rotateMass | ( | const osg::Matrix & | m | ) | [inline] |
| void Physics::Mass::rotateMass | ( | const osg::Quat & | q | ) | [inline] |
| void Physics::Mass::setBox | ( | dReal | density, | |
| const osg::Vec3 & | size | |||
| ) | [inline] |
| 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] |
| 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] |
| 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::translateMass | ( | const osg::Vec3 & | vec | ) | [inline] |
dBodyID Physics::Mass::idBody [protected] |
Body in which this structure is.
Definition at line 128 of file Body.h.
Referenced by addMass(), adjust(), Physics::Body::Body(), operator+=(), rotateMass(), setBox(), setBoxTotal(), setCapsule(), setCapsuleTotal(), setCylinder(), setCylinderTotal(), setSphere(), setSphereTotal(), and translateMass().
1.5.9