A 4x4 matrix. More...
#include <mat4.h>
Public Member Functions | |
mat4 () | |
Creates a new, uninitialized matrix. | |
mat4 (type m00, type m01, type m02, type m03, type m10, type m11, type m12, type m13, type m20, type m21, type m22, type m23, type m30, type m31, type m32, type m33) | |
Creates a new matrix with the given components. | |
mat4 (const type *array) | |
Creates a new matrix with the given components in row major order. | |
mat4 (const type array[4][4]) | |
Creates a new matrix with the given components. | |
mat4 (const mat3< type > &m3x3) | |
Creates a new matrix as a copy of the given matrix. | |
const type * | coefficients () const |
Returns the coefficients of this matrix. | |
const type * | operator[] (int iRow) const |
Returns the row of this matrix whose index is given. | |
void | operator= (const mat3< type > &m3) |
Assigns the given matrix to this matrix. | |
bool | operator== (const mat4 &m2) const |
Returns true is this matrix is equal to the given matrix. | |
bool | operator!= (const mat4 &m2) const |
Returns true is this matrix is different from the given matrix. | |
mat4 | operator+ (const mat4 &m2) const |
Returns the sum of this matrix and of the given matrix. | |
mat4 | operator- (const mat4 &m2) const |
Returns the difference of this matrix and of the given matrix. | |
mat4 | operator* (const mat4 &m2) const |
Returns the product of this matrix and of the given matrix. | |
vec4< type > | operator* (const vec4< type > &v) const |
Returns the product of this matrix and of the given vector. | |
vec3< type > | operator* (const vec3< type > &v) const |
Returns the product of this matrix and of the given vector. | |
box3< type > | operator* (const box3< type > &b) const |
Returns the bounding box of the given bounding box, transormed by the linear transformation represented by this matrix. | |
mat4 | operator* (type f) const |
Returns the product of this matrix and of the given scalar. | |
mat4 | transpose (void) const |
Returns the transpose of this matrix. | |
mat4 | adjoint () const |
Returns the adjoint of this matrix. | |
mat4 | inverse () const |
Returns the inverse of this matrix. | |
mat3< type > | mat3x3 () const |
Returns the linear part of this matrix (i.e. | |
type | determinant () const |
Returns the determinant of this matrix. | |
template<class t > | |
mat4< t > | cast () const |
Casts this matrix to another base type. | |
Static Public Member Functions | |
static mat4 | translate (const vec3< type > &v) |
Returns the translation matrix corresponding to the given translation vector. | |
static mat4 | rotatex (type angle) |
Returns the rotation matrix corresponding to the rotation around the x axis with the given angle. | |
static mat4 | rotatey (type angle) |
Returns the rotation matrix corresponding to the rotation around the y axis with the given angle. | |
static mat4 | rotatez (type angle) |
Returns the rotation matrix corresponding to the rotation around the z axis with the given angle. | |
static mat4 | perspectiveProjection (type fovy, type aspect, type zNear, type zFar) |
Returns the perspective projection matrix corresponding to the given projection parameters. | |
static mat4 | orthoProjection (type xRight, type xLeft, type yTop, type yBottom, type zNear, type zFar) |
Returns the orthographic projection matrix corresponding to the given projection parameters. | |
Static Public Attributes | |
static const mat4 | ZERO |
The null matrix. | |
static const mat4 | IDENTITY |
The identity matrix. | |
Protected Attributes | |
union { | |
type m [4][4] | |
The matrix coefficients as a 2D array. | |
type _m [16] | |
The matrix coefficients as a 1D array. | |
}; | |
The matrix coeffients. |
A 4x4 matrix.
ork::mat4< type >::mat4 | ( | type | m00, | |
type | m01, | |||
type | m02, | |||
type | m03, | |||
type | m10, | |||
type | m11, | |||
type | m12, | |||
type | m13, | |||
type | m20, | |||
type | m21, | |||
type | m22, | |||
type | m23, | |||
type | m30, | |||
type | m31, | |||
type | m32, | |||
type | m33 | |||
) | [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 in row major order.
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.
The missing components are initialized to 0 (except the w,w component, initialized to 1).
Returns the adjoint of this matrix.
Casts this matrix to another base type.
const type * ork::mat4< type >::coefficients | ( | ) | const [inline] |
Returns the coefficients of this matrix.
type ork::mat4< type >::determinant | ( | ) | const [inline] |
Returns the determinant of this matrix.
Returns the inverse of this matrix.
Returns the linear part of this matrix (i.e.
without translations).
bool ork::mat4< type >::operator!= | ( | const mat4< type > & | m2 | ) | const [inline] |
Returns true is this matrix is different from the given matrix.
Returns the product of this matrix and of the given scalar.
box3< type > ork::mat4< type >::operator* | ( | const box3< type > & | b | ) | const [inline] |
Returns the bounding box of the given bounding box, transormed by the linear transformation represented by this matrix.
vec3< type > ork::mat4< type >::operator* | ( | const vec3< type > & | v | ) | const [inline] |
Returns the product of this matrix and of the given vector.
The given vector w coordinate is set to 1, and the 4 vector result is converted to a 3 vector by dividing its xyz components by its w component.
vec4< type > ork::mat4< type >::operator* | ( | const vec4< type > & | v | ) | const [inline] |
Returns the product of this matrix and of the given vector.
mat4< type > ork::mat4< type >::operator* | ( | const mat4< type > & | m2 | ) | const [inline] |
Returns the product of this matrix and of the given matrix.
mat4< type > ork::mat4< type >::operator+ | ( | const mat4< type > & | m2 | ) | const [inline] |
Returns the sum of this matrix and of the given matrix.
mat4< type > ork::mat4< type >::operator- | ( | const mat4< type > & | m2 | ) | const [inline] |
Returns the difference of this matrix and of the given matrix.
Assigns the given matrix to this matrix.
bool ork::mat4< type >::operator== | ( | const mat4< type > & | m2 | ) | const [inline] |
Returns true is this matrix is equal to the given matrix.
const type * ork::mat4< type >::operator[] | ( | int | iRow | ) | const [inline] |
Returns the row of this matrix whose index is given.
mat4< type > ork::mat4< type >::orthoProjection | ( | type | xRight, | |
type | xLeft, | |||
type | yTop, | |||
type | yBottom, | |||
type | zNear, | |||
type | zFar | |||
) | [inline, static] |
Returns the orthographic projection matrix corresponding to the given projection parameters.
xRight | right clipping plane. | |
xLeft | left clipping plane. | |
yTop | top clipping plane. | |
yBottom | bottom clipping plane. | |
zNear | near clipping plane. | |
zFar | far clipping plane. |
mat4< type > ork::mat4< type >::perspectiveProjection | ( | type | fovy, | |
type | aspect, | |||
type | zNear, | |||
type | zFar | |||
) | [inline, static] |
Returns the perspective projection matrix corresponding to the given projection parameters.
fovy | vertical field of view in degrees. | |
aspect | aspect ratio of the projection window. | |
zNear | near clipping plane. | |
zFar | far clipping plane. |
Returns the rotation matrix corresponding to the rotation around the x axis with the given angle.
angle | rotation angle in degrees. |
Returns the rotation matrix corresponding to the rotation around the y axis with the given angle.
angle | rotation angle in degrees. |
Returns the rotation matrix corresponding to the rotation around the z axis with the given angle.
angle | rotation angle in degrees. |
mat4< type > ork::mat4< type >::translate | ( | const vec3< type > & | v | ) | [inline, static] |
Returns the translation matrix corresponding to the given translation vector.
Returns the transpose of this matrix.
union { ... } [protected] |
The matrix coeffients.
The identity matrix.