# MatrixF

Engine/source/math/mMatrix.h

4x4 Matrix Class

More...

## Public Friends

```class
```
```MatrixFEngineExport
```
```MatrixF
```
```operator*
```

## Private Attributes

```F32
```
```m 
```

Note: Torque uses row-major matrices.

## Public Static Attributes

```const MatrixF
```
```Identity
```

## Public Functions

```MatrixF(bool identity)
```

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.

```MatrixF &
```
```add(const MatrixF & m)
```
```MatrixF &
```
```affineInverse()
```

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

```void
```
```displace(const Point3F & delta)
```

Add the passed delta to the matrix position.

```void
```
```dumpMatrix(const char * caption)
```
```bool
```
```fullInverse()
```

Compute the inverse of the matrix.

```void
```
```getColumn(S32 col, Point3F * cptr)
```

Copy the requested column into a Point3F.

```void
```
```getColumn(S32 col, Point4F * cptr)
```

Copy the requested column into a Point4F.

```Point3F
```
```getColumn3F(S32 col)
```
```Point4F
```
```getColumn4F(S32 col)
```
```VectorF
```
```getForwardVector()
```

Get the y axis of the matrix.

```Point3F
```
```getPosition()
```

Get the position of the matrix.

```VectorF
```
```getRightVector()
```

Get the x axis of the matrix.

```void
```
```getRow(S32 row, Point3F * cptr)
```

Copy the specified row into a Point3F.

```void
```
```getRow(S32 row, Point4F * cptr)
```

Copy the specified row into a Point4F.

```Point3F
```
```getRow3F(S32 row)
```
```Point4F
```
```getRow4F(S32 row)
```
```Point3F
```
```getScale()
```

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

```VectorF
```
```getUpVector()
```

Get the z axis of the matrix.

```MatrixF &
```
```identity()
```

Make this an identity matrix.

```MatrixF &
```
```inverse()
```

Invert m.

```void
```
```invertTo(MatrixF * out)
```

Copy the inversion of this into out matrix.

```bool
```
```isAffine()
```

Check to see if this is an affine matrix.

```bool
```
```isIdentity()
```

Checks for identity matrix.

```void
```
```mul(Box3F & b)
```

Axial box -> Axial Box.

```MatrixF &
```
```mul(const F32 a)
```

M * a -> M.

```MatrixF &
```
```mul(const MatrixF & a)
```

M * a -> M.

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

a * b -> M

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

a * b -> M

```void
```
```mul(Point4F & p)
```

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

```MatrixF &
```
```mulL(const MatrixF & a)
```

a * M -> M

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

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

```void
```
```mulP(Point3F & p)
```

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

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

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

```void
```
```mulV(VectorF & p)
```

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

```void
```
```normalize()
```

Normalize the matrix.

```operator const F32*()
```

Allow people to get at m.

```operator F32*()
```

Allow people to get at m.

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

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

```F32
```
```operator()(S32 row, S32 col)
```
```MatrixF &
```
```operator*=(const MatrixF & m)
```
```MatrixF &
```
```scale(const Point3F & s)
```

M * Matrix(p) -> M.

```MatrixF &
```
```scale(F32 s)
```
```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.

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

Set the specified column from a Point3F.

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

Set the specified column from a Point4F.

```MatrixF &
```
```setCrossProduct(const Point3F & p)
```

Initialize matrix with a cross product of p.

```void
```
```setPosition(const Point3F & pos)
```

Set the position of the matrix.

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

Set the specified row from a Point3F.

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

Set the specified row from a Point4F.

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

Initialize matrix with a tensor product of p.

```EulerF
```
```toEuler()
```
```MatrixF &
```
```transpose()
```

Swap rows and columns.

```void
```
```transposeTo(F32 * matrix)
```

Swaps rows and columns into matrix.

## Public Static Functions

```U32
```
```idx(U32 i, U32 j)
```

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

## Detailed Description

4x4 Matrix Class

This runs at F32 precision.

## Private Attributes

```F32 m 
```

Note: Torque uses row-major matrices.

## Public Static Attributes

```const MatrixF Identity
```

## Public Functions

```MatrixF(bool identity)
```

Create an uninitialized matrix.

Parameters:

 identity If true, initialize to the identity matrix.

```MatrixF(const EulerF & e)
```

Create a matrix to rotate about origin by e.

see:

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

Create a matrix to rotate about p by e.

see:

```add(const MatrixF & m)
```

```affineInverse()
```

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

```displace(const Point3F & delta)
```

Add the passed delta to the matrix position.

```dumpMatrix(const char * caption)
```

```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(S32 col, Point3F * cptr)
```

Copy the requested column into a Point3F.

This drops the bottom-most row.

```getColumn(S32 col, Point4F * cptr)
```

Copy the requested column into a Point4F.

```getColumn3F(S32 col)
```

```getColumn4F(S32 col)
```

```getForwardVector()
```

Get the y axis of the matrix.

This is the 2nd column of the matrix and is normally considered the forward vector.

```getPosition()
```

Get the position of the matrix.

This is the 4th column of the matrix.

```getRightVector()
```

Get the x axis of the matrix.

This is the 1st column of the matrix and is normally considered the right vector.

```getRow(S32 row, Point3F * cptr)
```

Copy the specified row into a Point3F.

Right-most item is dropped.

```getRow(S32 row, Point4F * cptr)
```

Copy the specified row into a Point4F.

```getRow3F(S32 row)
```

```getRow4F(S32 row)
```

```getScale()
```

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

```getUpVector()
```

Get the z axis of the matrix.

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

```identity()
```

Make this an identity matrix.

```inverse()
```

Invert m.

```invertTo(MatrixF * out)
```

Copy the inversion of this into out matrix.

```isAffine()
```

Check to see if this is an affine matrix.

```isIdentity()
```

Checks for identity matrix.

```mul(Box3F & b)
```

Axial box -> Axial Box.

```mul(const F32 a)
```

M * a -> M.

```mul(const MatrixF & a)
```

M * a -> M.

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

a * b -> M

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

a * b -> M

```mul(Point4F & p)
```

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

```mulL(const MatrixF & a)
```

a * M -> M

```mulP(const Point3F & p, Point3F * d)
```

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

```mulP(Point3F & p)
```

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

```mulV(const VectorF & p, Point3F * d)
```

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

```mulV(VectorF & p)
```

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

```normalize()
```

Normalize the matrix.

```operator const F32*()
```

Allow people to get at m.

```operator F32*()
```

Allow people to get at m.

```operator()(S32 row, S32 col)
```

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

```operator()(S32 row, S32 col)
```

```operator*=(const MatrixF & m)
```

```scale(const Point3F & s)
```

M * Matrix(p) -> M.

```scale(F32 s)
```

```set(const EulerF & e)
```

Initialize matrix to rotate about origin by e.

```set(const EulerF & e, const Point3F & p)
```

Initialize matrix to rotate about p by e.

```setColumn(S32 col, const Point3F & cptr)
```

Set the specified column from a Point3F.

The bottom-most row is not set.

```setColumn(S32 col, const Point4F & cptr)
```

Set the specified column from a Point4F.

```setCrossProduct(const Point3F & p)
```

Initialize matrix with a cross product of p.

```setPosition(const Point3F & pos)
```

Set the position of the matrix.

This is the 4th column of the matrix.

```setRow(S32 row, const Point3F & cptr)
```

Set the specified row from a Point3F.

The right-most item is not set.

```setRow(S32 row, const Point4F & cptr)
```

Set the specified row from a Point4F.

```setTensorProduct(const Point3F & p, const Point3F & q)
```

Initialize matrix with a tensor product of p.

```toEuler()
```

```transpose()
```

Swap rows and columns.

```transposeTo(F32 * matrix)
```

Swaps rows and columns into matrix.

## Public Static Functions

```idx(U32 i, U32 j)
```

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.