MatrixF Class Reference

#include <mMatrix.h>

List of all members.


Detailed Description

4x4 Matrix Class

This runs at F32 precision.


Public Member Functions

 MatrixF (bool identity=false)
 Create an uninitialized matrix.
 MatrixF (const EulerF &e)
 Create a matrix to rotate about origin by e.
 MatrixF (const EulerF &e, const Point3F &p)
 Create a matrix to rotate about p by e.
MatrixFset (const EulerF &e)
 Initialize matrix to rotate about origin by e.
MatrixFset (const EulerF &e, const Point3F &p)
 Initialize matrix to rotate about p by e.
MatrixFsetCrossProduct (const Point3F &p)
 Initialize matrix with a cross product of p.
MatrixFsetTensorProduct (const Point3F &p, const Point3F &q)
 Initialize matrix with a tensor product of p.
 operator F32 * ()
 Allow people to get at m.
 operator F32 * () const
 Allow people to get at m.
bool isAffine () const
 Check to see if this is an affine matrix.
bool isIdentity () const
 Checks for identity matrix.
MatrixFidentity ()
 Make this an identity matrix.
MatrixFinverse ()
 Invert m.
MatrixFaffineInverse ()
 Take inverse of matrix assuming it is affine (rotation, scale, sheer, translation only).
MatrixFtranspose ()
 Swap rows and columns.
MatrixFscale (const Point3F &p)
 M * Matrix(p) -> M.
Point3F getScale () const
 Return scale assuming scale was applied via mat.scale(s).
EulerF toEuler () const
bool fullInverse ()
 Compute the inverse of the matrix.
void transposeTo (F32 *matrix) const
 Swaps rows and columns into matrix.
void normalize ()
 Normalize the matrix.
void getColumn (S32 col, Point4F *cptr) const
 Copy the requested column into a Point4F.
Point4F getColumn4F (S32 col) const
void getColumn (S32 col, Point3F *cptr) const
 Copy the requested column into a Point3F.
Point3F getColumn3F (S32 col) const
void setColumn (S32 col, const Point4F &cptr)
 Set the specified column from a Point4F.
void setColumn (S32 col, const Point3F &cptr)
 Set the specified column from a Point3F.
void getRow (S32 row, Point4F *cptr) const
 Copy the specified row into a Point4F.
Point4F getRow4F (S32 row) const
void getRow (S32 row, Point3F *cptr) const
 Copy the specified row into a Point3F.
Point3F getRow3F (S32 row) const
void setRow (S32 row, const Point4F &cptr)
 Set the specified row from a Point4F.
void setRow (S32 row, const Point3F &cptr)
 Set the specified row from a Point3F.
Point3F getPosition () const
 Get the position of the matrix.
void setPosition (const Point3F &pos)
 Set the position of the matrix.
MatrixFmul (const MatrixF &a)
 M * a -> M.
MatrixFmul (const MatrixF &a, const MatrixF &b)
 a * b -> M
MatrixFmul (const F32 a)
 M * a -> M.
MatrixFmul (const MatrixF &a, const F32 b)
 a * b -> M
void mul (Point4F &p) const
 M * p -> p (full [4x4] * [1x4]).
void mulP (Point3F &p) const
 M * p -> p (assume w = 1.0f).
void mulP (const Point3F &p, Point3F *d) const
 M * p -> d (assume w = 1.0f).
void mulV (VectorF &p) const
 M * v -> v (assume w = 0.0f).
void mulV (const VectorF &p, Point3F *d) const
 M * v -> d (assume w = 0.0f).
void mul (Box3F &b) const
 Axial box -> Axial Box.
F32operator() (S32 row, S32 col)
 Convenience function to allow people to treat this like an array.
F32 operator() (S32 row, S32 col) const
void dumpMatrix (const char *caption=NULL) const
MatrixFoperator *= (const MatrixF &m)

Static Public Member Functions

static U32 idx (U32 i, U32 j)
 Get the index in m to element in column i, row j.

Static Public Attributes

static const MatrixF Identity

Private Attributes

F32 m [16]
 Note: Torque uses column major matrices.

Friends

MatrixF operator * (const MatrixF &m1, const MatrixF &m2)


Constructor & Destructor Documentation

MatrixF::MatrixF ( bool  identity = false  )  [inline, explicit]

Create an uninitialized matrix.

Parameters:
identity If true, initialize to the identity matrix.

MatrixF::MatrixF ( const EulerF e  )  [inline, explicit]

Create a matrix to rotate about origin by e.

See also:
set

MatrixF::MatrixF ( const EulerF e,
const Point3F p 
) [inline]

Create a matrix to rotate about p by e.

See also:
set


Member Function Documentation

static U32 MatrixF::idx ( U32  i,
U32  j 
) [inline, static]

Get the index in m to element in column i, row j.

This is necessary as we have m as a one dimensional array.

Parameters:
i Column desired.
j Row desired.

MatrixF & MatrixF::set ( const EulerF e  )  [inline]

Initialize matrix to rotate about origin by e.

MatrixF & MatrixF::set ( const EulerF e,
const Point3F p 
) [inline]

Initialize matrix to rotate about p by e.

MatrixF & MatrixF::setCrossProduct ( const Point3F p  )  [inline]

Initialize matrix with a cross product of p.

MatrixF & MatrixF::setTensorProduct ( const Point3F p,
const Point3F q 
) [inline]

Initialize matrix with a tensor product of p.

MatrixF::operator F32 * (  )  [inline]

Allow people to get at m.

MatrixF::operator F32 * (  )  const [inline]

Allow people to get at m.

bool MatrixF::isAffine (  )  const

Check to see if this is an affine matrix.

bool MatrixF::isIdentity (  )  const [inline]

Checks for identity matrix.

MatrixF & MatrixF::identity (  )  [inline]

Make this an identity matrix.

MatrixF & MatrixF::inverse (  )  [inline]

Invert m.

MatrixF & MatrixF::affineInverse (  )  [inline]

Take inverse of matrix assuming it is affine (rotation, scale, sheer, translation only).

MatrixF & MatrixF::transpose (  )  [inline]

Swap rows and columns.

MatrixF & MatrixF::scale ( const Point3F p  )  [inline]

M * Matrix(p) -> M.

Point3F MatrixF::getScale (  )  const [inline]

Return scale assuming scale was applied via mat.scale(s).

EulerF MatrixF::toEuler (  )  const

bool MatrixF::fullInverse (  ) 

Compute the inverse of the matrix.

Computes inverse of full 4x4 matrix. Returns false and performs no inverse if the determinant is 0.

Note: In most cases you want to use the normal inverse function. This method should be used if the matrix has something other than (0,0,0,1) in the bottom row.

void MatrixF::transposeTo ( F32 matrix  )  const

Swaps rows and columns into matrix.

void MatrixF::normalize (  )  [inline]

Normalize the matrix.

void MatrixF::getColumn ( S32  col,
Point4F cptr 
) const [inline]

Copy the requested column into a Point4F.

Point4F MatrixF::getColumn4F ( S32  col  )  const [inline]

void MatrixF::getColumn ( S32  col,
Point3F cptr 
) const [inline]

Copy the requested column into a Point3F.

This drops the bottom-most row.

Point3F MatrixF::getColumn3F ( S32  col  )  const [inline]

void MatrixF::setColumn ( S32  col,
const Point4F cptr 
) [inline]

Set the specified column from a Point4F.

void MatrixF::setColumn ( S32  col,
const Point3F cptr 
) [inline]

Set the specified column from a Point3F.

The bottom-most row is not set.

void MatrixF::getRow ( S32  row,
Point4F cptr 
) const [inline]

Copy the specified row into a Point4F.

Point4F MatrixF::getRow4F ( S32  row  )  const [inline]

void MatrixF::getRow ( S32  row,
Point3F cptr 
) const [inline]

Copy the specified row into a Point3F.

Right-most item is dropped.

Point3F MatrixF::getRow3F ( S32  row  )  const [inline]

void MatrixF::setRow ( S32  row,
const Point4F cptr 
) [inline]

Set the specified row from a Point4F.

void MatrixF::setRow ( S32  row,
const Point3F cptr 
) [inline]

Set the specified row from a Point3F.

The right-most item is not set.

Point3F MatrixF::getPosition (  )  const [inline]

Get the position of the matrix.

This is the 4th column of the matrix.

void MatrixF::setPosition ( const Point3F pos  )  [inline]

Set the position of the matrix.

This is the 4th column of the matrix.

MatrixF & MatrixF::mul ( const MatrixF a  )  [inline]

M * a -> M.

MatrixF & MatrixF::mul ( const MatrixF a,
const MatrixF b 
) [inline]

a * b -> M

MatrixF & MatrixF::mul ( const F32  a  )  [inline]

M * a -> M.

MatrixF & MatrixF::mul ( const MatrixF a,
const F32  b 
) [inline]

a * b -> M

void MatrixF::mul ( Point4F p  )  const [inline]

M * p -> p (full [4x4] * [1x4]).

void MatrixF::mulP ( Point3F p  )  const [inline]

M * p -> p (assume w = 1.0f).

void MatrixF::mulP ( const Point3F p,
Point3F d 
) const [inline]

M * p -> d (assume w = 1.0f).

void MatrixF::mulV ( VectorF p  )  const [inline]

M * v -> v (assume w = 0.0f).

void MatrixF::mulV ( const VectorF p,
Point3F d 
) const [inline]

M * v -> d (assume w = 0.0f).

void MatrixF::mul ( Box3F b  )  const [inline]

Axial box -> Axial Box.

F32& MatrixF::operator() ( S32  row,
S32  col 
) [inline]

Convenience function to allow people to treat this like an array.

F32 MatrixF::operator() ( S32  row,
S32  col 
) const [inline]

void MatrixF::dumpMatrix ( const char *  caption = NULL  )  const

MatrixF & MatrixF::operator *= ( const MatrixF m  )  [inline]


Friends And Related Function Documentation

MatrixF operator * ( const MatrixF m1,
const MatrixF m2 
) [friend]


Member Data Documentation

F32 MatrixF::m[16] [private]

Note: Torque uses column major matrices.

const MatrixF MatrixF::Identity [static]