A matrix of 16 values for 3d calculations in homogeneous coordinates. More...
Classes | |
struct | Interpolator |
Struct performing interpolation between two matrices. More... | |
Public Member Functions | |
Matrix4 () | |
Creates an uninitialized matrix. More... | |
Matrix4 (int i) | |
Creates a unit matrix. More... | |
Matrix4 (const Matrix4< T > &x) | |
Copy constructor. More... | |
template<class T2 > | |
Matrix4 (const Matrix4< T2 > &x) | |
Copy constructor. More... | |
template<class T2 , class M2 > | |
Matrix4 (const Vector4< T2, M2 > &v0, const Vector4< T2, M2 > &v1, const Vector4< T2, M2 > &v2, const Vector4< T2, M2 > &v3=Vector4< T2, M2 >(0, 0, 0, 1)) | |
Creates matrix from three or four column vectors. More... | |
template<class T2 , class M2 > | |
Matrix4 (const Vector3< T2, M2 > &v0, const Vector3< T2, M2 > &v1, const Vector3< T2, M2 > &v2, const Vector3< T2, M2 > &v3=Vector3< T2, M2 >(0, 0, 0)) | |
Creates matrix from three or four column vectors. More... | |
template<class S > | |
Matrix4 (S m00, S m01, S m02, S m03, S m10, S m11, S m12, S m13, S m20, S m21, S m22, S m23, S m30, S m31, S m32, S m33) | |
Creates matrix from elements specified in row-major order. More... | |
template<class T2 , class M2 > | |
Matrix4 (const Matrix3< T2, M2 > &x) | |
Casting from Matrix3. More... | |
template<class T2 , class M2 > | |
Matrix4 (const Quaternion< T2, M2 > &q) | |
Casting from Quaternion. More... | |
void | loadIdentity () |
Make this matrix identity, i.e. More... | |
Matrix3< T, M > | getScaleRotation () const |
Vector3< T, M > | getTranslation () const |
bool | separate (Vector3< T, M > &scale, Matrix3< T, M > &rotation, Vector3< T, M > &translation) const |
Separates the transform represented by this matrix into scale, translation and rotation. More... | |
Matrix4< T, M > | transpose () const |
Creates a transposed version of the matrix. More... | |
T | determinant () const |
Calculates the determinant. More... | |
Matrix4< T, M > | comatrix () const |
Calculates the comatrix. More... | |
Matrix4< T, M > | inverse () const |
Returns the inverse of the matrix. More... | |
Matrix4< T, M > | affineInverse () const |
Returns the inverse of the affine matrix. More... | |
Matrix4< T, M > & | operator= (const Matrix4< T, M > &o) |
Copy operator. More... | |
template<class T2 , class M2 > | |
Matrix4< T, M > & | operator= (const Matrix4< T2, M2 > &o) |
Copy operator. More... | |
operator const T * () const | |
Casts this matrix to an array representation. More... | |
operator T * () | |
Casts this matrix to an array representation. More... | |
const T & | operator() (int i, int j) const |
Index access (row,col) More... | |
const T & | operator[] (int i) const |
Index operator. More... | |
T & | operator() (int i, int j) |
Index access (row,col) More... | |
T & | operator[] (int i) |
Index operator. More... | |
Static Public Member Functions | |
template<class T2 , class M2 > | |
static Matrix4< T, M > | fromTranslation (const Vector3< T2, M2 > &v) |
Creates a translating matrix. More... | |
template<class S > | |
static Matrix4< T, M > | fromArrayRM (const S *ma) |
Create a matrix from a array representation of an array in row-major mode. More... | |
template<class S > | |
static Matrix4< T, M > | fromArrayCM (const S *ma) |
Create a matrix from a array representation of an array in column-major mode. More... | |
Public Attributes | |
T | m [16] |
Matrix cell data. More... | |
A matrix of 16 values for 3d calculations in homogeneous coordinates.
Observe that the data is stored in column-major mode for easy interfacing with OpenGL. The interfaces are specified in row-major mode (for example the constructor and print operator).
|
inline |
Creates an uninitialized matrix.
|
inlineexplicit |
Creates a unit matrix.
References a3d::Matrix4< T, M >::loadIdentity().
|
inline |
Copy constructor.
References a3d::Matrix4< T, M >::m.
|
inline |
Copy constructor.
References a3d::Matrix4< T, M >::m.
|
inline |
Creates matrix from three or four column vectors.
References a3d::Matrix4< T, M >::m.
|
inline |
Creates matrix from three or four column vectors.
References a3d::Matrix4< T, M >::m.
|
inline |
Creates matrix from elements specified in row-major order.
References a3d::Matrix4< T, M >::m.
|
inlineexplicit |
Casting from Matrix3.
References a3d::Matrix3< T, M >::m, and a3d::Matrix4< T, M >::m.
|
inlineexplicit |
Casting from Quaternion.
References a3d::Matrix4< T, M >::m, a3d::Quaternion< T, M >::s, and a3d::Quaternion< T, M >::v.
|
inline |
Returns the inverse of the affine matrix.
This function will produce an unknown result if applied to a matrix that does not represent an affine transform.
References a3d::Matrix4< T, M >::fromTranslation(), a3d::Matrix4< T, M >::getScaleRotation(), and a3d::Matrix4< T, M >::getTranslation().
|
inline |
Calculates the comatrix.
References A3D_WARNING_EXPENSIVE, and a3d::Matrix4< T, M >::m.
Referenced by a3d::Matrix4< T, M >::inverse().
|
inline |
Calculates the determinant.
References A3D_WARNING_EXPENSIVE, and a3d::Matrix4< T, M >::m.
Referenced by a3d::Matrix4< T, M >::inverse().
|
inlinestatic |
Create a matrix from a array representation of an array in column-major mode.
[ (00), (10), (20), (30), (01), ... ]
|
inlinestatic |
Create a matrix from a array representation of an array in row-major mode.
[ (00), (01), (02), (03), (10), ... ]
|
inlinestatic |
Creates a translating matrix.
Referenced by a3d::Matrix4< T, M >::affineInverse().
|
inline |
References a3d::Matrix4< T, M >::m.
Referenced by a3d::Matrix4< T, M >::affineInverse().
|
inline |
References a3d::Matrix4< T, M >::m.
Referenced by a3d::Matrix4< T, M >::affineInverse().
|
inline |
Returns the inverse of the matrix.
This function is not optimized and is therefore extremely inefficient.
References A3D_WARNING_EXPENSIVE, a3d::Matrix4< T, M >::comatrix(), and a3d::Matrix4< T, M >::determinant().
Referenced by a3d::Vector3< T, M >::fromScreenPosition().
|
inline |
Make this matrix identity, i.e.
ones in diagonal.
References a3d::Matrix4< T, M >::m.
Referenced by a3d::Matrix4< T, M >::Matrix4().
|
inline |
Casts this matrix to an array representation.
This makes it possible to provide for example a float matrix as an array argument in for example OpenGL.
References a3d::Matrix4< T, M >::m.
|
inline |
Casts this matrix to an array representation.
This makes it possible to provide for example a float matrix as an array argument in for example OpenGL. Anything written in the returned array will end up in the matrix.
References a3d::Matrix4< T, M >::m.
|
inline |
Index access (row,col)
References a3d::Matrix4< T, M >::m.
|
inline |
Index access (row,col)
References a3d::Matrix4< T, M >::m.
|
inline |
Copy operator.
References a3d::Matrix4< T, M >::m.
|
inline |
Copy operator.
References a3d::Matrix4< T, M >::m.
|
inline |
|
inline |
|
inline |
Separates the transform represented by this matrix into scale, translation and rotation.
Referenced by a3d::Matrix4< T, M >::Interpolator::Interpolator().
|
inline |
Creates a transposed version of the matrix.
References a3d::Matrix4< T, M >::m.
T a3d::Matrix4< T, M >::m[16] |
Matrix cell data.
Referenced by a3d::Matrix4< T, M >::comatrix(), a3d::Matrix4< T, M >::determinant(), a3d::Matrix4< T, M >::getScaleRotation(), a3d::Matrix4< T, M >::getTranslation(), a3d::Matrix4< T, M >::loadIdentity(), a3d::Matrix3< T, M >::Matrix3(), a3d::Matrix4< T, M >::Matrix4(), a3d::Matrix4< T, M >::operator const T *(), a3d::Matrix4< T, M >::operator T *(), a3d::Matrix4< T, M >::Interpolator::operator()(), a3d::Matrix4< T, M >::operator()(), a3d::Matrix4< T, M >::operator=(), a3d::Matrix4< T, M >::operator[](), and a3d::Matrix4< T, M >::transpose().