Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
Menge::SceneGraph::XformMatrix Class Reference

The transformation matrix. More...

#include <XformMatrix.h>

Public Member Functions

 XformMatrix ()
 Default constructor - identity matrix.
 
void setTranslation (const Vector3 &vec)
 Set the translation of this node. More...
 
void addTranslation (const Vector3 &vec)
 Offset the translation of this node. More...
 
void setScale (const Vector3 &vec)
 Set the scale of this node. More...
 
void setRotationDeg (const Vector3 &vec)
 Set the orientation of this node. More...
 
void setRotationRad (const Vector3 &vec)
 Set the orientation of this node. More...
 
void addRotationDeg (const Vector3 &vec)
 Offsets the orientation of this node. More...
 
void addRotationRad (const Vector3 &vec)
 Offsets the orientation of this node. More...
 
void setRotAxisDeg (const Vector3 &vec)
 Set the orientation of this node's rotation axis. More...
 
void setRotAxisRad (const Vector3 &vec)
 Set the orientation of this node's rotation axis. More...
 
void translationMatrix (Matrix4x4 &mat)
 Comptues the rotation p. More...
 
void translationInverseMatrix (Matrix4x4 &mat)
 Computes the translation inverse matrix. More...
 
void scaleMatrix (Matrix4x4 &mat)
 Computes the scale matrix. More...
 
void scaleInverseMatrix (Matrix4x4 &mat)
 Computes the inverse scale matrix. More...
 
void rotationMatrix (Matrix4x4 &mat)
 Computes the rotation matrix. More...
 
void rotationInverseMatrix (Matrix4x4 &mat)
 Computes the inverse rotation matrix. More...
 
void getMatrix (Matrix4x4 &mat)
 Computes the transformation matrix. More...
 
void getInverseMatrix (Matrix4x4 &mat)
 Computes the inverse transformation matrix. More...
 

Protected Types

enum  MatrixBit { ROT_MAT = 1, MAT = 2, IMAT = 4 }
 Enumeration of dirty matrices. More...
 

Protected Member Functions

void updateRotAxisMat ()
 Update cached rotation axis matrices when component changes.
 
void setDirty ()
 Set all matrices dirty.
 
void setDirty (int bit)
 Set the matrix corresponding to the given bit dirty. More...
 
void setDirty (MatrixBit bit)
 Set the matrix corresponding to the given bit dirty. More...
 
bool isClean (MatrixBit bit)
 Reports if the indicated matrix is clean. More...
 
void setClean (MatrixBit bit)
 Sets the indicated matrix to be clean. More...
 
void setClean (int bit)
 Sets the indicated matrix to be clean. More...
 

Protected Attributes

Vector3 _trans
 The translation component of the transformation.
 
Vector3 _scale
 The scale component of the transformation.
 
Vector3 _rot
 The rotation component of the transformation. Euler angles in radians.
 
Vector3 _rotAxis
 The rotation axis component of the transformation. Pre-rotation Euler angles in radians.
 
Matrix4x4 _rotAxisMat
 Cached rotation axis matrix.
 
Matrix4x4 _rotAxisIMat
 Cached inverse rotation axis matrix.
 
int _clean
 An integer mask for determining which cached matrices are clean/dirty. More...
 
Matrix4x4 _rotMat
 Cached rotation matrix.
 
Matrix4x4 _mat
 Cached transformation matrix.
 
Matrix4x4 _iMat
 Cached inverse transformation matrix.
 

Friends

class Transform
 
Loggeroperator<< (Logger &out, const XformMatrix &xformMat)
 Print the matrix to the output stream. More...
 

Detailed Description

The transformation matrix.

The transform matrix is the concatenation of five transformation matrices SCALE * ROT_AXIS^-1 * ROTATE * ROT_AXIS * TRANSLATE The scale, rotation, and translation matrices are self-explanatory. They account for the changes in size, rotation around the orign, and re-positioning of the node. The transform also defines a "rotation axis". The rotation values can be defined around an arbitrary axis, rather than the node's local space. One can think of the rotation axis as a pre-rotation.

Member Enumeration Documentation

Enumeration of dirty matrices.

Used to intelligently compute matrices as necessary.

Member Function Documentation

void Menge::SceneGraph::XformMatrix::addRotationDeg ( const Vector3 vec)
inline

Offsets the orientation of this node.

Rotation is performed using Euler angles and the implict evaluation order of x-, then y-, and finally z-axis rotation. In this case, each axis is summed independently. Generally, because these are Euler angles, this will will not lead to linear interpolation of orientation.

Parameters
vecThe rotations around the x-, y-, and z-axes, respectively in degrees.
void Menge::SceneGraph::XformMatrix::addRotationRad ( const Vector3 vec)
inline

Offsets the orientation of this node.

Rotation is performed using Euler angles and the implict evaluation order of x-, then y-, and finally z-axis rotation. In this case, each axis is summed independently. Generally, because these are Euler angles, this will will not lead to linear interpolation of orientation.

Parameters
vecThe rotations around the x-, y-, and z-axes, respectively in radians.
void Menge::SceneGraph::XformMatrix::addTranslation ( const Vector3 vec)
inline

Offset the translation of this node.

Parameters
vecThe change to position of this node.
void Menge::SceneGraph::XformMatrix::getInverseMatrix ( Matrix4x4 mat)

Computes the inverse transformation matrix.

Parameters
matWrites the inverse matrix in the provided matrix.
void Menge::SceneGraph::XformMatrix::getMatrix ( Matrix4x4 mat)

Computes the transformation matrix.

Parameters
matWrites the matrix in the provided matrix.
bool Menge::SceneGraph::XformMatrix::isClean ( MatrixBit  bit)
inlineprotected

Reports if the indicated matrix is clean.

Parameters
bitThe bit for the specific matrix to set dirty.
Returns
True if the matrix does NOT need recomputation, false otherwise.
void Menge::SceneGraph::XformMatrix::rotationInverseMatrix ( Matrix4x4 mat)

Computes the inverse rotation matrix.

Parameters
matWrites the inverse rotation matrix in the provided matrix.
void Menge::SceneGraph::XformMatrix::rotationMatrix ( Matrix4x4 mat)

Computes the rotation matrix.

Parameters
matWrites the rotation matrix in the provided matrix.
void Menge::SceneGraph::XformMatrix::scaleInverseMatrix ( Matrix4x4 mat)

Computes the inverse scale matrix.

Parameters
matWrites the inverse scale matrix in the provided matrix.
void Menge::SceneGraph::XformMatrix::scaleMatrix ( Matrix4x4 mat)

Computes the scale matrix.

Parameters
matWrites the scale matrix in the provided matrix.
void Menge::SceneGraph::XformMatrix::setClean ( MatrixBit  bit)
inlineprotected

Sets the indicated matrix to be clean.

Parameters
bitThe bit for the specific matrix to set clean.
void Menge::SceneGraph::XformMatrix::setClean ( int  bit)
inlineprotected

Sets the indicated matrix to be clean.

Parameters
bitThe bit for the specific matrix to set clean. Should be a MatrixBit enumeration value.
void Menge::SceneGraph::XformMatrix::setDirty ( int  bit)
inlineprotected

Set the matrix corresponding to the given bit dirty.

Parameters
bitThe bit for the specific matrix to set dirty. Should be a MatrixBit enumeration value.
void Menge::SceneGraph::XformMatrix::setDirty ( MatrixBit  bit)
inlineprotected

Set the matrix corresponding to the given bit dirty.

Parameters
bitThe bit for the specific matrix to set dirty.
void Menge::SceneGraph::XformMatrix::setRotationDeg ( const Vector3 vec)
inline

Set the orientation of this node.

Rotation is performed using Euler angles and the implict evaluation order of x-, then y-, and finally z-axis rotation.

Parameters
vecThe rotations around the x-, y-, and z-axes, respectively in degrees.
void Menge::SceneGraph::XformMatrix::setRotationRad ( const Vector3 vec)
inline

Set the orientation of this node.

Rotation is performed using Euler angles and the implict evaluation order of x-, then y-, and finally z-axis rotation.

Parameters
vecThe rotations around the x-, y-, and z-axes, respectively in radians.
void Menge::SceneGraph::XformMatrix::setRotAxisDeg ( const Vector3 vec)

Set the orientation of this node's rotation axis.

Rotation is performed using Euler angles and the implict evaluation order of x-, then y-, and finally z-axis rotation.

Parameters
vecThe orientation of the rotation axis around the x-, y-, and z-axes, respectively in degrees.
void Menge::SceneGraph::XformMatrix::setRotAxisRad ( const Vector3 vec)

Set the orientation of this node's rotation axis.

Rotation is performed using Euler angles and the implict evaluation order of x-, then y-, and finally z-axis rotation.

Parameters
vecThe orientation of the rotation axis around the x-, y-, and z-axes, respectively in radians.
void Menge::SceneGraph::XformMatrix::setScale ( const Vector3 vec)
inline

Set the scale of this node.

Parameters
vecThe desired scale of this node.
void Menge::SceneGraph::XformMatrix::setTranslation ( const Vector3 vec)
inline

Set the translation of this node.

Parameters
vecThe 3D position of the transform.
void Menge::SceneGraph::XformMatrix::translationInverseMatrix ( Matrix4x4 mat)

Computes the translation inverse matrix.

Parameters
matWrites the inverse translation matrix in the provided matrix.
void Menge::SceneGraph::XformMatrix::translationMatrix ( Matrix4x4 mat)

Comptues the rotation p.

Computes the translation matrix.

Parameters
matWrites the translation matrix in the provided matrix.

Friends And Related Function Documentation

Logger& operator<< ( Logger out,
const XformMatrix xformMat 
)
friend

Print the matrix to the output stream.

Parameters
outThe output stream.
xformMatThe transformation matrix to print to the output stream.

Member Data Documentation

int Menge::SceneGraph::XformMatrix::_clean
protected

An integer mask for determining which cached matrices are clean/dirty.

Works with the MatrixBit enumeration to determine which matrices need to be recomputed.


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