tmatrix Class Reference

Detailed Description
A transformation matrix class.The matrix class groups sixteen real values an treats them as a 4x4 matrix. Standard C++ matrices (2 dimensional vectors) are stored by row, since for graphical applications a column major order is preferable the access indices are internally swapped.
The most common operators between matrices (and some which involves scalars and vectors too) are defined.
Public Types | |
| enum | ordermode { COLUMN, ROW } |
| Espresses how to store a tmatrix in a single 16 elements vector, by column or by row. More... | |
Public Member Functions | |
| tmatrix () | |
| default constructor | |
| tmatrix (const real &val) | |
| constructs a tmatrix and fills it with a value | |
| tmatrix (const real vector[16], ordermode ord=COLUMN) | |
| constructs a tmatrix from a vector which contains a 4x4 matrix in row major or column major order | |
| tmatrix (const tmatrix &other) | |
| the copy constructor | |
| ~tmatrix () | |
| the distructor | |
| tmatrix & | operator- () |
| negation | |
| tmatrix & | operator= (const tmatrix &other) |
| assignment | |
| tmatrix & | operator+= (const tmatrix &other) |
| sum & assign | |
| tmatrix & | operator-= (const tmatrix &other) |
| subtract & assign | |
| tmatrix & | operator *= (const tmatrix &other) |
| multiply by a tmatrix & assign | |
| tmatrix & | operator *= (const real &fact) |
| multiply by a scalar factor & assign | |
| tmatrix & | operator/= (const real &fact) |
| divide by a scalar factor & assign | |
| real & | operator() (const int &row, const int &col) |
| an "access like a C++ tmatrix" | |
| operator double * () | |
| conversion to a 16 doubles C++ vector (column major order) | |
| void | loadIdentity () |
| fills the matrix with the identity matrix | |
Static Public Member Functions | |
| static int | howMany () |
| returns how many tmatrix objects exists | |
Private Attributes | |
| real | mat [4][4] |
| the matrix data | |
Static Private Attributes | |
| static int | counter = 0 |
| counts how many matrices objects are present | |
Friends | |
| int | operator== (const tmatrix &t1, const tmatrix &t2) |
| the equality operator | |
| int | operator!= (const tmatrix &t1, const tmatrix &t2) |
| the inequality operator | |
| tmatrix | operator+ (const tmatrix &t1, const tmatrix &t2) |
| the sum | |
| tmatrix | operator- (const tmatrix &t1, const tmatrix &t2) |
| the difference | |
| tmatrix | operator * (const tmatrix &t1, const tmatrix &t2) |
| tmatrix product | |
| tmatrix | operator * (const tmatrix &tmat, const real &fact) |
| multiply a tmatrix by a scalar factor | |
| tmatrix | operator * (const real &fact, const tmatrix &tmat) |
| multiply a scalar factor by a tmatrix | |
| tmatrix | operator/ (const tmatrix &tmat, const real &fact) |
| divide a tmatrix by a scalar factor | |
| ostream & | operator<< (ostream &os, const tmatrix &m) |
| print tmatrix to C++ stream | |
Member Enumeration Documentation
| enum ordermode |
Constructor & Destructor Documentation
| tmatrix | ( | ) |
default constructor
- Parameters:
-
bInit if set to true initializes the matrix to the identity matrix
| ~tmatrix | ( | ) | [inline] |
the distructor
Member Function Documentation
| tmatrix & operator- | ( | ) |
negation
| real & operator() | ( | const int & | row, | |
| const int & | col | |||
| ) | [inline] |
an "access like a C++ tmatrix"
This operator redirects the access to the internal matrix. It does make a range check on the index in debug builds trough the ANSI assert function. It can be used on both sides of an assignment.
- Returns:
- a reference to the requested element
- Parameters:
-
row the row index which should be one of 0,1,2,3 col the column index which should be one of 0,1,2,3
- Date:
- 18/06/99
| operator double * | ( | ) | [inline] |
| void loadIdentity | ( | ) |
fills the matrix with the identity matrix
| int howMany | ( | ) | [inline, static] |
Friends And Related Function Documentation
multiply a tmatrix by a scalar factor
multiply a scalar factor by a tmatrix
divide a tmatrix by a scalar factor
Member Data Documentation
int counter = 0 [static, private] |
counts how many matrices objects are present



