RigidObject Class Reference

#include <rimPhysicsObjectRigid.h>

List of all members.

Public Member Functions

 RigidObject ()
 Create a new rigid object centered at the origin with zero velocity.
 RigidObject (const Transformation3 &transformation)
 Create a new rigid object with the specified transformation with zero velocity.
 RigidObject (const Transformation3 &transformation, const Vector3 &velocity, const Vector3 &angularVelocity)
 Creates a new rigid object with the specified transformation, velocities.
 ~RigidObject ()
 Destroy a rigid object.
const Transformation3getTransformation () const
 Get a constant reference to this rigid physics object's 3D transformation.
Transformation3 getCenterOfMassTransformation () const
const Vector3getPosition () const
 Get a constant reference to this rigid physics object's position in 3D space.
const Vector3getCenterOfMass () const
const Matrix3getOrientation () const
 Get a constant reference to this rigid physics object's 3D orientation.
Real getScale () const
 Get a number representing this rigid physics object's scale.
void setPosition (const Vector3 &newUserPosition)
 Set this rigid physics object's position in 3D space.
void setPosition (Real newPosX, Real newPosY, Real newPosZ)
void setCenterOfMass (const Vector3 &newCenterOfMass)
 Change the position of the object by setting it's world-space center of mass.
void setCenterOfMass (Real newCOMX, Real newCOMY, Real newCOMZ)
Vector3 getLocalCenterOfMass ()
void setLocalCenterOfMass (const Vector3 &newLocalCenterOfMass)
 Set the position of the center of mass in the object's local coordinate system.
void setLocalCenterOfMass (Real localCOMX, Real localCOMY, Real localCOMZ)
void setCenterOfMassOrientation (const Matrix3 &newOrientation)
 Set this rigid physics object's 3D orientation.
void setOrientation (const Matrix3 &newOrientation)
void setCenterOfMassScale (Real newScale)
 Set this rigid physics object's scale.
void setScale (Real newScale)
const Vector3getVelocity () const
const Vector3getBiasVelocity () const
Vector3 getAngularVelocity () const
Vector3 getBiasAngularVelocity () const
Vector3 getAngularMomentum () const
Vector3 getBiasAngularMomentum () const
void setVelocity (const Vector3 &newVelocity)
void setBiasVelocity (const Vector3 &newBiasVelocity)
void setVelocity (Real newVelX, Real newVelY, Real newVelZ)
void setBiasVelocity (Real newBVelX, Real newBVelY, Real newBVelZ)
void setAngularVelocity (const Vector3 &newAngularVelocity)
void setAngularVelocity (Real newAngVelX, Real newAngVelY, Real newAngVelZ)
void setAngularMomentum (const Vector3 &newAngularMomentum)
void setAngularMomentum (Real newAngMomX, Real newAngMomY, Real newAngMomZ)
void setBiasAngularVelocity (const Vector3 &newBiasAngularVelocity)
void setBiasAngularVelocity (Real newBAngVelX, Real newBAngVelY, Real newBAngVelZ)
void setBiasAngularMomentum (const Vector3 &newBiasAngularMomentum)
void setBiasAngularMomentum (Real newBAngMomX, Real newBAngMomY, Real newBAngMomZ)
Vector3 getVelocityAtPoint (const Vector3 &r) const
Vector3 getBiasVelocityAtPoint (const Vector3 &r) const
void applyImpulse (const Vector3 &j, const Vector3 &r)
 Apply an impulse to a radial arm from the object's center of mass.
void applyBiasImpulse (const Vector3 &bj, const Vector3 &r)
 Apply an impulse to a radial arm from the object's center of mass.
void applyImpulse (const Vector3 &j)
 Apply an impulse to the object's center of mass.
void applyAngularImpulse (const Vector3 &j)
 Apply a purely angular impulse to the object's center of mass.
const Vector3getForce () const
const Vector3getTorque () const
void setForce (const Vector3 &newForce)
void setForce (Real newForceX, Real newForceY, Real newForceZ)
void setTorque (const Vector3 &newTorque)
void setTorque (Real newTorqueX, Real newTorqueY, Real newTorqueZ)
void applyForce (const Vector3 &f)
 Apply a force directly to the center of mass of the object.
void applyForce (const Vector3 &f, const Vector3 &r)
 Apply a force to a radial arm from the center of mass of the object.
void applyTorque (const Vector3 &t)
 Apply a torque to the center of mass of the object.
Real getMass () const
 Get the mass of this rigid object.
void setMass (Real newMass)
 Set the mass of this rigid object.
Real getInverseMass () const
 Get the inverse mass of the object.
const Matrix3getInverseWorldSpaceInertiaTensor () const
 Get the inverse world space inertia tensor of this object.
const Matrix3getInverseBodySpaceInertiaTensor () const
 Get the inverse body space inertia tensor of this object.
void setBodySpaceInertiaTensor (const Matrix3 &newBodySpaceInertiaTensor)
 Set the inverse body space inertia tensor of this object.
bool getIsStatic () const
 Get whether or not the object is allowed to move.
void setIsStatic (bool newIsStatic)
Hash getHashCode () const
const CollisionShapeInstancegetShape () const
 Get a pointer to the collision shape of this object.
bool hasShape () const
 Get whether or not this rigid object has a collision shape.
void setShape (const CollisionShape &newShape)
 Set the collision shape of the rigid object.
void clearShape ()
 Clear the shape of this object if it has one, deallocating the previously allocated shape instance.
Real getBoundingSphereRadius () const
 Get the bounding sphere radius of the object from its shape if it has one.
const Vector3getBoundingSpherePosition () const
 Get the bounding sphere position of the object from its shape if it has one.
DeactivationStategetDeactivationState ()
 Get a pointer to the deactivation state of this object.
const DeactivationStategetDeactivationState () const
 Get a pointer to the deactivation state of this object.
void addDeactivationState ()
 This method creates a new deactivation state object for this rigid object.
bool hasDeactivationState () const
 Get whether or not this object has any deactivation information.
void setDeactivationState (const DeactivationState &deactivationState)
 Set the deactivation state of the rigid object.
void clearDeactivationState ()
 Clear the deactivation info in this object, deallocating all deactivation state.

Private Member Functions

void updateWorldSpaceInertiaTensor ()
 Update the world space inertia tensor of the object from the body space tensor.

Private Attributes

Vector3 centerOfMass
 The center of mass of the object in world space.
Transformation3 transformation
 The user's position of the object in world coordinates.
Vector3 velocity
 The linear velocity vector of the rigid object in world space.
Vector3 biasVelocity
Vector3 angularVelocity
 The angular momentum vector of the rigid object in world space.
Vector3 biasAngularVelocity
Vector3 force
 The force vector of the rigid object in world space.
Vector3 torque
 The torque vector of the rigid object in world space.
Real mass
 The mass of the particle.
Real inverseMass
 The calculated inverse mass of the particle, 0.0 if mass is 0.0.
Matrix3 inverseBodySpaceInertiaTensor
 The inverse body space inertia tensor of a rigid object.
Matrix3 inverseWorldSpaceInertiaTensor
 The inverse world space inertia tensor of a rigid object.
bool isStatic
 Whether or not the object is static (unable to move or be moved).
const Hash hashCode
 A random integer hash code for the object, generated at creation.
CollisionShapeInstanceshape
 A pointer to an instance of a collision shape, the object's shape.
bool shapeNeedsNewTransformation
 Whether or not the object's shape instance needs to have its transformation updated.
DeactivationStatedeactivationState
 A pointer to a class containing deactivation info for this object.


Constructor & Destructor Documentation

RIM_PHYSICS_NAMESPACE_START RigidObject::RigidObject (  ) 

Create a new rigid object centered at the origin with zero velocity.

Create a new rigid object centered at the origin with zero velocity. All other attributes of the object are set to zero or identity values.

RigidObject::RigidObject ( const Transformation3 transformation  ) 

Create a new rigid object with the specified transformation with zero velocity.

Creates a new rigid object with the specified 3D transformation, which contains the object's position, orientation, and scale. All other attributes of the object are set to zero or identity values

Parameters:
transformation - the rigid object's transformation

RigidObject::RigidObject ( const Transformation3 transformation,
const Vector3 velocity,
const Vector3 angularVelocity 
)

Creates a new rigid object with the specified transformation, velocities.

Creates a new rigid object with the specified 3D transformation, which contains the object's position, orientation, and scale. The object also has the specified linear and angular velocities. All other attributes of the object are set to zero or identity values

Parameters:
transformation - the rigid object's transformation
velocity - the rigid object's velocity
angularVelocity - the rigid object's angular velocity

RigidObject::~RigidObject (  ) 

Destroy a rigid object.

Destroys a previously allocated rigid object. This in turn destroys all components that it contains (a function of the physics entity class destructor). If it did not do this, then the user of the library would have to manually manage the memory for all of each object's components, which would be a huge pain in the ass. Therefore, components are automatically memory managed.


Member Function Documentation

const Transformation3& RigidObject::getTransformation (  )  const [inline]

Get a constant reference to this rigid physics object's 3D transformation.

Get a constant reference to this rigid physics object's 3D transformation. The transformation contains an object's position, orientation, and scale factor. It can be used to quickly transform points from body to world space or visce-versa.

Returns:
rigid object's transformation

Transformation3 RigidObject::getCenterOfMassTransformation (  )  const [inline]

const Vector3& RigidObject::getPosition (  )  const [inline]

Get a constant reference to this rigid physics object's position in 3D space.

This po

Returns:
rigid object's position

const Vector3& RigidObject::getCenterOfMass (  )  const [inline]

const Matrix3& RigidObject::getOrientation (  )  const [inline]

Get a constant reference to this rigid physics object's 3D orientation.

This is defined by a 3 by 3 orthonormal matrix. The orthonormal constraint is enforced whenever the orientation of the object is modified. The coordinate system is right handed and the matrix is column-major.

Returns:
the rigid object's orientation

Real RigidObject::getScale (  )  const [inline]

Get a number representing this rigid physics object's scale.

This scaling factor can be used to dynamically increase or decrease the size of a rigid object in a linear fasion. A scale factor of 1 correlates to no scaling, > 1 makes the object bigger by that factor, < 1 makes the object smaller.

Returns:
the rigid object's scale

void RigidObject::setPosition ( const Vector3 newUserPosition  )  [inline]

Set this rigid physics object's position in 3D space.

Get a constant reference to this rigid physics object's position in 3D space.

Parameters:
newPosition - the object's new position

void RigidObject::setPosition ( Real  newPosX,
Real  newPosY,
Real  newPosZ 
) [inline]

void RigidObject::setCenterOfMass ( const Vector3 newCenterOfMass  )  [inline]

Change the position of the object by setting it's world-space center of mass.

A call to this method moves the object and ensures that it's center of mass resides at the location specified. The location of the user position is also updated to reflect this move. The center of mass is mainly used for internal dynamics calculations, and if the user of the object does not want to couple the objects visual position and it's physical center of mass, then he or she should use the user position instead.

Parameters:
newCenterOfMass - the new center of mass of the object.

void RigidObject::setCenterOfMass ( Real  newCOMX,
Real  newCOMY,
Real  newCOMZ 
) [inline]

Vector3 RigidObject::getLocalCenterOfMass (  )  [inline]

void RigidObject::setLocalCenterOfMass ( const Vector3 newLocalCenterOfMass  )  [inline]

Set the position of the center of mass in the object's local coordinate system.

This is the position of the center of mass relative to the user position. This method should be used to change the relative positions of the center of mass and user position of the object.

void RigidObject::setLocalCenterOfMass ( Real  localCOMX,
Real  localCOMY,
Real  localCOMZ 
) [inline]

void RigidObject::setCenterOfMassOrientation ( const Matrix3 newOrientation  )  [inline]

Set this rigid physics object's 3D orientation.

Set this rigid physics object's 3D orientation. This is defined by a 3 by 3 rotation matrix.

Parameters:
newOrientation - the object's new orientation

void RigidObject::setOrientation ( const Matrix3 newOrientation  )  [inline]

void RigidObject::setCenterOfMassScale ( Real  newScale  )  [inline]

Set this rigid physics object's scale.

Set this rigid object's scale factor. This scaling factor can be used to dynamically increase or decrease the size of a rigid object in a linear fasion. A scale factor of 1 correlates to no scaling, > 1 makes the object bigger by that factor, < 1 makes the object smaller. If the new scale is less than 0, then the scale factor is set to 1. At any time during simulation, the scale of the object can be changed with no speed penalty.

Parameters:
newScale - the scale factor to be set

void RigidObject::setScale ( Real  newScale  )  [inline]

const Vector3& RigidObject::getVelocity (  )  const [inline]

const Vector3& RigidObject::getBiasVelocity (  )  const [inline]

Vector3 RigidObject::getAngularVelocity (  )  const [inline]

Vector3 RigidObject::getBiasAngularVelocity (  )  const [inline]

Vector3 RigidObject::getAngularMomentum (  )  const [inline]

Vector3 RigidObject::getBiasAngularMomentum (  )  const [inline]

void RigidObject::setVelocity ( const Vector3 newVelocity  )  [inline]

void RigidObject::setBiasVelocity ( const Vector3 newBiasVelocity  )  [inline]

void RigidObject::setVelocity ( Real  newVelX,
Real  newVelY,
Real  newVelZ 
) [inline]

void RigidObject::setBiasVelocity ( Real  newBVelX,
Real  newBVelY,
Real  newBVelZ 
) [inline]

void RigidObject::setAngularVelocity ( const Vector3 newAngularVelocity  )  [inline]

void RigidObject::setAngularVelocity ( Real  newAngVelX,
Real  newAngVelY,
Real  newAngVelZ 
) [inline]

void RigidObject::setAngularMomentum ( const Vector3 newAngularMomentum  )  [inline]

void RigidObject::setAngularMomentum ( Real  newAngMomX,
Real  newAngMomY,
Real  newAngMomZ 
) [inline]

void RigidObject::setBiasAngularVelocity ( const Vector3 newBiasAngularVelocity  )  [inline]

void RigidObject::setBiasAngularVelocity ( Real  newBAngVelX,
Real  newBAngVelY,
Real  newBAngVelZ 
) [inline]

void RigidObject::setBiasAngularMomentum ( const Vector3 newBiasAngularMomentum  )  [inline]

void RigidObject::setBiasAngularMomentum ( Real  newBAngMomX,
Real  newBAngMomY,
Real  newBAngMomZ 
) [inline]

Vector3 RigidObject::getVelocityAtPoint ( const Vector3 r  )  const [inline]

Vector3 RigidObject::getBiasVelocityAtPoint ( const Vector3 r  )  const [inline]

void RigidObject::applyImpulse ( const Vector3 j,
const Vector3 r 
) [inline]

Apply an impulse to a radial arm from the object's center of mass.

void RigidObject::applyBiasImpulse ( const Vector3 bj,
const Vector3 r 
) [inline]

Apply an impulse to a radial arm from the object's center of mass.

void RigidObject::applyImpulse ( const Vector3 j  )  [inline]

Apply an impulse to the object's center of mass.

void RigidObject::applyAngularImpulse ( const Vector3 j  )  [inline]

Apply a purely angular impulse to the object's center of mass.

const Vector3& RigidObject::getForce (  )  const [inline]

const Vector3& RigidObject::getTorque (  )  const [inline]

void RigidObject::setForce ( const Vector3 newForce  )  [inline]

void RigidObject::setForce ( Real  newForceX,
Real  newForceY,
Real  newForceZ 
) [inline]

void RigidObject::setTorque ( const Vector3 newTorque  )  [inline]

void RigidObject::setTorque ( Real  newTorqueX,
Real  newTorqueY,
Real  newTorqueZ 
) [inline]

void RigidObject::applyForce ( const Vector3 f  )  [inline]

Apply a force directly to the center of mass of the object.

void RigidObject::applyForce ( const Vector3 f,
const Vector3 r 
) [inline]

Apply a force to a radial arm from the center of mass of the object.

void RigidObject::applyTorque ( const Vector3 t  )  [inline]

Apply a torque to the center of mass of the object.

Real RigidObject::getMass (  )  const [inline]

Get the mass of this rigid object.

void RigidObject::setMass ( Real  newMass  )  [inline]

Set the mass of this rigid object.

If the supplied mass is less than zero, then the mass of the object will be set to zero, as well the inverse mass property of the object.

Parameters:
newMass - the new mass of the object.

Real RigidObject::getInverseMass (  )  const [inline]

Get the inverse mass of the object.

This property is pre-calculated so that the inverse mass which is needed in many physics dynamics calculations can be easily and efficiently queried without having to recalculate it.

Returns:
the inverse of this object's mass.

const Matrix3& RigidObject::getInverseWorldSpaceInertiaTensor (  )  const [inline]

Get the inverse world space inertia tensor of this object.

const Matrix3& RigidObject::getInverseBodySpaceInertiaTensor (  )  const [inline]

Get the inverse body space inertia tensor of this object.

void RigidObject::setBodySpaceInertiaTensor ( const Matrix3 newBodySpaceInertiaTensor  )  [inline]

Set the inverse body space inertia tensor of this object.

The inverse world space inertia tensor counterpart matrix is updated from this value.

Parameters:
newInverseBodySpaceInertiaTensor - the new inertia tensor for the object.

bool RigidObject::getIsStatic (  )  const [inline]

Get whether or not the object is allowed to move.

void RigidObject::setIsStatic ( bool  newIsStatic  )  [inline]

Hash RigidObject::getHashCode (  )  const [inline]

const CollisionShapeInstance* RigidObject::getShape (  )  const [inline]

Get a pointer to the collision shape of this object.

If this object has a collision shape, then a pointer to the collision shape instance object is returned. If it does not, then NULL is returned. The returned collision shape is guaranteed to be updated with the rigid object's current transformation.

Returns:
a pointer to the collision shape of the rigid object.

bool RigidObject::hasShape (  )  const [inline]

Get whether or not this rigid object has a collision shape.

The object has a collision shape whenever the value returned from the getShape() method is not equal to NULL. This method tests that condition internally and therefore is more efficient than doing the test manually. Use of this method is prefered.

Returns:
whether or not this rigid object has a collision shape.

void RigidObject::setShape ( const CollisionShape newShape  ) 

Set the collision shape of the rigid object.

The shape parameter is asked for a new instance of itself which is then used as the new collision shape instance for the rigid object. The memory for the instance object is then managed internally and is destroyed whenever either the rigid object is destroyed, a new shape added to the object, or when the shape of the rigid object is cleared.

Parameters:
newShape - the new shape of this object from which an instance is requested.

void RigidObject::clearShape (  ) 

Clear the shape of this object if it has one, deallocating the previously allocated shape instance.

Real RigidObject::getBoundingSphereRadius (  )  const [inline]

Get the bounding sphere radius of the object from its shape if it has one.

const Vector3& RigidObject::getBoundingSpherePosition (  )  const [inline]

Get the bounding sphere position of the object from its shape if it has one.

DeactivationState* RigidObject::getDeactivationState (  )  [inline]

Get a pointer to the deactivation state of this object.

If this object has any deactivation information, then a pointer to the deactivation state object is returned. If it does not, then NULL is returned.

Returns:
the deactivation state of the rigid object.

const DeactivationState* RigidObject::getDeactivationState (  )  const [inline]

Get a pointer to the deactivation state of this object.

If this object has any deactivation information, then a pointer to the deactivation state object is returned. If it does not, then NULL is returned.

Returns:
the deactivation state of the rigid object.

void RigidObject::addDeactivationState (  ) 

This method creates a new deactivation state object for this rigid object.

The object is created with default paramters. If the object already has a deactivation state object, then the method does nothing.

bool RigidObject::hasDeactivationState (  )  const [inline]

Get whether or not this object has any deactivation information.

void RigidObject::setDeactivationState ( const DeactivationState deactivationState  ) 

Set the deactivation state of the rigid object.

The object referenced by the parameter is copied internally so as to reduce dependencies on external objects. Any previously allocated deactivation state object is deallocated.

Parameters:
deactivationState - the new deactivation state for the object.

void RigidObject::clearDeactivationState (  ) 

Clear the deactivation info in this object, deallocating all deactivation state.

void RigidObject::updateWorldSpaceInertiaTensor (  )  [inline, private]

Update the world space inertia tensor of the object from the body space tensor.


Member Data Documentation

Vector3 RigidObject::centerOfMass [private]

The center of mass of the object in world space.

Transformation3 RigidObject::transformation [private]

The user's position of the object in world coordinates.

Vector3 RigidObject::velocity [private]

The linear velocity vector of the rigid object in world space.

Vector3 RigidObject::biasVelocity [private]

Vector3 RigidObject::angularVelocity [private]

The angular momentum vector of the rigid object in world space.

Vector3 RigidObject::biasAngularVelocity [private]

Vector3 RigidObject::force [private]

The force vector of the rigid object in world space.

Vector3 RigidObject::torque [private]

The torque vector of the rigid object in world space.

Real RigidObject::mass [private]

The mass of the particle.

Real RigidObject::inverseMass [private]

The calculated inverse mass of the particle, 0.0 if mass is 0.0.

Matrix3 RigidObject::inverseBodySpaceInertiaTensor [private]

The inverse body space inertia tensor of a rigid object.

Matrix3 RigidObject::inverseWorldSpaceInertiaTensor [private]

The inverse world space inertia tensor of a rigid object.

bool RigidObject::isStatic [private]

Whether or not the object is static (unable to move or be moved).

const Hash RigidObject::hashCode [private]

A random integer hash code for the object, generated at creation.

CollisionShapeInstance* RigidObject::shape [private]

A pointer to an instance of a collision shape, the object's shape.

bool RigidObject::shapeNeedsNewTransformation [mutable, private]

Whether or not the object's shape instance needs to have its transformation updated.

DeactivationState* RigidObject::deactivationState [private]

A pointer to a class containing deactivation info for this object.


The documentation for this class was generated from the following files:
Generated on Tue Aug 26 00:03:21 2008 for Rim Physics by  doxygen 1.5.4