MatrixF
4x4 Matrix Class
Public Friends
Public Functions
MatrixF(bool identity)
Create an uninitialized matrix.
MatrixF &
Take inverse of matrix assuming it is affine (rotation, scale, sheer, translation only).
dumpMatrix(const char * caption)
bool
Compute the inverse of the matrix.
getColumn3F(S32 col)
getColumn4F(S32 col)
Get the y axis of the matrix.
Get the position of the matrix.
Get the x axis of the matrix.
Get the z axis of the matrix.
bool
isAffine()
Check to see if this is an affine matrix.
bool
Checks for identity matrix.
Allow people to get at m.
Allow people to get at m.
F32 &
operator()(S32 row, S32 col)
Convenience function to allow people to treat this like an array.
operator()(S32 row, S32 col)
MatrixF &
operator*=(const MatrixF & m)
MatrixF &
setCrossProduct(const Point3F & p)
Initialize matrix with a cross product of p.
setPosition(const Point3F & pos)
Set the position of the matrix.
MatrixF &
setTensorProduct(const Point3F & p, const Point3F & q)
Initialize matrix with a tensor product of p.
transposeTo(F32 * matrix)
Swaps rows and columns into matrix.
Detailed Description
4x4 Matrix Class
This runs at F32 precision.
Public Friends
Private Attributes
F32 m [16]
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.
MatrixF(const EulerF & e, const Point3F & p)
Create a matrix to rotate about p by e.
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.