cODEGenericBody Class Reference
[Module - ODE Dynamics Engine (Rigid Body Simulation)]

cODEGenericBody is a base class for modeling any ODE dynamic body. More...

#include <CODEGenericBody.h>

Inheritance diagram for cODEGenericBody:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 cODEGenericBody (cODEWorld *a_world)
 Constructor of cODEGenericBody.
virtual ~cODEGenericBody ()
 Destructor of cODEGenericBody.
void setPosition (cVector3d &a_position)
 Set the position of object.
void setRotation (cMatrix3d &a_rotation)
 Set the orientation of object.
void updateBodyPosition (void)
 Update position and orientation from ode model to chai model.
void addGlobalForceAtGlobalPos (cVector3d &a_force, cVector3d &a_pos)
 Apply an external force at a given position decribed in global coordinates.
void setMass (double a_mass)
 Set object mass.
double getMass ()
 Read object mass.
void setImageModel (cGenericObject *a_imageModel)
 Set a chai3D body image of object.
cGenericObjectgetImageModel ()
 Get body image.
void enableDynamics ()
 Enable object from dynamic update.
void disableDynamics ()
 Disable object from dynamic update.
bool isStatic ()
 Is the current object static? (cannot move).
virtual void buildDynamicModel ()
 Create a dynamic model of the object.
void createDynamicBoundingBox (bool a_staticObject=false)
 Create a dynamic box representation.
void createDynamicSphere (const double a_radius, bool a_staticObject=false, const cVector3d &a_offsetPos=cVector3d(0.0, 0.0, 0.0), const cMatrix3d &a_offsetRot=cIdentity3d())
 Create a dynamic sphere representation.
void createDynamicBox (const double a_lengthX, const double a_lengthY, const double a_lengthZ, bool a_staticObject=false, const cVector3d &a_offsetPos=cVector3d(0.0, 0.0, 0.0), const cMatrix3d &a_offsetRot=cIdentity3d())
 Create a dynamic box representation.
void createDynamicCapsule (const double a_radius, const double a_length, bool a_staticObject=false, const cVector3d &a_offsetPos=cVector3d(0.0, 0.0, 0.0), const cMatrix3d &a_offsetRot=cIdentity3d())
 Create a dynamic caped cylinder (capsule) representation.
void createStaticPlane (const cVector3d &a_position, const cVector3d &a_normal)
 Create a static plane representation.
void createDynamicMesh (bool a_staticObject=false, const cVector3d &a_offsetPos=cVector3d(0.0, 0.0, 0.0), const cMatrix3d &a_offsetRot=cIdentity3d())
 Create a triangle mesh representation.
void updateGlobalPositions (const bool a_frameOnly)
 Update global position frames.
void render (const int a_renderMode)
 Render object in OpenGL.
void setShowDynamicCollisionModel (const bool a_show)
 Show collision model.
bool getShowDynamicCollisionModel ()
 Read show collision model status.

Public Attributes

cODEWorldm_ODEWorld
 Parent world.
cGenericObjectm_imageModel
 Object used to represent the geometry and graphical properties of the object.


Detailed Description

cODEGenericBody is a base class for modeling any ODE dynamic body.

Member Function Documentation

void cODEGenericBody::addGlobalForceAtGlobalPos ( cVector3d a_force,
cVector3d a_pos 
)

Apply an external force at a given position decribed in global coordinates.

Apply an external force at a given position. Position and force are expressed in global coordinates.

Parameters:
a_force Force vector to apply on body
a_pos Position (in global coordinates) when force is applied.

void cODEGenericBody::createDynamicBoundingBox ( bool  a_staticObject = false  ) 

Create a dynamic box representation.

Uses the bounding box of the geometric representation of the object to generate a dynamic box.

Parameters:
a_staticObject If true, then object is static had no dynamic component is created.

void cODEGenericBody::createDynamicBox ( const double  a_lengthX,
const double  a_lengthY,
const double  a_lengthZ,
bool  a_staticObject = false,
const cVector3d a_offsetPos = cVector3d(0.0, 0.0, 0.0),
const cMatrix3d a_offsetRot = cIdentity3d() 
)

Create a dynamic box representation.

Create an ODE dynamic box model. This model is independent from the body image which also needs to be defined by the user. It is possible to visualize the actual ODE physical model by calling setShowDynamicCollisionModel() method.

Parameters:
a_lengthX Size of box along x axis.
a_lengthY Size of box along y axis.
a_lengthZ Size of box along z axis.
a_staticObject If true, then object is static had no dynamic component is created.
a_offsetPos Offset position in respect current object position.
a_offsetRot Offset position in respect current object rotation.

void cODEGenericBody::createDynamicCapsule ( const double  a_radius,
const double  a_length,
bool  a_staticObject = false,
const cVector3d a_offsetPos = cVector3d(0.0, 0.0, 0.0),
const cMatrix3d a_offsetRot = cIdentity3d() 
)

Create a dynamic caped cylinder (capsule) representation.

Create an ODE dynamic cylinder model (capsule). This model is independent from the body image which also needs to be defined by the user. It is possible to visualize the actual ODE physical model by calling setShowDynamicCollisionModel() method.

Parameters:
a_radius Radius of capsule.
a_length Length of capsule.
a_staticObject If true, then object is static had no dynamic component is created.
a_offsetPos Offset position in respect current object position.
a_offsetRot Offset position in respect current object rotation.

void cODEGenericBody::createDynamicMesh ( bool  a_staticObject = false,
const cVector3d a_offsetPos = cVector3d(0.0, 0.0, 0.0),
const cMatrix3d a_offsetRot = cIdentity3d() 
)

Create a triangle mesh representation.

Create an ODE dynamic model of a mesh. This model requires the body image to be a mesh and uses it triangles to build its physical model.

Parameters:
a_staticObject If true, then object is static had no dynamic component is created.
a_offsetPos Offset position in respect current object position.
a_offsetRot Offset position in respect current object rotation.

void cODEGenericBody::createDynamicSphere ( const double  a_radius,
bool  a_staticObject = false,
const cVector3d a_offsetPos = cVector3d(0.0, 0.0, 0.0),
const cMatrix3d a_offsetRot = cIdentity3d() 
)

Create a dynamic sphere representation.

Create an ODE dynamic sphere model. This model is independent from the body image which also needs to be defined by the user. It is possible to visualize the actual ODE physical model by calling setShowDynamicCollisionModel() method.

Parameters:
a_radius Radius of sphere.
a_staticObject If true, then object is static had no dynamic component is created.
a_offsetPos Offset position in respect current object position.
a_offsetRot Offset position in respect current object rotation.

void cODEGenericBody::createStaticPlane ( const cVector3d a_position,
const cVector3d a_normal 
)

Create a static plane representation.

Create an ODE static model of a plane. This model is independent from the body image which also needs to be defined by the user. It is possible to visualize the actual ODE physical model by calling setShowDynamicCollisionModel() method.

Parameters:
a_position Position of a point located on the plane.
a_normal Surface normal of the plane.

void cODEGenericBody::enableDynamics (  ) 

Enable object from dynamic update.

Enable object from being updated within the dynamics simulation.

Disable object from being updated within the dynamics simulation.

void cODEGenericBody::render ( const int  a_renderMode  )  [virtual]

Render object in OpenGL.

Render this deformable mesh in OpenGL.

Parameters:
a_renderMode Rendering mode (see cGenericObject).

Reimplemented from cGenericObject.

void cODEGenericBody::setImageModel ( cGenericObject a_imageModel  ) 

Set a chai3D body image of object.

Define a generic object such as a mesh or a shape which is used to model the geometry of this current ODE object.

Parameters:
a_imageModel CHAI 3D graphical image model.

void cODEGenericBody::setMass ( double  a_mass  ) 

Set object mass.

Set the mass of current object

Parameters:
a_mass New object mass.

void cODEGenericBody::setPosition ( cVector3d a_position  ) 

Set the position of object.

Set a desired position.

Parameters:
a_position New desired position.

void cODEGenericBody::setRotation ( cMatrix3d a_rotation  ) 

Set the orientation of object.

Set the orientation of object.

Parameters:
a_rotation New desired orientation.

void cODEGenericBody::updateBodyPosition ( void   ) 

Update position and orientation from ode model to chai model.

Update position and orientation from ODE models to chai models.

void cODEGenericBody::updateGlobalPositions ( const bool  a_frameOnly  )  [virtual]

Update global position frames.

Compute globalPos and globalRot given the localPos and localRot of this object and its parents. Optionally propagates to children.

If a_frameOnly is set to false, additional global positions such as vertex positions are computed (which can be time-consuming).

Parameters:
a_frameOnly If true then only the global frame is computed

Reimplemented from cGenericObject.


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


CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.