Nazara Engine
0.4
A fast, complete, cross-platform API designed for game development
|
Math class that represents a transformation of the four dimensional vector space with the notion of projectivity. More...
Public Member Functions | |
Matrix4 (T r11, T r12, T r13, T r14, T r21, T r22, T r23, T r24, T r31, T r32, T r33, T r34, T r41, T r42, T r43, T r44) | |
Constructs a Matrix4 object from its components. More... | |
Matrix4 (const T matrix[16]) | |
Constructs a Matrix4 object from an array of sixteen elements. More... | |
template<typename U > | |
Matrix4 (const Matrix4< U > &matrix) | |
Constructs a Matrix4 object from another type of Matrix4. More... | |
Matrix4 (const Matrix4 &matrix)=default | |
Matrix4 & | ApplyRotation (const Quaternion< T > &rotation) |
Apply the rotation represented by the quaternion to this matrix. More... | |
Matrix4 & | ApplyScale (const Vector3< T > &scale) |
Apply the scale represented by the vector to this matrix. More... | |
Matrix4 & | ApplyTranslation (const Vector3< T > &translation) |
Apply the translation represented by the vector to this matrix. More... | |
Matrix4 & | Concatenate (const Matrix4 &matrix) |
Concatenates this matrix to other one. More... | |
Matrix4 & | ConcatenateAffine (const Matrix4 &matrix) |
Concatenates this matrix to other one. More... | |
Vector4< T > | GetColumn (unsigned int column) const |
Gets the ith column of the matrix. More... | |
T | GetDeterminant () const |
Calcultes the determinant of this matrix. More... | |
T | GetDeterminantAffine () const |
Calcultes the determinant of this matrix. More... | |
bool | GetInverse (Matrix4 *dest) const |
Gets the inverse of this matrix. More... | |
bool | GetInverseAffine (Matrix4 *dest) const |
Gets the inverse of this matrix. More... | |
Quaternion< T > | GetRotation () const |
Gets the rotation from this matrix. More... | |
Vector4< T > | GetRow (unsigned int row) const |
Gets the ith row of the matrix. More... | |
Vector3< T > | GetScale () const |
Gets the scale from this matrix. More... | |
Vector3< T > | GetSquaredScale () const |
Gets the squared scale from this matrix. More... | |
Vector3< T > | GetTranslation () const |
Gets the translation from this matrix. More... | |
void | GetTransposed (Matrix4 *dest) const |
Gets the transposed of this matrix. More... | |
bool | HasNegativeScale () const |
Checks whetever matrix has negative scale. More... | |
bool | HasScale () const |
Checks whetever matrix has scale. More... | |
Matrix4 & | Inverse (bool *succeeded=nullptr) |
Inverts this matrix. More... | |
Matrix4 & | InverseAffine (bool *succeeded=nullptr) |
Inverts this matrix. More... | |
bool | IsAffine () const |
Checks whether the matrix is affine. More... | |
bool | IsIdentity () const |
Checks whether the matrix is identity. More... | |
Matrix4 & | MakeIdentity () |
Makes the matrix identity (with 1 on diagonal and 0 for others) More... | |
Matrix4 & | MakeLookAt (const Vector3< T > &eye, const Vector3< T > &target, const Vector3< T > &up=Vector3< T >::Up()) |
Makes the matrix a 'look at matrix'. More... | |
Matrix4 & | MakeOrtho (T left, T right, T top, T bottom, T zNear=-1.0, T zFar=1.0) |
Makes the matrix a 'orthographic matrix'. More... | |
Matrix4 & | MakePerspective (T angle, T ratio, T zNear, T zFar) |
Makes the matrix a 'perspective matrix'. More... | |
Matrix4 & | MakeRotation (const Quaternion< T > &rotation) |
Makes the matrix the representation of the quaternion. More... | |
Matrix4 & | MakeScale (const Vector3< T > &scale) |
Makes the matrix with the scale. More... | |
Matrix4 & | MakeTranslation (const Vector3< T > &translation) |
Makes the matrix with the translation. More... | |
Matrix4 & | MakeTransform (const Vector3< T > &translation, const Quaternion< T > &rotation) |
Makes the matrix with the translation and the rotation. More... | |
Matrix4 & | MakeTransform (const Vector3< T > &translation, const Quaternion< T > &rotation, const Vector3< T > &scale) |
Makes the matrix with the translation, the rotation and the scale. More... | |
Matrix4 & | MakeViewMatrix (const Vector3< T > &translation, const Quaternion< T > &rotation) |
Makes the matrix a 'view matrix'. More... | |
Matrix4 & | MakeZero () |
Makes the matrix zero (with 0 everywhere) More... | |
Matrix4 & | Set (T r11, T r12, T r13, T r14, T r21, T r22, T r23, T r24, T r31, T r32, T r33, T r34, T r41, T r42, T r43, T r44) |
Sets the components of the matrix. More... | |
Matrix4 & | Set (const T matrix[16]) |
Sets the components of the matrix from an array of sixteen elements. More... | |
Matrix4 & | Set (const Matrix4 &matrix) |
Sets the components of the matrix from another matrix. More... | |
template<typename U > | |
Matrix4 & | Set (const Matrix4< U > &matrix) |
Matrix4 & | SetRotation (const Quaternion< T > &rotation) |
Sets the components of the matrix from a quaternion. More... | |
Matrix4 & | SetScale (const Vector3< T > &scale) |
Sets the components of the matrix from a scale. More... | |
Matrix4 & | SetTranslation (const Vector3< T > &translation) |
Sets the components of the matrix from a translation. More... | |
String | ToString () const |
Gives a string representation. More... | |
Vector2< T > | Transform (const Vector2< T > &vector, T z=0.0, T w=1.0) const |
Transforms the Vector2 and two components by the matrix. More... | |
Vector3< T > | Transform (const Vector3< T > &vector, T w=1.0) const |
Transforms the Vector3 and one component by the matrix. More... | |
Vector4< T > | Transform (const Vector4< T > &vector) const |
Transforms the Vector4 by the matrix. More... | |
Matrix4 & | Transpose () |
Transposes the matrix. More... | |
operator T* () | |
Converts matrix to pointer to its own data. More... | |
operator const T * () const | |
Converts matrix to pointer to its own data. More... | |
T & | operator() (unsigned int x, unsigned int y) |
Gets the component (x, y) of the matrix. More... | |
T | operator() (unsigned int x, unsigned int y) const |
Gets the component (x, y) of the matrix. More... | |
Matrix4 & | operator= (const Matrix4 &matrix)=default |
Matrix4 | operator* (const Matrix4 &matrix) const |
Multiplies the components of the matrix with other matrix. More... | |
Vector2< T > | operator* (const Vector2< T > &vector) const |
Multiplies the components of the matrix with a vector. More... | |
Vector3< T > | operator* (const Vector3< T > &vector) const |
Multiplies the components of the matrix with a vector. More... | |
Vector4< T > | operator* (const Vector4< T > &vector) const |
Multiplies the components of the matrix with a vector. More... | |
Matrix4 | operator* (T scalar) const |
Multiplies the components of the matrix with a scalar. More... | |
Matrix4 & | operator*= (const Matrix4 &matrix) |
Multiplies this matrix with another one. More... | |
Matrix4 & | operator*= (T scalar) |
Multiplies the components of the matrix with a scalar. More... | |
bool | operator== (const Matrix4 &mat) const |
Compares the matrix to other one. More... | |
bool | operator!= (const Matrix4 &mat) const |
Compares the matrix to other one. More... | |
template<typename U > | |
Matrix4< T > & | Set (const Matrix4< U > &matrix) |
Sets the components of the matrix from another type of Matrix4. More... | |
Static Public Member Functions | |
static Matrix4 | Concatenate (const Matrix4 &left, const Matrix4 &right) |
Shorthand for the concatenation of two matrices. More... | |
static Matrix4 | ConcatenateAffine (const Matrix4 &left, const Matrix4 &right) |
Shorthand for the concatenation of two affine matrices. More... | |
static Matrix4 | Identity () |
Shorthand for the identity matrix. More... | |
static Matrix4 | LookAt (const Vector3< T > &eye, const Vector3< T > &target, const Vector3< T > &up=Vector3< T >::Up()) |
Shorthand for the 'look at' matrix. More... | |
static Matrix4 | Ortho (T left, T right, T top, T bottom, T zNear=-1.0, T zFar=1.0) |
Shorthand for the 'orthographic' matrix. More... | |
static Matrix4 | Perspective (T angle, T ratio, T zNear, T zFar) |
Shorthand for the 'perspective' matrix. More... | |
static Matrix4 | Rotate (const Quaternion< T > &rotation) |
Shorthand for the 'rotation' matrix. More... | |
static Matrix4 | Scale (const Vector3< T > &scale) |
Shorthand for the 'scale' matrix. More... | |
static Matrix4 | Translate (const Vector3< T > &translation) |
Shorthand for the 'translation' matrix. More... | |
static Matrix4 | Transform (const Vector3< T > &translation, const Quaternion< T > &rotation) |
Shorthand for the 'transform' matrix. More... | |
static Matrix4 | Transform (const Vector3< T > &translation, const Quaternion< T > &rotation, const Vector3< T > &scale) |
Shorthand for the 'transform' matrix. More... | |
static Matrix4 | ViewMatrix (const Vector3< T > &translation, const Quaternion< T > &rotation) |
Shorthand for the 'view' matrix. More... | |
static Matrix4 | Zero () |
Shorthand for the 'zero' matrix. More... | |
Public Attributes | |
T | m11 |
T | m12 |
T | m13 |
T | m14 |
T | m21 |
T | m22 |
T | m23 |
T | m24 |
T | m31 |
T | m32 |
T | m33 |
T | m34 |
T | m41 |
T | m42 |
T | m43 |
T | m44 |
Math class that represents a transformation of the four dimensional vector space with the notion of projectivity.
Nz::Matrix4< T >::Matrix4 | ( | T | r11, |
T | r12, | ||
T | r13, | ||
T | r14, | ||
T | r21, | ||
T | r22, | ||
T | r23, | ||
T | r24, | ||
T | r31, | ||
T | r32, | ||
T | r33, | ||
T | r34, | ||
T | r41, | ||
T | r42, | ||
T | r43, | ||
T | r44 | ||
) |
Constructs a Matrix4 object from its components.
rIJ | Matrix components at index(I, J) |
Nz::Matrix4< T >::Matrix4 | ( | const T | matrix[16] | ) |
Constructs a Matrix4 object from an array of sixteen elements.
matrix[16] | Matrix components |
|
explicit |
Matrix4< T > & Nz::Matrix4< T >::ApplyRotation | ( | const Quaternion< T > & | rotation | ) |
Apply the rotation represented by the quaternion to this matrix.
rotation | Quaternion representing a rotation of space |
Matrix4< T > & Nz::Matrix4< T >::ApplyScale | ( | const Vector3< T > & | scale | ) |
Apply the scale represented by the vector to this matrix.
scale | Vector3 representing the homothety |
Matrix4< T > & Nz::Matrix4< T >::ApplyTranslation | ( | const Vector3< T > & | translation | ) |
Apply the translation represented by the vector to this matrix.
translation | Vector3 representing the translation |
Matrix4< T > & Nz::Matrix4< T >::Concatenate | ( | const Matrix4< T > & | matrix | ) |
Concatenates this matrix to other one.
matrix | Matrix to multiply with |
|
static |
Shorthand for the concatenation of two matrices.
left | Left-hand side matrix |
right | Right-hand side matrix |
Matrix4< T > & Nz::Matrix4< T >::ConcatenateAffine | ( | const Matrix4< T > & | matrix | ) |
Concatenates this matrix to other one.
matrix | Matrix to multiply with |
|
static |
Shorthand for the concatenation of two affine matrices.
left | Left-hand side matrix |
right | Right-hand side matrix |
Vector4< T > Nz::Matrix4< T >::GetColumn | ( | unsigned int | column | ) | const |
Gets the ith column of the matrix.
column | Index of the column you want |
std::out_of_range | if NAZARA_MATH_SAFE is defined and if you try to access index greater than 3 |
FIXME: Est-ce une bonne idée de gérer la matrice de cette façon ?
T Nz::Matrix4< T >::GetDeterminant | ( | ) | const |
Calcultes the determinant of this matrix.
T Nz::Matrix4< T >::GetDeterminantAffine | ( | ) | const |
Calcultes the determinant of this matrix.
bool Nz::Matrix4< T >::GetInverse | ( | Matrix4< T > * | dest | ) | const |
Gets the inverse of this matrix.
dest | Matrix to put the result |
bool Nz::Matrix4< T >::GetInverseAffine | ( | Matrix4< T > * | dest | ) | const |
Gets the inverse of this matrix.
dest | Matrix to put the result |
Quaternion< T > Nz::Matrix4< T >::GetRotation | ( | ) | const |
Gets the rotation from this matrix.
Vector4< T > Nz::Matrix4< T >::GetRow | ( | unsigned int | row | ) | const |
Gets the ith row of the matrix.
row | Index of the row you want |
std::out_of_range | if NAZARA_MATH_SAFE is defined and if you try to access index greater than 3 |
FIXME: Est-ce une bonne idée de gérer la matrice de cette façon ?
Vector3< T > Nz::Matrix4< T >::GetScale | ( | ) | const |
Gets the scale from this matrix.
Vector3< T > Nz::Matrix4< T >::GetSquaredScale | ( | ) | const |
Vector3< T > Nz::Matrix4< T >::GetTranslation | ( | ) | const |
Gets the translation from this matrix.
void Nz::Matrix4< T >::GetTransposed | ( | Matrix4< T > * | dest | ) | const |
Gets the transposed of this matrix.
dest | Matrix to put the result |
bool Nz::Matrix4< T >::HasNegativeScale | ( | ) | const |
Checks whetever matrix has negative scale.
bool Nz::Matrix4< T >::HasScale | ( | ) | const |
|
static |
Shorthand for the identity matrix.
Matrix4< T > & Nz::Matrix4< T >::Inverse | ( | bool * | succeeded = nullptr | ) |
Inverts this matrix.
succeeded | Optional argument to know if matrix has been successfully inverted |
Matrix4< T > & Nz::Matrix4< T >::InverseAffine | ( | bool * | succeeded = nullptr | ) |
Inverts this matrix.
succeeded | Optional argument to know if matrix has been successfully inverted |
bool Nz::Matrix4< T >::IsAffine | ( | ) | const |
Checks whether the matrix is affine.
bool Nz::Matrix4< T >::IsIdentity | ( | ) | const |
Checks whether the matrix is identity.
|
static |
Shorthand for the 'look at' matrix.
eye | Position of the camera |
target | Position of the target of the camera |
up | Direction of up vector according to the orientation of camera |
Matrix4< T > & Nz::Matrix4< T >::MakeIdentity | ( | ) |
Makes the matrix identity (with 1 on diagonal and 0 for others)
Matrix4< T > & Nz::Matrix4< T >::MakeLookAt | ( | const Vector3< T > & | eye, |
const Vector3< T > & | target, | ||
const Vector3< T > & | up = Vector3<T>::Up() |
||
) |
Makes the matrix a 'look at matrix'.
eye | Position of the camera |
target | Position of the target of the camera |
up | Direction of up vector according to the orientation of camera |
Matrix4< T > & Nz::Matrix4< T >::MakeOrtho | ( | T | left, |
T | right, | ||
T | top, | ||
T | bottom, | ||
T | zNear = -1.0 , |
||
T | zFar = 1.0 |
||
) |
Makes the matrix a 'orthographic matrix'.
left | Distance between center and left |
right | Distance between center and right |
top | Distance between center and top |
bottom | Distance between center and bottom |
zNear | Distance where 'vision' begins |
zFar | Distance where 'vision' ends |
Matrix4< T > & Nz::Matrix4< T >::MakePerspective | ( | T | angle, |
T | ratio, | ||
T | zNear, | ||
T | zFar | ||
) |
Makes the matrix a 'perspective matrix'.
angle | Unit depends on NAZARA_MATH_ANGLE_RADIAN |
ratio | Rendering ratio (typically 16/9 or 4/3) |
zNear | Distance where 'vision' begins |
zFar | Distance where 'vision' ends |
Matrix4< T > & Nz::Matrix4< T >::MakeRotation | ( | const Quaternion< T > & | rotation | ) |
Makes the matrix the representation of the quaternion.
rotation | Quaternion representing a rotation of space |
Matrix4< T > & Nz::Matrix4< T >::MakeScale | ( | const Vector3< T > & | scale | ) |
Matrix4< T > & Nz::Matrix4< T >::MakeTransform | ( | const Vector3< T > & | translation, |
const Quaternion< T > & | rotation | ||
) |
Makes the matrix with the translation and the rotation.
translation | Vector3 representing the translation |
rotation | Quaternion representing a rotation of space |
Matrix4< T > & Nz::Matrix4< T >::MakeTransform | ( | const Vector3< T > & | translation, |
const Quaternion< T > & | rotation, | ||
const Vector3< T > & | scale | ||
) |
Makes the matrix with the translation, the rotation and the scale.
translation | Vector3 representing the translation |
rotation | Quaternion representing a rotation of space |
scale | Vector3 representing the homothety |
Matrix4< T > & Nz::Matrix4< T >::MakeTranslation | ( | const Vector3< T > & | translation | ) |
Matrix4< T > & Nz::Matrix4< T >::MakeViewMatrix | ( | const Vector3< T > & | translation, |
const Quaternion< T > & | rotation | ||
) |
Makes the matrix a 'view matrix'.
translation | Vector3 representing the translation |
rotation | Quaternion representing a rotation of space |
Matrix4< T > & Nz::Matrix4< T >::MakeZero | ( | ) |
Makes the matrix zero (with 0 everywhere)
Nz::Matrix4< T >::operator const T * | ( | ) | const |
Converts matrix to pointer to its own data.
Nz::Matrix4< T >::operator T* | ( | ) |
Converts matrix to pointer to its own data.
bool Nz::Matrix4< T >::operator!= | ( | const Matrix4< T > & | mat | ) | const |
Compares the matrix to other one.
mat | Other matrix to compare with |
T & Nz::Matrix4< T >::operator() | ( | unsigned int | x, |
unsigned int | y | ||
) |
Gets the component (x, y) of the matrix.
std::out_of_range | if NAZARA_MATH_SAFE is defined and if you try to access index greater than 3 for x or y |
T Nz::Matrix4< T >::operator() | ( | unsigned int | x, |
unsigned int | y | ||
) | const |
Gets the component (x, y) of the matrix.
std::out_of_range | if NAZARA_MATH_SAFE is defined and if you try to access index greater than 3 for x or y |
Matrix4< T > Nz::Matrix4< T >::operator* | ( | const Matrix4< T > & | matrix | ) | const |
Multiplies the components of the matrix with other matrix.
matrix | The other matrix to multiply components with |
Vector2< T > Nz::Matrix4< T >::operator* | ( | const Vector2< T > & | vector | ) | const |
Multiplies the components of the matrix with a vector.
vector | The vector to multiply the matrix with |
Vector3< T > Nz::Matrix4< T >::operator* | ( | const Vector3< T > & | vector | ) | const |
Multiplies the components of the matrix with a vector.
vector | The vector to multiply the matrix with |
Vector4< T > Nz::Matrix4< T >::operator* | ( | const Vector4< T > & | vector | ) | const |
Multiplies the components of the matrix with a vector.
vector | The vector to multiply the matrix with |
Matrix4< T > Nz::Matrix4< T >::operator* | ( | T | scalar | ) | const |
Multiplies the components of the matrix with a scalar.
scalar | The scalar to multiply the matrix'components with |
Matrix4< T > & Nz::Matrix4< T >::operator*= | ( | const Matrix4< T > & | matrix | ) |
Multiplies this matrix with another one.
matrix | The matrix to multiply with |
Matrix4< T > & Nz::Matrix4< T >::operator*= | ( | T | scalar | ) |
Multiplies the components of the matrix with a scalar.
scalar | The scalar to multiply with |
bool Nz::Matrix4< T >::operator== | ( | const Matrix4< T > & | mat | ) | const |
Compares the matrix to other one.
mat | Other matrix to compare with |
|
static |
Shorthand for the 'orthographic' matrix.
left | Distance between center and left |
right | Distance between center and right |
top | Distance between center and top |
bottom | Distance between center and bottom |
zNear | Distance where 'vision' begins |
zFar | Distance where 'vision' ends |
|
static |
Shorthand for the 'perspective' matrix.
angle | Unit depends on NAZARA_MATH_ANGLE_RADIAN |
ratio | Rendering ratio (typically 16/9 or 4/3) |
zNear | Distance where 'vision' begins |
zFar | Distance where 'vision' ends |
|
static |
Shorthand for the 'rotation' matrix.
rotation | Quaternion representing a rotation of space |
|
static |
Matrix4< T > & Nz::Matrix4< T >::Set | ( | T | r11, |
T | r12, | ||
T | r13, | ||
T | r14, | ||
T | r21, | ||
T | r22, | ||
T | r23, | ||
T | r24, | ||
T | r31, | ||
T | r32, | ||
T | r33, | ||
T | r34, | ||
T | r41, | ||
T | r42, | ||
T | r43, | ||
T | r44 | ||
) |
Sets the components of the matrix.
rIJ | Matrix components at index(I, J) |
Matrix4< T > & Nz::Matrix4< T >::Set | ( | const T | matrix[16] | ) |
Sets the components of the matrix from an array of sixteen elements.
matrix[16] | Matrix components |
Matrix4< T > & Nz::Matrix4< T >::Set | ( | const Matrix4< T > & | matrix | ) |
Sets the components of the matrix from another matrix.
matrix | The other matrix |
Matrix4<T>& Nz::Matrix4< T >::Set | ( | const Matrix4< U > & | matrix | ) |
Matrix4< T > & Nz::Matrix4< T >::SetRotation | ( | const Quaternion< T > & | rotation | ) |
Sets the components of the matrix from a quaternion.
rotation | Quaternion representing a rotation of space |
Matrix4< T > & Nz::Matrix4< T >::SetScale | ( | const Vector3< T > & | scale | ) |
Matrix4< T > & Nz::Matrix4< T >::SetTranslation | ( | const Vector3< T > & | translation | ) |
String Nz::Matrix4< T >::ToString | ( | ) | const |
Gives a string representation.
Vector2< T > Nz::Matrix4< T >::Transform | ( | const Vector2< T > & | vector, |
T | z = 0.0 , |
||
T | w = 1.0 |
||
) | const |
Vector3< T > Nz::Matrix4< T >::Transform | ( | const Vector3< T > & | vector, |
T | w = 1.0 |
||
) | const |
Vector4< T > Nz::Matrix4< T >::Transform | ( | const Vector4< T > & | vector | ) | const |
|
static |
Shorthand for the 'transform' matrix.
translation | Vector3 representing the translation |
rotation | Quaternion representing a rotation of space |
|
static |
Shorthand for the 'transform' matrix.
translation | Vector3 representing the translation |
rotation | Quaternion representing a rotation of space |
scale | Vector3 representing the homothety |
|
static |
Shorthand for the 'translation' matrix.
translation | Vector3 representing the translation |
Matrix4< T > & Nz::Matrix4< T >::Transpose | ( | ) |
|
static |
Shorthand for the 'view' matrix.
translation | Vector3 representing the translation |
rotation | Quaternion representing a rotation of space |
|
static |