A 2x2 matrix. More...
#include <mat2.h>
Public Member Functions | |
mat2 () | |
Creates a new, uninitialized matrix. | |
mat2 (type m00, type m01, type m10, type m11) | |
Creates a new matrix with the given components. | |
mat2 (const type array[2][2]) | |
Creates a new matrix with the given components. | |
mat2 (const mat2 &mat) | |
Creates a new matrix as a copy of the given matrix. | |
const type * | coefficients () const |
Returns the coefficients of this matrix. | |
type * | operator[] (int iRow) const |
Returns the row of this matrix whose index is given. | |
vec2< type > | getColumn (int iCol) const |
Returns the column of this matrix whose index is given. | |
void | setColumn (int iCol, const vec2< type > &v) |
Sets the column of this matrix whose index is given. | |
mat2 & | operator= (const mat2 &mat) |
Assigns the given matrix to this matrix. | |
bool | operator== (const mat2 &mat) const |
Returns true is this matrix is equal to the given matrix. | |
bool | operator!= (const mat2 &mat) const |
Returns true is this matrix is different from the given matrix. | |
mat2 | operator+ (const mat2 &mat) const |
Returns the sum of this matrix and of the given matrix. | |
mat2 | operator- (const mat2 &mat) const |
Returns the difference of this matrix and of the given matrix. | |
mat2 | operator* (const mat2 &mat) const |
Returns the product of this matrix and of the given matrix. | |
vec2< type > | operator* (const vec2< type > &v) const |
Returns the product of this matrix and of the given vector. | |
mat2 | operator* (const type scalar) const |
Returns the product of this matrix and of the given scalar. | |
mat2 | operator- () const |
Returns the opposite of this matrix. | |
mat2 | transpose () const |
Returns the transpose of this matrix. | |
bool | inverse (mat2 &mInv, type tolerance=1e-06) const |
Returns true is this matrix has an inverse. | |
mat2 | inverse (type tolerance=1e-06) const |
Returns the inverse of this matrix. | |
type | determinant () const |
Returns the determinant of this matrix. | |
type | trace () const |
Returns the trace of this matrix. | |
template<class t > | |
mat2< t > | cast () const |
Casts this matrix to another base type. | |
Static Public Attributes | |
static const mat2 | ZERO |
The null matrix. | |
static const mat2 | IDENTITY |
The identity matrix. | |
Protected Attributes | |
union { | |
type m [2][2] | |
The matrix coefficients as a 2D array. | |
type _m [4] | |
The matrix coefficients as a 1D array. | |
}; | |
The matrix coeffients. |
A 2x2 matrix.
ork::mat2< type >::mat2 | ( | type | m00, | |
type | m01, | |||
type | m10, | |||
type | m11 | |||
) | [inline] |
Creates a new matrix with the given components.
The first index is the row index, the second one is the column index.
Creates a new matrix with the given components.
The first index is the row index, the second one is the column index.
Creates a new matrix as a copy of the given matrix.
Casts this matrix to another base type.
const type * ork::mat2< type >::coefficients | ( | ) | const [inline] |
Returns the coefficients of this matrix.
type ork::mat2< type >::determinant | ( | ) | const [inline] |
Returns the determinant of this matrix.
Returns the column of this matrix whose index is given.
mat2< type > ork::mat2< type >::inverse | ( | type | tolerance = 1e-06 |
) | const [inline] |
Returns the inverse of this matrix.
bool ork::mat2< type >::inverse | ( | mat2< type > & | mInv, | |
type | tolerance = 1e-06 | |||
) | const [inline] |
Returns true is this matrix has an inverse.
In this case the inverse matrix is returned in the given matrix parameter.
bool ork::mat2< type >::operator!= | ( | const mat2< type > & | mat | ) | const [inline] |
Returns true is this matrix is different from the given matrix.
mat2< type > ork::mat2< type >::operator* | ( | const type | scalar | ) | const [inline] |
Returns the product of this matrix and of the given scalar.
vec2< type > ork::mat2< type >::operator* | ( | const vec2< type > & | v | ) | const [inline] |
Returns the product of this matrix and of the given vector.
mat2< type > ork::mat2< type >::operator* | ( | const mat2< type > & | mat | ) | const [inline] |
Returns the product of this matrix and of the given matrix.
mat2< type > ork::mat2< type >::operator+ | ( | const mat2< type > & | mat | ) | const [inline] |
Returns the sum of this matrix and of the given matrix.
Returns the opposite of this matrix.
mat2< type > ork::mat2< type >::operator- | ( | const mat2< type > & | mat | ) | const [inline] |
Returns the difference of this matrix and of the given matrix.
mat2< type > & ork::mat2< type >::operator= | ( | const mat2< type > & | mat | ) | [inline] |
Assigns the given matrix to this matrix.
bool ork::mat2< type >::operator== | ( | const mat2< type > & | mat | ) | const [inline] |
Returns true is this matrix is equal to the given matrix.
type * ork::mat2< type >::operator[] | ( | int | iRow | ) | const [inline] |
Returns the row of this matrix whose index is given.
void ork::mat2< type >::setColumn | ( | int | iCol, | |
const vec2< type > & | v | |||
) | [inline] |
Sets the column of this matrix whose index is given.
type ork::mat2< type >::trace | ( | ) | const [inline] |
Returns the trace of this matrix.
Returns the transpose of this matrix.
union { ... } [protected] |
The matrix coeffients.
The identity matrix.