Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a 4x4 matrix. More...
#include <omMatrix4D.h>
Public Member Functions | |
MatrixND () | |
Create a 4x4 matrix with all elements equal to zero. More... | |
MatrixND (const VectorND< T, 4 > &col1, const VectorND< T, 4 > &col2, const VectorND< T, 4 > &col3, const VectorND< T, 4 > &col4) | |
Create a 4x4 matrix from four column vectors. More... | |
MatrixND (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j, T k, T l, T m, T n, T o, T p) | |
Create a 4x4 matrix with elements specified in row-major order. More... | |
MatrixND (const T array[16]) | |
Create a 4x4 matrix from a pointer to an array of elements in column-major order. More... | |
template<typename U > | |
MatrixND (const MatrixND< U, 2, 2 > &other) | |
Create an identity matrx with the specified 2x2 matrix in the upper-left corner. More... | |
template<typename U > | |
MatrixND (const MatrixND< U, 3, 3 > &other) | |
Create an identity matrx with the specified 3x3 matrix in the upper-left corner. More... | |
template<typename U > | |
MatrixND (const MatrixND< U, 4, 4 > &other) | |
Create a copy of the specified 4x4 matrix with different template parameter type. More... | |
T * | toArrayColumnMajor () |
Return a pointer to the matrix's elements in colunn-major order. More... | |
const T * | toArrayColumnMajor () const |
Return a pointer to the matrix's elements in colunn-major order. More... | |
void | toArrayRowMajor (T *outputArray) const |
Place the elements of the matrix at the location specified in row-major order. More... | |
VectorND< T, 4 > & | getColumn (Index columnIndex) |
Get the column at the specified index in the matrix. More... | |
const VectorND< T, 4 > & | getColumn (Index columnIndex) const |
Get the column at the specified index in the matrix. More... | |
VectorND< T, 4 > & | operator() (Index columnIndex) |
Get the column at the specified index in the matrix. More... | |
const VectorND< T, 4 > & | operator() (Index columnIndex) const |
Get the column at the specified index in the matrix. More... | |
VectorND< T, 4 > & | operator[] (Index columnIndex) |
Get the column at the specified index in the matrix. More... | |
const VectorND< T, 4 > & | operator[] (Index columnIndex) const |
Get the column at the specified index in the matrix. More... | |
VectorND< T, 4 > | getRow (Index rowIndex) const |
Get the row at the specified index in the matrix. More... | |
T & | get (Index columnIndex, Index rowIndex) |
Get the element at the specified (column, row) index in the matrix. More... | |
const T & | get (Index columnIndex, Index rowIndex) const |
Get the element at the specified (column, row) index in the matrix. More... | |
T & | operator() (Index columnIndex, Index rowIndex) |
Get the element at the specified (column, row) index in the matrix. More... | |
const T & | operator() (Index columnIndex, Index rowIndex) const |
Get the element at the specified (column, row) index in the matrix. More... | |
void | set (Index columnIndex, Index rowIndex, T value) |
Set the element in the matrix at the specified (column, row) index. More... | |
void | setColumn (Index columnIndex, const VectorND< T, 4 > &newColumn) |
Set the column in the matrix at the specified index. More... | |
void | setRow (Index rowIndex, const VectorND< T, 4 > &newRow) |
Set the row in the matrix at the specified index. More... | |
VectorND< T, 4 > | getDiagonal () const |
Return the diagonal vector of this matrix. More... | |
MatrixND< T, 2, 2 > | getXY () const |
Return the upper-left 2x2 submatrix of this matrix. More... | |
MatrixND< T, 3, 3 > | getXYZ () const |
Return the upper-left 3x3 submatrix of this matrix. More... | |
T | getDeterminant () const |
Return the determinant of this matrix. More... | |
MatrixND | invert (T threshold=0) const |
Return the inverse of this matrix, or the zero matrix if the matrix has no inverse. More... | |
Bool | invert (MatrixND &inverse, T threshold=0) const |
Compute the inverse of this matrix, returning the result in the output parameter. More... | |
MatrixND | orthonormalize () const |
Return the orthonormalization of this matrix. More... | |
MatrixND | transpose () const |
Return the transposition of this matrix. More... | |
Bool | operator== (const MatrixND &m) const |
Compare two matrices component-wise for equality. More... | |
Bool | operator!= (const MatrixND &m) const |
Compare two matrices component-wise for inequality. More... | |
MatrixND | operator- () const |
Negate every element of this matrix and return the resulting matrix. More... | |
MatrixND | operator+ () const |
'Positivate' every element of this matrix, returning a copy of the original matrix. More... | |
MatrixND | operator+ (const MatrixND &matrix) const |
Add this matrix to another and return the resulting matrix. More... | |
MatrixND | operator+ (const T &value) const |
Add a scalar to the elements of this matrix and return the resulting matrix. More... | |
MatrixND | operator- (const MatrixND &matrix) const |
Subtract a matrix from this matrix and return the resulting matrix. More... | |
MatrixND | operator- (const T &value) const |
Subtract a scalar from the elements of this matrix and return the resulting matrix. More... | |
MatrixND | operator* (const MatrixND &matrix) const |
Multiply a matrix by this matrix and return the result. More... | |
VectorND< T, 4 > | operator* (const VectorND< T, 4 > &vector) const |
MatrixND | operator* (const T &value) const |
Multiply the elements of this matrix by a scalar and return the resulting matrix. More... | |
MatrixND | operator/ (const T &value) const |
Multiply the elements of this matrix by a scalar and return the resulting matrix. More... | |
MatrixND & | operator+= (const MatrixND &matrix2) |
Add the elements of another matrix to this matrix. More... | |
MatrixND & | operator+= (const T &value) |
Add a scalar value to the elements of this matrix. More... | |
MatrixND & | operator-= (const MatrixND &matrix2) |
Subtract the elements of another matrix from this matrix. More... | |
MatrixND & | operator-= (const T &value) |
Subtract a scalar value from the elements of this matrix. More... | |
MatrixND & | operator*= (const T &value) |
Multiply the elements of this matrix by a scalar value. More... | |
MatrixND & | operator/= (const T &value) |
Divide the elements of this matrix by a scalar value. More... | |
data::String | toString () const |
Convert this 4x4 matrix into a human-readable string representation. More... | |
operator data::String () const | |
Convert this 4x4 matrix into a human-readable string representation. More... | |
Static Public Member Functions | |
static MatrixND | scale (T s) |
Create a 4x4 scale matrix for the specified uniform scale factor. More... | |
static MatrixND | scale (const VectorND< T, 3 > &s) |
Create a 4x4 scale matrix for the specified 3D scale factor. More... | |
static MatrixND | translate (const VectorND< T, 2 > &t) |
Create a 4x4 translation matrix for the specified 2D translation. More... | |
static MatrixND | translate (const VectorND< T, 3 > &t) |
Create a 4x4 translation matrix for the specified 3D translation. More... | |
static MatrixND | rotateX (T xRotation) |
Create a 4x4 rotation matrix about the X-axis with the angle in radians. More... | |
static MatrixND | rotateY (T yRotation) |
Create a 4x4 rotation matrix about the Y-axis with the angle in radians. More... | |
static MatrixND | rotateZ (T zRotation) |
Create a 4x4 rotation matrix about the Z-axis with the angle in radians. More... | |
static MatrixND | rotateXDegrees (T xRotation) |
Create a 4x4 rotation matrix about the X-axis with the angle in degrees. More... | |
static MatrixND | rotateYDegrees (T yRotation) |
Create a 4x4 rotation matrix about the Y-axis with the angle in degrees. More... | |
static MatrixND | rotateZDegrees (T zRotation) |
Create a 4x4 rotation matrix about the Z-axis with the angle in degrees. More... | |
Public Attributes | |
VectorND< T, 4 > | x |
The first column vector of the matrix. More... | |
VectorND< T, 4 > | y |
The second column vector of the matrix. More... | |
VectorND< T, 4 > | z |
The third column vector of the matrix. More... | |
VectorND< T, 4 > | w |
The fourth column vector of the matrix. More... | |
Static Public Attributes | |
static const MatrixND | ZERO |
Constant matrix with all elements equal to zero. More... | |
static const MatrixND | IDENTITY |
Constant matrix with diagonal elements equal to one and all others equal to zero. More... | |
A class that represents a 4x4 matrix.
Elements in the matrix are stored in column-major order.
|
inline |
Create a 4x4 matrix with all elements equal to zero.
|
inline |
Create a 4x4 matrix from four column vectors.
|
inline |
Create a 4x4 matrix with elements specified in row-major order.
|
inlineexplicit |
Create a 4x4 matrix from a pointer to an array of elements in column-major order.
|
inlineexplicit |
Create an identity matrx with the specified 2x2 matrix in the upper-left corner.
|
inlineexplicit |
Create an identity matrx with the specified 3x3 matrix in the upper-left corner.
|
inline |
Create a copy of the specified 4x4 matrix with different template parameter type.
|
inlinestatic |
Create a 4x4 scale matrix for the specified uniform scale factor.
|
inlinestatic |
Create a 4x4 scale matrix for the specified 3D scale factor.
|
inlinestatic |
Create a 4x4 translation matrix for the specified 2D translation.
|
inlinestatic |
Create a 4x4 translation matrix for the specified 3D translation.
|
inlinestatic |
Create a 4x4 rotation matrix about the X-axis with the angle in radians.
|
inlinestatic |
Create a 4x4 rotation matrix about the Y-axis with the angle in radians.
|
inlinestatic |
Create a 4x4 rotation matrix about the Z-axis with the angle in radians.
|
inlinestatic |
Create a 4x4 rotation matrix about the X-axis with the angle in degrees.
|
inlinestatic |
Create a 4x4 rotation matrix about the Y-axis with the angle in degrees.
|
inlinestatic |
Create a 4x4 rotation matrix about the Z-axis with the angle in degrees.
|
inline |
Return a pointer to the matrix's elements in colunn-major order.
Since matrix elements are stored in column-major order, no allocation is performed and the elements are accessed directly.
|
inline |
Return a pointer to the matrix's elements in colunn-major order.
Since matrix elements are stored in column-major order, no allocation is performed and the elements are accessed directly.
|
inline |
Place the elements of the matrix at the location specified in row-major order.
The output array must be at least 9 elements long.
|
inline |
Get the column at the specified index in the matrix.
|
inline |
Get the column at the specified index in the matrix.
|
inline |
Get the column at the specified index in the matrix.
|
inline |
Get the column at the specified index in the matrix.
|
inline |
Get the column at the specified index in the matrix.
|
inline |
Get the column at the specified index in the matrix.
|
inline |
Get the row at the specified index in the matrix.
|
inline |
Get the element at the specified (column, row) index in the matrix.
|
inline |
Get the element at the specified (column, row) index in the matrix.
|
inline |
Get the element at the specified (column, row) index in the matrix.
|
inline |
Get the element at the specified (column, row) index in the matrix.
|
inline |
Set the element in the matrix at the specified (column, row) index.
|
inline |
Set the column in the matrix at the specified index.
|
inline |
Set the row in the matrix at the specified index.
|
inline |
Return the diagonal vector of this matrix.
|
inline |
Return the upper-left 2x2 submatrix of this matrix.
|
inline |
Return the upper-left 3x3 submatrix of this matrix.
|
inline |
Return the determinant of this matrix.
|
inline |
Return the inverse of this matrix, or the zero matrix if the matrix has no inverse.
Whether or not the matrix is invertable is determined by comparing the determinant to a threshold - if the absolute value of the determinant is less than the threshold, the matrix is not invertable.
|
inline |
Compute the inverse of this matrix, returning the result in the output parameter.
The method returns whether or not the matrix was able to be inverted. This propery is determined by comparing the determinant to a threshold - if the absolute value of the determinant is less than the threshold, the matrix is not invertable.
|
inline |
Return the orthonormalization of this matrix.
This matrix that is returned has all column vectors of unit length and perpendicular to each other.
|
inline |
Return the transposition of this matrix.
|
inline |
Compare two matrices component-wise for equality.
|
inline |
Compare two matrices component-wise for inequality.
|
inline |
Negate every element of this matrix and return the resulting matrix.
|
inline |
'Positivate' every element of this matrix, returning a copy of the original matrix.
|
inline |
Add this matrix to another and return the resulting matrix.
|
inline |
Add a scalar to the elements of this matrix and return the resulting matrix.
|
inline |
Subtract a matrix from this matrix and return the resulting matrix.
|
inline |
Subtract a scalar from the elements of this matrix and return the resulting matrix.
|
inline |
Multiply a matrix by this matrix and return the result.
|
inline |
|
inline |
Multiply the elements of this matrix by a scalar and return the resulting matrix.
|
inline |
Multiply the elements of this matrix by a scalar and return the resulting matrix.
|
inline |
Add the elements of another matrix to this matrix.
|
inline |
Add a scalar value to the elements of this matrix.
|
inline |
Subtract the elements of another matrix from this matrix.
|
inline |
Subtract a scalar value from the elements of this matrix.
|
inline |
Multiply the elements of this matrix by a scalar value.
|
inline |
Divide the elements of this matrix by a scalar value.
|
inline |
Convert this 4x4 matrix into a human-readable string representation.
|
inline |
Convert this 4x4 matrix into a human-readable string representation.
VectorND<T,4> om::math::MatrixND< T, 4, 4 >::x |
The first column vector of the matrix.
VectorND<T,4> om::math::MatrixND< T, 4, 4 >::y |
The second column vector of the matrix.
VectorND<T,4> om::math::MatrixND< T, 4, 4 >::z |
The third column vector of the matrix.
VectorND<T,4> om::math::MatrixND< T, 4, 4 >::w |
The fourth column vector of the matrix.
|
static |
Constant matrix with all elements equal to zero.
|
static |
Constant matrix with diagonal elements equal to one and all others equal to zero.