Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
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. More...
MatrixF & | set (const EulerF &e, const Point3F &p)
| Initialize matrix to rotate about p by e. More...
MatrixF & | setCrossProduct (const Point3F &p)
| Initialize matrix with a cross product of p. More...
MatrixF & | setTensorProduct (const Point3F &p, const Point3F &q)
| Initialize matrix with a tensor product of p. More...
| operator F32 * ()
| Allow people to get at m. More...
| operator F32 * () const
| Allow people to get at m. More...
bool | isAffine () const
| Check to see if this is an affine matrix. More...
bool | isIdentity () const
| Checks for identity matrix. More...
MatrixF & | identity ()
| Make this an identity matrix. More...
MatrixF & | inverse ()
| Invert m. More...
MatrixF & | affineInverse ()
MatrixF & | transpose ()
| Swap rows and columns. More...
MatrixF & | scale (const Point3F &p)
| M * Matrix(p) -> M. More...
EulerF | toEuler () const
bool | fullInverse ()
void | transposeTo (F32 *matrix) const
| Swaps rows and columns into matrix. More...
void | normalize ()
| Normalize the matrix. More...
void | getColumn (S32 col, Point4F *cptr) const
| Copy the requested column into a Point4F. More...
void | getColumn (S32 col, Point3F *cptr) const
void | setColumn (S32 col, const Point4F &cptr)
| Set the specified column from a Point4F. More...
void | setColumn (S32 col, const Point3F &cptr)
void | getRow (S32 row, Point4F *cptr) const
| Copy the specified row into a Point4F. More...
void | getRow (S32 row, Point3F *cptr) const
void | setRow (S32 row, const Point4F &cptr)
| Set the specified row from a Point4F. More...
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. More...
MatrixF & | mul (const MatrixF &a, const MatrixF &b)
| a * b -> M More...
MatrixF & | mul (const F32 a)
| M * a -> M. More...
MatrixF & | mul (const MatrixF &a, const F32 b)
| a * b -> M More...
void | mul (Point4F &p) const
| M * p -> p (full [4x4] * [1x4]) More...
void | mulP (Point3F &p) const
| M * p -> p (assume w = 1.0f) More...
void | mulP (const Point3F &p, Point3F *d) const
| M * p -> d (assume w = 1.0f) More...
void | mulV (VectorF &p) const
| M * v -> v (assume w = 0.0f) More...
void | mulV (const VectorF &p, Point3F *d) const
| M * v -> d (assume w = 0.0f) More...
void | mul (Box3F &b) const
| Axial box -> Axial Box. More...
F32 & | operator() (S32 row, S32 col)
| Convenience function to allow people to treat this like an array. More...
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 | ( | bool | identity = `false` | ) |
| inline explicit

Create an uninitialized matrix.

Parameters

  identity | If true, initialize to the identity matrix.

MatrixF | ( | const EulerF & | e | ) |
| inline explicit

Create a matrix to rotate about origin by e.

See also
  set

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

Create a matrix to rotate about p by e.

See also
  set

## Member Function Documentation

MatrixF & affineInverse | ( |  | ) |
| inline

Take inverse without disturbing position data.

Ie, take inverse of 3x3 submatrix.

void dumpMatrix | ( | const char * | caption = `NULL` | ) | const

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.

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

Copy the requested column into a Point4F.

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

Copy the requested column into a Point3F.

This drops the bottom-most row.

Point3F getPosition | ( |  | ) | const
| inline

Get the position of the matrix.

This is the 4th column of the matrix.

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

Copy the specified row into a Point4F.

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

Copy the specified row into a Point3F.

Right-most item is dropped.

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.

MatrixF & identity | ( |  | ) |
| inline

Make this an identity matrix.

static U32 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 & inverse | ( |  | ) |
| inline

Invert m.

bool isAffine | ( |  | ) | const

Check to see if this is an affine matrix.

bool isIdentity | ( |  | ) | const
| inline

Checks for identity matrix.

MatrixF & mul | ( | const MatrixF & | a | ) |
| inline

M * a -> M.

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

a * b -> M

MatrixF & mul | ( | const F32 | a | ) |
| inline

M * a -> M.

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

a * b -> M

void mul | ( | Point4F & | p | ) | const
| inline

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

void mul | ( | Box3F & | b | ) | const
| inline

Axial box -> Axial Box.

void mulP | ( | Point3F & | p | ) | const
| inline

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

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

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

void mulV | ( | VectorF & | p | ) | const
| inline

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

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

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

void normalize | ( |  | ) |
| inline

Normalize the matrix.

operator F32 * | ( |  | ) |
| inline

Allow people to get at m.

operator F32 * | ( |  | ) | const
| inline

Allow people to get at m.

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

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

MatrixF & scale | ( | const Point3F & | p | ) |
| inline

M * Matrix(p) -> M.

MatrixF & set | ( | const EulerF & | e | ) |
| inline

Initialize matrix to rotate about origin by e.

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

Initialize matrix to rotate about p by e.

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

Set the specified column from a Point4F.

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

Set the specified column from a Point3F.

The bottom-most row is not set.

MatrixF & setCrossProduct | ( | const Point3F & | p | ) |
| inline

Initialize matrix with a cross product of p.

void setPosition | ( | const Point3F & | pos | ) |
| inline

Set the position of the matrix.

This is the 4th column of the matrix.

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

Set the specified row from a Point4F.

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

Set the specified row from a Point3F.

The right-most item is not set.

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

Initialize matrix with a tensor product of p.

EulerF toEuler | ( |  | ) | const

MatrixF & transpose | ( |  | ) |
| inline

Swap rows and columns.

void transposeTo | ( | F32 * | matrix | ) | const

Swaps rows and columns into matrix.

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

- math/mMatrix.h
- math/mMatrix.cc