Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a 2x2 matrix. More...
#include <omMatrix2D.h>
Public Member Functions | |
MatrixND () | |
Create a 2x2 matrix with all elements equal to zero. More... | |
MatrixND (const VectorND< T, 2 > &column1, const VectorND< T, 2 > &column2) | |
Create a 2x2 matrix from two column vectors. More... | |
MatrixND (T a, T b, T c, T d) | |
Create a 2x2 matrix with elements specified in row-major order. More... | |
MatrixND (const T array[4]) | |
Create a 2x2 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 a copy of the specified 2x2 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, 2 > & | getColumn (Index columnIndex) |
Get the column at the specified index in the matrix. More... | |
const VectorND< T, 2 > & | getColumn (Index columnIndex) const |
Get the column at the specified index in the matrix. More... | |
VectorND< T, 2 > & | operator() (Index columnIndex) |
Get the column at the specified index in the matrix. More... | |
const VectorND< T, 2 > & | operator() (Index columnIndex) const |
Get the column at the specified index in the matrix. More... | |
VectorND< T, 2 > & | operator[] (Index columnIndex) |
Get the column at the specified index in the matrix. More... | |
const VectorND< T, 2 > & | operator[] (Index columnIndex) const |
Get the column at the specified index in the matrix. More... | |
VectorND< T, 2 > | 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... | |
VectorND< T, 2 > | getDiagonal () const |
Return the diagonal vector of this matrix. More... | |
void | set (Index columnIndex, Index rowIndex, T value) |
Set the element in the matrix at the specified (row, column) index. More... | |
void | setColumn (Index columnIndex, const VectorND< T, 2 > &newColumn) |
Set the column in the matrix at the specified index. More... | |
void | setRow (Index rowIndex, const VectorND< T, 2 > &newRow) |
Set the row in the matrix at the specified index. 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, 2 > | operator* (const VectorND< T, 2 > &vector) const |
Multiply a vector/point by this matrix and return the result. More... | |
MatrixND | operator* (const T &value) const |
Multiply this matrix's elements by a scalar and return the resulting matrix. More... | |
MatrixND | operator/ (const T &value) const |
Divide 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 MatrixND &matrix2) |
Subtract the elements of another matrix from this matrix. More... | |
MatrixND & | operator+= (const T &value) |
Add a scalar value to the elements of 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 2x2 matrix into a human-readable string representation. More... | |
operator data::String () const | |
Convert this 2x2 matrix into a human-readable string representation. More... | |
Static Public Member Functions | |
static MatrixND | rotate (T radians) |
Create a 2x2 rotation matrix with the specified rotation in radians. More... | |
static MatrixND | rotateDegrees (T degrees) |
Create a 2x2 rotation matrix with the specified rotation in degrees. More... | |
Public Attributes | |
VectorND< T, 2 > | x |
The first column vector of the matrix. More... | |
VectorND< T, 2 > | y |
The second 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 2x2 matrix.
Elements in the matrix are stored in column-major order.
|
inline |
Create a 2x2 matrix with all elements equal to zero.
|
inline |
Create a 2x2 matrix from two column vectors.
|
inline |
Create a 2x2 matrix with elements specified in row-major order.
|
inlineexplicit |
Create a 2x2 matrix from a pointer to an array of elements in column-major order.
|
inline |
Create a copy of the specified 2x2 matrix with different template parameter type.
|
inlinestatic |
Create a 2x2 rotation matrix with the specified rotation in radians.
|
inlinestatic |
Create a 2x2 rotation matrix with the specified rotation 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 4 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 |
Return the diagonal vector of this matrix.
|
inline |
Set the element in the matrix at the specified (row, column) 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 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 both 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 |
Multiply a vector/point by this matrix and return the result.
|
inline |
Multiply this matrix's elements by a scalar and return the resulting matrix.
|
inline |
Divide the elements of this matrix by a scalar and return the resulting matrix.
|
inline |
Add the elements of another matrix to this matrix.
|
inline |
Subtract the elements of another matrix from this matrix.
|
inline |
Add a scalar value to the elements of 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 2x2 matrix into a human-readable string representation.
|
inline |
Convert this 2x2 matrix into a human-readable string representation.
VectorND<T,2> om::math::MatrixND< T, 2, 2 >::x |
The first column vector of the matrix.
VectorND<T,2> om::math::MatrixND< T, 2, 2 >::y |
The second 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.