Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

rdGBody Class Reference

A graphical body. More...

#include <rdGBody.h>

Inheritance diagram for rdGBody:

rdObject List of all members.

Public Member Functions

 rdGBody ()
 Construct an empty graphics body.

 rdGBody (IDOM_Element *aElement)
 Construct a graphics body from an XML Element.

virtual ~rdGBody ()
 Destructor.

void setOrigin (double aX, double aY, double aZ)
 Set the origin of the body.

void getOrigin (double rP[3]) const
 Get the origin of the body.

void setPX (double aX, double aY, double aZ)
 Set a point along the desired x axis of the body.

void setPY (double aX, double aY, double aZ)
 Set a point along the desired y axis of the body.

void setPZ (double aX, double aY, double aZ)
 Set a point along the desired z axis of the body.

void setDensity (double aDensity)
 Set the density of this body.

double getDensity () const
 Get the density of this body.

void setMass (double aMass)
 Set the mass of this body.

double getMass () const
 Get the mass of this body.

void setCenterOfMass (const double aCOM[3])
 Set the center of mass of this body.

void getCenterOfMass (double rCOM[3]) const
 Get the center of mass of this body.

void setInertiaTensor (const double aI[6])
void getInertiaTensor (double rI[9]) const
 Get the inertia tensor of this body.

void translate (double aX, double aY, double aZ)
 Translate the vertices of this body by a specified amount.

void rotate (int aXYZ, double aRadians)
 Rotate a the vertices of this body about the X, Y, or Z axis by a specified amount.

void rotate (int aXYZ, double aRadians, const double aP[3])
 Rotate a the vertices of this body about a point about the X, Y, or Z axis by a specified amount.

bool isInside (const double aPoint[3]) const
 Determine whether or not a point is inside this body.

void estimateInertialProperties (double aCubeSize=0.0)
 Estimate the inertial properties of this body.

void computeNewFrame ()
 Compute a new body frame.

void updateEdgeIndices ()
 Update the edge indices.

void updateTriangleIndices ()
 Update the triangle indices.

void computeUpperBounds ()
 Compute the upper bounds of this body.

void computeLowerBounds ()
 Compute the lower bounds of this body.

void computeBounds ()
 Compute the bounds of this body.

void printBoneFile (const char *aFileName=NULL)
 Print a SIMM bone file.

virtual void updateObject (bool aDeep=true)
 Update this object based on its XML node.

virtual void updateNode (bool aDeep=true)
 Update the XML node representing this object.

void updateData ()
 Update the member data of this object based on its XML node.


Private Member Functions

void setNull ()
 Set NULL values for all member variables.


Private Attributes

double _origin [3]
 Origin of the coordinate system for the body.

double _x [3]
 X axis of the body.

double _y [3]
 Y axis of the body.

double _z [3]
 Z axis of the body.

double _px [3]
 The unit vector directed from the origin to px is the desired x axis.

double _py [3]
 The unit vector directed from the origin to py is the desired y axis.

double _pz [3]
 The unit vector directed from the origin to pz is the desired z axis.

rdVertices_vertices
 List of vertices.

rdEdges_edges
 List of edges.

rdTriangles_triangles
 List of triangles.

rdGBodies_bodies
 List of child bodies.

double _lower [3]
 Lower bounds.

double _upper [3]
 Upper bounds.

double _density
 Density.

double _mass
 Mass.

double _com [3]
 Center of mass.

double _inertia [3][3]
 Inertia tensor.


Detailed Description

A graphical body.


Constructor & Destructor Documentation

rdGBody::rdGBody IDOM_Element *  aElement  ) 
 

Construct a graphics body from an XML Element.

Parameters:
aElement XML element.


Member Function Documentation

void rdGBody::computeNewFrame  ) 
 

Compute a new body frame.

This procedure is done based on what has been set for the origin, px, py, and pz. All vertices in the body are translated so that the new origin lies at the point originally set for the origin, then they are rotated so that if possible, the x axis passes through px, the y axis through py, and the z axis through pz. When finished, the origin will be (0,0,0).

void rdGBody::estimateInertialProperties double  aCubeSize = 0.0  ) 
 

Estimate the inertial properties of this body.

The inertial properties include mass, center of mass, and the inertia tensor. These properties are estimated by assuming a uniform density and integrating over the volume of the body. A cube of finite dimension (aCubeSize) is used as the volume element dx*dy*dz for performing the integration.

If aCubeSize has a value less than or equal to zero, the size of the cube is chosen to be 0.01 times the size of the smallest dimension of the body. That is, aCubeSize = 0.01*(upper[i]-lower[i]), i=0,1, or 2, whichever is smallest.

Parameters:
aCubeSize Length of the side of the cube used to integrate over the volume of the body.

void rdGBody::getCenterOfMass double  rCOM[3]  )  const
 

Get the center of mass of this body.

Parameters:
rCOM Center of mass.

double rdGBody::getDensity  )  const
 

Get the density of this body.

Returns:
Density.

void rdGBody::getInertiaTensor double  rI[9]  )  const
 

Get the inertia tensor of this body.

Parameters:
aInertiaTensor Inertia tensor.

double rdGBody::getMass  )  const
 

Get the mass of this body.

Returns:
Mass.

void rdGBody::getOrigin double  rP[3]  )  const
 

Get the origin of the body.

Parameters:
aOrigin Array into which to put the current origin.

bool rdGBody::isInside const double  aPoint[3]  )  const
 

Determine whether or not a point is inside this body.

This method assumes that this body is a closed volume. If this body is not closed, the returned result may not be meaningful.

Parameters:
aPoint Point to be examined.
Returns:
True if point is inside. False if point is not inside.

void rdGBody::printBoneFile const char *  aFileName = NULL  ) 
 

Print a SIMM bone file.

Parameters:
aFileName Name of output file.

void rdGBody::rotate int  aXYZ,
double  aRadians,
const double  aP[3]
 

Rotate a the vertices of this body about a point about the X, Y, or Z axis by a specified amount.

Parameters:
aXYZ Specify whether to rotate about the X (aXYZ=0), Y (aXYZ=1), or Z (aXYZ=2) axes. If aXYZ is not 0, 1, or 2, no rotation is performed.
aRadians Amount of rotation in radians.
Point about which to rotate.

void rdGBody::rotate int  aXYZ,
double  aRadians
 

Rotate a the vertices of this body about the X, Y, or Z axis by a specified amount.

Parameters:
aXYZ Specify whether to rotate about the X (aXYZ=0), Y (aXYZ=1), or Z (aXYZ=2) axes. If aXYZ is not 0, 1, or 2, no rotation is performed.
aRadians Amount of rotation in radians.

void rdGBody::setCenterOfMass const double  aCOM[3]  ) 
 

Set the center of mass of this body.

Parameters:
aCOM Center of mass.

void rdGBody::setDensity double  aDensity  ) 
 

Set the density of this body.

Parameters:
aDensity Density.

void rdGBody::setMass double  aMass  ) 
 

Set the mass of this body.

Parameters:
aMass Mass.

void rdGBody::setOrigin double  aX,
double  aY,
double  aZ
 

Set the origin of the body.

Whenever the origin is set, the points _px, _py, and _pz, which are used to set desired directions for the coordinate axes of the body, are also set to the value of the origin

Parameters:
aX New x coordinate.
aY New y coordinate.
aZ New z coordinate.

void rdGBody::setPX double  aX,
double  aY,
double  aZ
 

Set a point along the desired x axis of the body.

Parameters:
aX New x coordinate.
aY New y coordinate.
aZ New z coordinate.

void rdGBody::setPY double  aX,
double  aY,
double  aZ
 

Set a point along the desired y axis of the body.

Parameters:
aX New x coordinate.
aY New y coordinate.
aZ New z coordinate.

void rdGBody::setPZ double  aX,
double  aY,
double  aZ
 

Set a point along the desired z axis of the body.

Parameters:
aX New x coordinate.
aY New y coordinate.
aZ New z coordinate.

void rdGBody::translate double  aX,
double  aY,
double  aZ
 

Translate the vertices of this body by a specified amount.

Parameters:
aX Amount to translate in the X direction.
aY Amount to translate in the Y direction.
aZ Amount to translate in the Z direction.

void rdGBody::updateData  ) 
 

Update the member data of this object based on its XML node.

Member objects (children) are not updated.

void rdGBody::updateNode bool  aDeep = true  )  [virtual]
 

Update the XML node representing this object.

Parameters:
aDeep If true, update the XML node of this object AND the XML nodes of all class members that are rdObjects (child nodes); if false, update only the XML node of this object without updating the XML nodes of its children.

Reimplemented from rdObject.

void rdGBody::updateObject bool  aDeep = true  )  [virtual]
 

Update this object based on its XML node.

Parameters:
aDeep If true, update this object and all its child objects (that is, member variables that are rdObject's); if false, update only the member variables that are not rdObject's.

Reimplemented from rdObject.


The documentation for this class was generated from the following files:
Generated on Wed Aug 20 02:17:10 2003 for Simulation Software by doxygen1.3