A CS123Matrix is templated to store M rows and N columns of data of type T. If left off, T will default to a "REAL" data type. Also, if N is not specified, the template will default to a square MxM matrix. More...
#include <CS123Matrix.h>
Public Member Functions | |
Constructors | |
| CS123Matrix (const T *srcData) | |
| Expects arguments in row-major order. | |
| CS123Matrix () | |
| Constructs a zero Matrix. | |
| CS123Matrix (const CS123Matrix< M, N, T > &m) | |
| Copy Constructor. | |
Accessor Operators | |
| const CS123Vector< N, T > & | operator[] (const unsigned rowIndex) const |
| CS123Vector< N, T > & | operator[] (const unsigned rowIndex) |
| const T * | operator* () const |
| T * | operator* () |
Equality Operators | |
| bool | operator== (const CS123Matrix< M, N, T > &m) const |
| bool | operator!= (const CS123Matrix< M, N, T > &m) const |
Mutator Operators | |
| CS123Matrix< M, N, T > & | operator= (const CS123Matrix< M, N, T > &m) |
| CS123Matrix< M, N, T > & | operator+= (const CS123Matrix< M, N, T > &rhs) |
| CS123Matrix< M, N, T > & | operator-= (const CS123Matrix< M, N, T > &rhs) |
| CS123Matrix< M, N, T > & | operator*= (const CS123Matrix< M, N, T > &rhs) |
Scalar Mutator Operators | |
| CS123Matrix< M, N, T > & | operator*= (const T &scale) |
| CS123Matrix< M, N, T > & | operator/= (const T &scale) |
Arithmetic Operators | |
| CS123Matrix< M, N, T > | operator+ (const CS123Matrix< M, N, T > &rhs) const |
| CS123Matrix< M, N, T > | operator- (const CS123Matrix< M, N, T > &rhs) const |
| CS123Matrix< M, N, T > | operator* (const CS123Matrix< M, N, T > &rhs) const |
| MxN (square) matrix * MxN (square) matrix yields an MxN (square) matrix. | |
| CS123Vector< M, T > | operator* (const CS123Vector< N, T > &rhs) const |
Scalar Arithmetic Operators | |
| CS123Matrix< M, N, T > | operator* (const T &scale) const |
| CS123Matrix< M, N, T > | operator/ (const T &scale) const |
More Complex Functionality | |
| bool | isDiagonal () const |
| CS123Vector< N, T > & | row (unsigned index) |
| CS123Vector< N, T > | row (unsigned index) const |
| CS123Vector< M, T > | col (unsigned index) const |
| CS123Matrix< M, N, T > & | setCol (unsigned index, const CS123Vector< M, T > &vec) |
| Sets the index'th column of this matrix to the given Vector. | |
| const CS123Matrix< M, N, T > | getTranspose () const |
| void | fillGLMatrix (T *bufferToFill) const |
| bool | isUpperTriangular () const |
| bool | isLowerTriangular () const |
| CS123Matrix< M, N, T > | getInverse () const |
| T | getDeterminant () const |
| void | cleanup () |
| Cleans up a matrix (0's out entries that are less than epsilon). | |
| CS123Matrix (const T &v0, const T &v1=0, const T &v2=0, const T &v3=0, const T &v4=0, const T &v5=0, const T &v6=0, const T &v7=0, const T &v8=0, const T &v9=0, const T &v10=0, const T &v11=0, const T &v12=0, const T &v13=0, const T &v14=0, const T &v15=0) | |
| Convenience Constructor. | |
Static Public Member Functions | |
Static convenience constructors to generate common matrices | |
| static CS123Matrix | zero () |
| Generates a matrix full of zeroes. | |
| static CS123Matrix | identity () |
| Generates an identity matrix. | |
| static CS123Matrix | diagonal (T diagonalValue) |
| Generates a diagonal matrix with the value specified. | |
Public Attributes | |
| CS123Vector< N, T > | rows [M] |
| Underlying data, where each row is stored in a separate CS123Vector. | |
A CS123Matrix is templated to store M rows and N columns of data of type T. If left off, T will default to a "REAL" data type. Also, if N is not specified, the template will default to a square MxM matrix.
Included in this definition are typedefs for the most commonly used matrices (4x4, 3x3, etc), and these can be thought of as shortcuts to reference their associated CS123Matrix templates. For example, Matrix4x4 can be used to refer to CS123Matrix<4, 4, REAL>.
A CS123Matrix stores each of its M rows internally as an N-length CS123Vector.
| CS123Vector< M, T > CS123Matrix< M, N, T >::col | ( | unsigned | index | ) | const [inline] |
| void CS123Matrix< M, N, T >::fillGLMatrix | ( | T * | bufferToFill | ) | const |
Fills the data provided with the transpose of this matrix (since OpenGL matrices are stored in column-major format).
| T CS123Matrix< M, N, T >::getDeterminant | ( | ) | const |
| CS123Matrix< M, N, T > CS123Matrix< M, N, T >::getInverse | ( | ) | const |
| const CS123Matrix< M, N, T > CS123Matrix< M, N, T >::getTranspose | ( | ) | const |
| bool CS123Matrix< M, N, T >::isDiagonal | ( | ) | const [inline] |
| bool CS123Matrix< M, N, T >::isLowerTriangular | ( | ) | const |
Example 4x4 triangular matrix: [ 1 0 0 0 ] [ 2 3 0 0 ] [ 4 5 0 0 ] [ 6 7 8 9 ]
Example 4x4 non upper triangular matrix: [ 1 0 0 2 ] [ 3 4 0 5 ] [ 6 7 8 0 ] [ 0 0 0 0 ]
| bool CS123Matrix< M, N, T >::isUpperTriangular | ( | ) | const |
Example 4x4 upper triangular matrix: [ 1 2 3 4 ] [ 0 5 6 7 ] [ 0 0 0 8 ] [ 0 0 0 9 ]
Example 4x4 non upper triangular matrix: [ 1 2 3 4 ] [ 0 5 6 7 ] [ 8 0 0 9 ] [ 0 0 0 0 ]
| CS123Vector< M, T > CS123Matrix< M, N, T >::operator* | ( | const CS123Vector< N, T > & | rhs | ) | const [inline] |
MxN matrix * N-length column vector yields an M-length vector
| const T * CS123Matrix< M, N, T >::operator* | ( | ) | const [inline] |
| T * CS123Matrix< M, N, T >::operator* | ( | ) | [inline] |
| CS123Vector< N, T > & CS123Matrix< M, N, T >::operator[] | ( | const unsigned | rowIndex | ) | [inline] |
| const CS123Vector< N, T > & CS123Matrix< M, N, T >::operator[] | ( | const unsigned | rowIndex | ) | const [inline] |
| CS123Vector< N, T > CS123Matrix< M, N, T >::row | ( | unsigned | index | ) | const [inline] |
| CS123Vector< N, T > & CS123Matrix< M, N, T >::row | ( | unsigned | index | ) | [inline] |
1.7.1