|
Allolib
1.0
C++ Components For Interactive Multimedia
|
Fixed-size n-by-n square matrix. More...
#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/math/al_Mat.hpp>
Public Member Functions | |
| Mat () | |
| Default constructor that initializes elements to zero. | |
| template<class U > | |
| Mat (const U *arr) | |
| template<class U > | |
| Mat (const Mat< N, U > &src) | |
| Mat (const MatNoInit &v) | |
| Construct without initializing elements. | |
| Mat (const T &r1c1, const T &r1c2, const T &r2c1, const T &r2c2) | |
| 2x2 matrix constructor with element initialization | |
| Mat (const T &r1c1, const T &r1c2, const T &r1c3, const T &r2c1, const T &r2c2, const T &r2c3, const T &r3c1, const T &r3c2, const T &r3c3) | |
| 3x3 matrix constructor with element initialization | |
| Mat (const T &r1c1, const T &r1c2, const T &r1c3, const T &r1c4, const T &r2c1, const T &r2c2, const T &r2c3, const T &r2c4, const T &r3c1, const T &r3c2, const T &r3c3, const T &r3c4, const T &r4c1, const T &r4c2, const T &r4c3, const T &r4c4) | |
| 4x4 matrix constructor with element initialization | |
| const T * | elems () const |
| Get read-only pointer to elements. | |
| T * | elems () |
| Get read-write pointer to elements. | |
| T & | operator[] (int i) |
| Set element at index with no bounds checking. | |
| const T & | operator[] (int i) const |
| Get element at index with no bounds checking. | |
| T & | operator() (int i, int j) |
| Set element at row i, column j. | |
| const T & | operator() (int i, int j) const |
| Get element at row i, column j. | |
| Vec< N, T > | col (int i) const |
| Return column i as vector. | |
| Vec< N, T > | row (int i) const |
| Return row i as vector. | |
| Vec< N, T > | diagonal () const |
| Return diagonal. | |
| Mat & | transpose () |
| Transpose elements. | |
| template<int M> | |
| Mat< M, T > | sub (int row=0, int col=0) const |
| Get an MxM submatrix. | |
| Mat< N - 1, T > | submatrix (int row, int col) const |
| Returns a submatrix by removing one row and column. | |
| Vec< N *N, T > & | vec () |
| Return matrix punned as a vector. | |
| Mat & | operator*= (const Mat &v) |
| Mat & | operator+= (const Mat &v) |
| Mat & | operator-= (const Mat &v) |
| Mat & | operator+= (const T &v) |
| Mat & | operator-= (const T &v) |
| Mat & | operator*= (const T &v) |
| Mat & | operator/= (const T &v) |
| Mat | operator- () const |
| Mat | operator+ (const Mat &v) const |
| Mat | operator- (const Mat &v) const |
| Mat | operator* (const Mat &v) const |
| Mat | operator+ (const T &v) const |
| Mat | operator- (const T &v) const |
| Mat | operator* (const T &v) const |
| Mat | operator/ (const T &v) const |
| Mat & | set (const T &v) |
| Set all elements to value. | |
| template<class U > | |
| Mat & | set (const Mat< N, U > &v) |
| Set elements from another matrix. | |
| template<class U > | |
| Mat & | set (const U *arr) |
| Set elements in column-major order from C array. | |
| template<class U > | |
| Mat & | set (const U *arr, int numElements, int matOffset, int matStride=1) |
| Set elements in column-major order from C array. More... | |
| Mat & | set (const T &r1c1, const T &r1c2, const T &r2c1, const T &r2c2, int row=0, int col=0) |
| Set 2-by-2 (sub)matrix from arguments. | |
| Mat & | set (const T &r1c1, const T &r1c2, const T &r1c3, const T &r2c1, const T &r2c2, const T &r2c3, const T &r3c1, const T &r3c2, const T &r3c3, int row=0, int col=0) |
| Set 3-by-3 (sub)matrix from arguments. | |
| Mat & | set (const T &r1c1, const T &r1c2, const T &r1c3, const T &r1c4, const T &r2c1, const T &r2c2, const T &r2c3, const T &r2c4, const T &r3c1, const T &r3c2, const T &r3c3, const T &r3c4, const T &r4c1, const T &r4c2, const T &r4c3, const T &r4c4, int row=0, int col=0) |
| Set 4-by-4 (sub)matrix from arguments. | |
| Mat & | setCol2 (const T &v1, const T &v2, int col=0, int row=0) |
| Set a (sub)column. | |
| Mat & | setCol3 (const T &v1, const T &v2, const T &v3, int col=0, int row=0) |
| Set a (sub)column. | |
| Mat & | setCol4 (const T &v1, const T &v2, const T &v3, const T &v4, int col=0, int row=0) |
| Set a (sub)column. | |
| Mat & | setIdentity () |
| Set elements on diagonal to one and all others to zero. | |
| T | cofactor (int row, int col) const |
| Get cofactor. | |
| Mat< N, T > | cofactorMatrix () const |
| Get cofactor matrix. | |
| T | trace () const |
| Get trace (sum of diagonal elements) | |
| Mat< N, T > | inversed () const |
| Mat & | rotate (double angle, int dim1, int dim2) |
| Rotate transformation matrix on a local plane (A' = AR) More... | |
| template<int M> | |
| Mat & | rotateGlobal (double angle, int dim1, int dim2) |
| Rotate submatrix on a global plane (A' = RA) | |
| Mat & | rotateGlobal (double angle, int dim1, int dim2) |
| Rotate transformation matrix on a global plane (A' = RA) | |
| template<class V > | |
| Mat & | scale (const Vec< N - 1, V > &amount) |
| Scale transformation matrix. | |
| template<class V > | |
| Mat & | scale (const V &amount) |
| Scale transformation matrix by uniform amount. | |
| template<typename... Vals> | |
| Mat & | scale (Vals... vals) |
| Scale transformation matrix. | |
| template<class V > | |
| Mat & | scaleGlobal (const Vec< N - 1, V > &amount) |
| Scale transformation matrix global coordinates. | |
| template<class V > | |
| Mat & | translate (const Vec< N - 1, V > &amount) |
| Translate transformation matrix. | |
| template<class V > | |
| Mat & | translate (const V &amount) |
| Translate transformation matrix by same amount in all directions. | |
| template<typename... Vals> | |
| Mat & | translate (Vals... vals) |
| Translate transformation matrix. | |
| void | print (std::ostream &stream) const |
| Print to file (stream) | |
Static Public Member Functions | |
| static Mat | identity () |
| Get identity matrix. | |
| static Mat | rotation (double angle, int dim1, int dim2) |
| Get a rotation transform matrix. | |
| template<class V > | |
| static Mat | scaling (const Vec< N - 1, V > &v) |
| Get a scaling transform matrix. | |
| template<class V > | |
| static Mat | scaling (V v) |
| Get a scaling transform matrix. | |
| template<typename... Vals> | |
| static Mat | scaling (Vals... vals) |
| Get a scaling transform matrix. | |
| template<class V > | |
| static Mat | translation (const Vec< N - 1, V > &v) |
| Get a translation transform matrix. | |
| template<typename... Vals> | |
| static Mat | translation (Vals... vals) |
| Get a translation transform matrix. | |
| static Mat & | pun (T *src) |
| Returns C array type punned into a matrix. | |
| static const Mat & | pun (const T *src) |
| static int | size () |
| Returns total number of elements. | |
| static Mat & | multiply (Mat &r, const Mat &a, const Mat &b) |
| Computes matrix product r = a * b. More... | |
| template<class U > | |
| static Vec< N, U > & | multiply (Vec< N, U > &r, const Mat &m, const Vec< N, U > &vCol) |
| Computes product of matrix multiplied by column vector, r = m * vCol. | |
| template<class U > | |
| static Vec< N, U > & | multiply (Vec< N, U > &r, const Vec< N, U > &vRow, const Mat &m) |
| Computes product of row vector multiplied by matrix, r = vRow * m. | |
Public Attributes | |
| T | mElems [N *N] |
| Column-major array of elements. | |
Fixed-size n-by-n square matrix.
Elements are stored in column-major format.
Definition at line 78 of file al_Mat.hpp.
| [in] | arr | one dimensional array in column-major |
Definition at line 91 of file al_Mat.hpp.
| [in] | src | matrix with same dimension, but possibly different type |
Definition at line 97 of file al_Mat.hpp.
|
inlinestatic |
Computes matrix product r = a * b.
Returns reference to result
Definition at line 305 of file al_Mat.hpp.
Rotate transformation matrix on a local plane (A' = AR)
| [in] | angle | angle of rotation, in radians |
| [in] | dim1 | local coordinate frame axis to rotate away from |
| [in] | dim2 | local coordinate frame axis to rotate towards |
Definition at line 470 of file al_Mat.hpp.
|
inline |
Set elements in column-major order from C array.
| [in] | arr | 1D array from which to copy (stride=1) |
| [in] | numElements | number of elements to copy |
| [in] | matOffset | index offset into matrix |
| [in] | matStride | amount to stride through matrix |
Definition at line 357 of file al_Mat.hpp.