Torque2D Reference
Loading...
Searching...
No Matches
MatrixF Class Reference

#include <mMatrix.h>

Public Member Functions

 MatrixF (bool identity=false)
 MatrixF (const EulerF &e)
 MatrixF (const EulerF &e, const Point3F &p)
MatrixF & set (const EulerF &e)
 Initialize matrix to rotate about origin by e.
MatrixF & set (const EulerF &e, const Point3F &p)
 Initialize matrix to rotate about p by e.
MatrixF & setCrossProduct (const Point3F &p)
 Initialize matrix with a cross product of p.
MatrixF & setTensorProduct (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.
MatrixF & identity ()
 Make this an identity matrix.
MatrixF & inverse ()
 Invert m.
MatrixF & affineInverse ()
MatrixF & transpose ()
 Swap rows and columns.
MatrixF & scale (const Point3F &p)
 M * Matrix(p) -> M.
EulerF toEuler () const
bool fullInverse ()
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.
void getColumn (S32 col, Point3F *cptr) const
void setColumn (S32 col, const Point4F &cptr)
 Set the specified column from a Point4F.
void setColumn (S32 col, const Point3F &cptr)
void getRow (S32 row, Point4F *cptr) const
 Copy the specified row into a Point4F.
void getRow (S32 row, Point3F *cptr) const
void setRow (S32 row, const Point4F &cptr)
 Set the specified row from a Point4F.
void setRow (S32 row, const Point3F &cptr)
Point3F getPosition () const
void setPosition (const Point3F &pos)
VectorF getUpVector () const
MatrixF & mul (const MatrixF &a)
 M * a -> M.
MatrixF & mul (const MatrixF &a, const MatrixF &b)
 a * b -> M
MatrixF & mul (const F32 a)
 M * a -> M.
MatrixF & mul (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.
F32 & operator() (S32 row, S32 col)
 Convenience function to allow people to treat this like an array.
void dumpMatrix (const char *caption=NULL) const

Static Public Member Functions

static U32 idx (U32 i, U32 j)

Detailed Description

4x4 Matrix Class

This runs at F32 precision.

Constructor & Destructor Documentation

◆ MatrixF() [1/3]

MatrixF ( bool identity = false)
inlineexplicit

Create an uninitialized matrix.

Parameters
identityIf true, initialize to the identity matrix.

◆ MatrixF() [2/3]

MatrixF ( const EulerF & e)
inlineexplicit

Create a matrix to rotate about origin by e.

See also
set

◆ MatrixF() [3/3]

MatrixF ( const EulerF & e,
const Point3F & p )
inline

Create a matrix to rotate about p by e.

See also
set

Member Function Documentation

◆ affineInverse()

MatrixF & affineInverse ( )
inline

Take inverse without disturbing position data.

Ie, take inverse of 3x3 submatrix.

◆ dumpMatrix()

void dumpMatrix ( const char * caption = NULL) const

◆ fullInverse()

bool 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.

◆ getColumn() [1/2]

void getColumn ( S32 col,
Point3F * cptr ) const
inline

Copy the requested column into a Point3F.

This drops the bottom-most row.

◆ getColumn() [2/2]

void getColumn ( S32 col,
Point4F * cptr ) const
inline

Copy the requested column into a Point4F.

◆ getPosition()

Point3F getPosition ( ) const
inline

Get the position of the matrix.

This is the 4th column of the matrix.

◆ getRow() [1/2]

void getRow ( S32 row,
Point3F * cptr ) const
inline

Copy the specified row into a Point3F.

Right-most item is dropped.

◆ getRow() [2/2]

void getRow ( S32 row,
Point4F * cptr ) const
inline

Copy the specified row into a Point4F.

◆ getUpVector()

VectorF getUpVector ( ) const
inline

Get the z axis of the matrix.

This is the 3rd column of the matrix and is normally considered the up vector.

◆ identity()

MatrixF & identity ( )
inline

Make this an identity matrix.

◆ idx()

U32 idx ( U32 i,
U32 j )
inlinestatic

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
iColumn desired.
jRow desired.

◆ inverse()

MatrixF & inverse ( )
inline

Invert m.

◆ isAffine()

bool isAffine ( ) const

Check to see if this is an affine matrix.

◆ isIdentity()

bool isIdentity ( ) const
inline

Checks for identity matrix.

◆ mul() [1/6]

void mul ( Box3F & b) const
inline

Axial box -> Axial Box.

◆ mul() [2/6]

MatrixF & mul ( const F32 a)
inline

M * a -> M.

◆ mul() [3/6]

MatrixF & mul ( const MatrixF & a)
inline

M * a -> M.

◆ mul() [4/6]

MatrixF & mul ( const MatrixF & a,
const F32 b )
inline

a * b -> M

◆ mul() [5/6]

MatrixF & mul ( const MatrixF & a,
const MatrixF & b )
inline

a * b -> M

◆ mul() [6/6]

void mul ( Point4F & p) const
inline

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

◆ mulP() [1/2]

void mulP ( const Point3F & p,
Point3F * d ) const
inline

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

◆ mulP() [2/2]

void mulP ( Point3F & p) const
inline

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

◆ mulV() [1/2]

void mulV ( const VectorF & p,
Point3F * d ) const
inline

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

◆ mulV() [2/2]

void mulV ( VectorF & p) const
inline

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

◆ normalize()

void normalize ( )
inline

Normalize the matrix.

◆ operator F32 *() [1/2]

operator F32 * ( )
inline

Allow people to get at m.

◆ operator F32 *() [2/2]

operator F32 * ( ) const
inline

Allow people to get at m.

◆ operator()()

F32 & operator() ( S32 row,
S32 col )
inline

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

◆ scale()

MatrixF & scale ( const Point3F & p)
inline

M * Matrix(p) -> M.

◆ set() [1/2]

MatrixF & set ( const EulerF & e)
inline

Initialize matrix to rotate about origin by e.

◆ set() [2/2]

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

Initialize matrix to rotate about p by e.

◆ setColumn() [1/2]

void setColumn ( S32 col,
const Point3F & cptr )
inline

Set the specified column from a Point3F.

The bottom-most row is not set.

◆ setColumn() [2/2]

void setColumn ( S32 col,
const Point4F & cptr )
inline

Set the specified column from a Point4F.

◆ setCrossProduct()

MatrixF & setCrossProduct ( const Point3F & p)
inline

Initialize matrix with a cross product of p.

◆ setPosition()

void setPosition ( const Point3F & pos)
inline

Set the position of the matrix.

This is the 4th column of the matrix.

◆ setRow() [1/2]

void setRow ( S32 row,
const Point3F & cptr )
inline

Set the specified row from a Point3F.

The right-most item is not set.

◆ setRow() [2/2]

void setRow ( S32 row,
const Point4F & cptr )
inline

Set the specified row from a Point4F.

◆ setTensorProduct()

MatrixF & setTensorProduct ( const Point3F & p,
const Point3F & q )
inline

Initialize matrix with a tensor product of p.

◆ toEuler()

EulerF toEuler ( ) const

◆ transpose()

MatrixF & transpose ( )
inline

Swap rows and columns.

◆ transposeTo()

void transposeTo ( F32 * matrix) const

Swaps rows and columns into matrix.


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