Cyclone Cyclone: cyclone::Matrix4 Class Reference

cyclone::Matrix4 Class Reference

Holds a transform matrix, consisting of a rotation matrix and a position. More...

#include <core.h>

List of all members.

Public Member Functions

 Matrix4 ()
 Creates an identity matrix.
void setDiagonal (real a, real b, real c)
 Sets the matrix to be a diagonal matrix with the given coefficients.
Matrix4 operator * (const Matrix4 &o) const
 Returns a matrix which is this matrix multiplied by the given other matrix.Matrix4MatrixMultiply.
Vector3 operator * (const Vector3 &vector) const
 Transform the given vector by this matrix.Matrix4VectorMultiply.
Vector3 transform (const Vector3 &vector) const
 Transform the given vector by this matrix.
real getDeterminant () const
 Returns the determinant of the matrix.
void setInverse (const Matrix4 &m)
 Sets the matrix to be the inverse of the given matrix.
Matrix4 inverse () const
 Returns a new matrix containing the inverse of this matrix.
void invert ()
 Inverts the matrix.Matrix4Inverse.
Vector3 transformDirection (const Vector3 &vector) const
 Transform the given direction vector by this matrix.
Vector3 transformInverseDirection (const Vector3 &vector) const
 Transform the given direction vector by the transformational inverse of this matrix.TransformDirection.
Vector3 transformInverse (const Vector3 &vector) const
 Transform the given vector by the transformational inverse of this matrix.TransformInverse.
Vector3 getAxisVector (int i) const
 Gets a vector representing one axis (i.e.
void setOrientationAndPos (const Quaternion &q, const Vector3 &pos)
 Sets this matrix to be the rotation matrix corresponding to the given quaternion.OrientationAndPosToMatrix4.
void fillGLArray (float array[16]) const
 Fills the given array with this transform matrix, so it is usable as an open-gl transform matrix.

Public Attributes

real data [12]
 Holds the transform matrix data in array form.Matrix4Intro.


Detailed Description

Holds a transform matrix, consisting of a rotation matrix and a position.

The matrix has 12 elements, it is assumed that the remaining four are (0,0,0,1); producing a homogenous matrix.


Constructor & Destructor Documentation

cyclone::Matrix4::Matrix4  )  [inline]
 

Creates an identity matrix.


Member Function Documentation

void cyclone::Matrix4::fillGLArray float  array[16]  )  const [inline]
 

Fills the given array with this transform matrix, so it is usable as an open-gl transform matrix.

OpenGL uses a column major format, so that the values are transposed as they are written.

Vector3 cyclone::Matrix4::getAxisVector int  i  )  const [inline]
 

Gets a vector representing one axis (i.e.

one column) in the matrix.

Parameters:
i The row to return. Row 3 corresponds to the position of the transform matrix.
Returns:
The vector.

real cyclone::Matrix4::getDeterminant  )  const
 

Returns the determinant of the matrix.

Matrix4 cyclone::Matrix4::inverse  )  const [inline]
 

Returns a new matrix containing the inverse of this matrix.

void cyclone::Matrix4::invert  )  [inline]
 

Inverts the matrix.Matrix4Inverse.

Vector3 cyclone::Matrix4::operator * const Vector3 vector  )  const [inline]
 

Transform the given vector by this matrix.Matrix4VectorMultiply.

Parameters:
vector The vector to transform.

Matrix4 cyclone::Matrix4::operator * const Matrix4 o  )  const [inline]
 

Returns a matrix which is this matrix multiplied by the given other matrix.Matrix4MatrixMultiply.

void cyclone::Matrix4::setDiagonal real  a,
real  b,
real  c
[inline]
 

Sets the matrix to be a diagonal matrix with the given coefficients.

void cyclone::Matrix4::setInverse const Matrix4 m  ) 
 

Sets the matrix to be the inverse of the given matrix.

Parameters:
m The matrix to invert and use to set this.

void cyclone::Matrix4::setOrientationAndPos const Quaternion q,
const Vector3 pos
[inline]
 

Sets this matrix to be the rotation matrix corresponding to the given quaternion.OrientationAndPosToMatrix4.

Vector3 cyclone::Matrix4::transform const Vector3 vector  )  const [inline]
 

Transform the given vector by this matrix.

Parameters:
vector The vector to transform.

Vector3 cyclone::Matrix4::transformDirection const Vector3 vector  )  const [inline]
 

Transform the given direction vector by this matrix.

/<TransformDirection

Note:
When a direction is converted between frames of reference, there is no translation required.
Parameters:
vector The vector to transform. />TransformDirection

Vector3 cyclone::Matrix4::transformInverse const Vector3 vector  )  const [inline]
 

Transform the given vector by the transformational inverse of this matrix.TransformInverse.

/<TransformInverse

Note:
This function relies on the fact that the inverse of a pure rotation matrix is its transpose. It separates the translational and rotation components, transposes the rotation, and multiplies out. If the matrix is not a scale and shear free transform matrix, then this function will not give correct results.
Parameters:
vector The vector to transform. />TransformInverse

Vector3 cyclone::Matrix4::transformInverseDirection const Vector3 vector  )  const [inline]
 

Transform the given direction vector by the transformational inverse of this matrix.TransformDirection.

/<TransformDirection

Note:
This function relies on the fact that the inverse of a pure rotation matrix is its transpose. It separates the translational and rotation components, transposes the rotation, and multiplies out. If the matrix is not a scale and shear free transform matrix, then this function will not give correct results.

When a direction is converted between frames of reference, there is no translation required.

Parameters:
vector The vector to transform. />TransformDirection


Member Data Documentation

real cyclone::Matrix4::data[12]
 

Holds the transform matrix data in array form.Matrix4Intro.


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