Physsim::Matrix4 Class Reference

A 4x4 transformation matrix. More...

#include <Matrix4.h>

Inheritance diagram for Physsim::Matrix4:

Physsim::MatrixNN Physsim::MatrixN List of all members.

Public Member Functions

 Matrix4 ()
 Default constructor.
 Matrix4 (const Matrix4 &source)
 Copy constructor.
 Matrix4 (const MatrixNN &source)
 Copy constructor.
 Matrix4 (const MatrixN &source)
 Copy constructor.
 Matrix4 (const boost::shared_array< Real > array)
 Constructs a matrix from an array.
 Matrix4 (const AAngle *a)
 Constructs a 4x4 homogeneous transformation matrix from a axis-angle representation (for rotation) and zero translation.
 Matrix4 (const Matrix3 *m)
 Constructs a 4x4 homogeneous transformation matrix from a rotation matrix and zero translation.
 Matrix4 (const Quat *q)
 Constructs a 4x4 homogeneous transformation matrix from a unit quaternion (for rotation) and zero translation.
 Matrix4 (const AAngle *a, const Vector3 *v)
 Constructs a 4x4 homogeneous transformation matrix from a axis-angle representation and a translation vector.
 Matrix4 (const Matrix3 *m, const Vector3 *v)
 Constructs a 4x4 homogeneous transformation matrix from a rotation matrix and translation vector.
 Matrix4 (const Quat *q, const Vector3 *v)
 Constructs a 4x4 homogeneous transformation matrix from a unit quaternion and translation vector.
 Matrix4 (const Vector3 *v)
 Constructs a 4x4 homogeneous transformation matrix using identity orientation and a translation vector.
 Matrix4 (Real m00, Real m01, Real m02, Real m03, Real m10, Real m11, Real m12, Real m13, Real m20, Real m21, Real m22, Real m23, Real m30, Real m31, Real m32, Real m33)
 Constructs a matrix from 16 values.
bool epsilon_equals (const Matrix4 &m, Real epsilon) const
 Determines whether the transformation matrix represented by this matrix is equal to another (to within numerical tolerance epsilon).
Matrix3 get_rotation () const
 Gets rotation and scaling 3x3 submatrix from a 4x4 homogeneous transform.
void get_rotation (Matrix3 *m) const
 Gets rotation and scaling 3x3 submatrix from a 4x4 homogeneous transform.
Vector3 get_translation () const
 Gets the translation component of a 4x4 homogeneous transform.
void invert_transform ()
 Special method for inverting a 4x4 transformation matrix.
void get_translation (boost::shared_array< Real > array) const
 Gets the translation component of a 4x4 homogeneous transform.
void get_translation (Vector3 &v) const
 Gets the translation component of a 4x4 homogeneous transform.
void get_translation (Real &x, Real &y, Real &z) const
 Gets the translation component of a 4x4 homogeneous transform.
void set (boost::shared_array< const Real > array)
 Sets the matrix using an array of Real values.
void set (const AAngle *a, const Vector3 *v)
void set (const Matrix3 *m, const Vector3 *v)
 Sets the matrix to be a 4x4 homogeneous transform from a rotation matrix and translation vector.
void set (const Quat *q, const Vector3 *v)
 Sets the matrix to be a 4x4 homogeneous transform from a unit quaternion and translation vector.
void set_rotation (const AAngle *a)
 Sets the rotation component of a 4x4 homogeneous transform from the given axis-angle representation.
void set_rotation (const Quat *q)
 Sets the rotation and scaling component of a 4x4 homogeneous transform from the given quaternion.
void set_rotation (const Matrix3 *m)
 Sets the rotation component of a 4x4 homogeneous transform from the given rotation matrix.
void set_translation (Real x, Real y, Real z)
 Sets the translation component of a 4x4 homogeneous transform.
void set_translation (boost::shared_array< Real > array)
 Sets the translation component of a 4x4 homogeneous transform from the given 3-D array.
void set_translation (const Vector3 &v)
 Sets the translation componet of a 4x4 homogeneous transform from the given 3-D vector.
void operator= (const Matrix4 &source)
virtual void operator= (const MatrixN &source)
 Sets this matrix to that of another.
virtual void operator= (const MatrixNN &source)
Matrix4 operator * (const Matrix4 &m) const
Matrix4 operator * (Real scalar) const
 Multiplies this matrix by a scalar.
Matrix4 operator/ (Real scalar) const
Vector3 operator * (const Vector3 &v) const
 Multiplies a 4x4 matrix by a 3D (4D homogeneous) vector.

Static Public Member Functions

static bool epsilon_equals (const Matrix4 &m1, const Matrix4 &m2, Real epsilon)
 Determines whether the transformation matrix represented by two matrices are equal (to within numerical tolerance epsilon).
static Matrix4 interpolate (const Matrix4 &m1, const Matrix4 &m2, Real t)
 Interpolates between two 4x4 transforms using spherical linear interpolation.
static void to_inventor_matrix (const Matrix4 &src, SbMatrix &tgt)
 Copies this matrix to a OpenInventor SbMatrix object.
static void from_inventor_matrix (const SbMatrix &src, Matrix4 &tgt)
 Copies an OpenInventor SbMatrix to a Physsim Matrix4.
static Matrix4 invert_transform (const Matrix4 &m)
 Special method for inverting a 4x4 transformation matrix.
static bool valid_transform (const Matrix4 &m)
 Determines whether the specified transform is valid.

Detailed Description

A 4x4 transformation matrix.

This transformation matrix supports rotation and translation; scaling is not currently supported. The underlying data is stored in a column-major (e.g., the element at row 1, column 0 is element "1") though the transform itself is non-OpenGL style (i.e., translation is in the fourth column).


Constructor & Destructor Documentation

Matrix4::Matrix4 (  ) 

Default constructor.

Sets matrix to the identity matrix

Matrix4::Matrix4 ( const boost::shared_array< Real >  array  ) 

Constructs a matrix from an array.

Parameters:
array an array of 16 Real values in row-major format

Matrix4::Matrix4 ( Real  m00,
Real  m01,
Real  m02,
Real  m03,
Real  m10,
Real  m11,
Real  m12,
Real  m13,
Real  m20,
Real  m21,
Real  m22,
Real  m23,
Real  m30,
Real  m31,
Real  m32,
Real  m33 
)

Constructs a matrix from 16 values.

The resulting matrix will appear as follows:
m00 m01 m02 m03
m10 m11 m12 m13
m20 m21 m22 m23
m30 m31 m32 m33


Member Function Documentation

Matrix4 Matrix4::interpolate ( const Matrix4 T1,
const Matrix4 T2,
Real  t 
) [static]

Interpolates between two 4x4 transforms using spherical linear interpolation.

Parameters:
T1 the matrix to use when t=0
T2 the matrix to use when t=1
t a real value in the interval [0,1]
Returns:
the interpolated transform

void Matrix4::get_translation ( boost::shared_array< Real >  array  )  const

Gets the translation component of a 4x4 homogeneous transform.

Parameters:
array a 3-dimensional (or larger) array

void Matrix4::get_translation ( Real &  x,
Real &  y,
Real &  z 
) const

Gets the translation component of a 4x4 homogeneous transform.

The values for x, y, and z are overwritten with the output.

void Matrix4::set ( boost::shared_array< const Real >  array  ) 

Sets the matrix using an array of Real values.

Parameters:
array an array of 16 Real values in row-major format

void Matrix4::set ( const AAngle a,
const Vector3 v 
)

Todo:
make this marginally faster by setting the matrix components directly (eliminates redundancy in setting non-rotation and non-translational components)

void Matrix4::set ( const Matrix3 m,
const Vector3 v 
)

Sets the matrix to be a 4x4 homogeneous transform from a rotation matrix and translation vector.

Todo:
make this marginally faster by setting the matrix components directly (eliminates redundancy in setting non-rotation and non-translational components)

void Matrix4::set ( const Quat q,
const Vector3 v 
)

Sets the matrix to be a 4x4 homogeneous transform from a unit quaternion and translation vector.

Todo:
make this marginally faster by setting the matrix components directly (eliminates redundancy in setting non-rotation and non-translational components)


The documentation for this class was generated from the following files:
Generated on Wed Oct 24 14:54:23 2007 for Physsim by  doxygen 1.5.1