Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::Matrix4< T > Class Template Reference

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
 
Matrix4ApplyRotation (const Quaternion< T > &rotation)
 Apply the rotation represented by the quaternion to this matrix. More...
 
Matrix4ApplyScale (const Vector3< T > &scale)
 Apply the scale represented by the vector to this matrix. More...
 
Matrix4ApplyTranslation (const Vector3< T > &translation)
 Apply the translation represented by the vector to this matrix. More...
 
Matrix4Concatenate (const Matrix4 &matrix)
 Concatenates this matrix to other one. More...
 
Matrix4ConcatenateAffine (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...
 
GetDeterminant () const
 Calcultes the determinant of this matrix. More...
 
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...
 
Matrix4Inverse (bool *succeeded=nullptr)
 Inverts this matrix. More...
 
Matrix4InverseAffine (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...
 
Matrix4MakeIdentity ()
 Makes the matrix identity (with 1 on diagonal and 0 for others) More...
 
Matrix4MakeLookAt (const Vector3< T > &eye, const Vector3< T > &target, const Vector3< T > &up=Vector3< T >::Up())
 Makes the matrix a 'look at matrix'. More...
 
Matrix4MakeOrtho (T left, T right, T top, T bottom, T zNear=-1.0, T zFar=1.0)
 Makes the matrix a 'orthographic matrix'. More...
 
Matrix4MakePerspective (T angle, T ratio, T zNear, T zFar)
 Makes the matrix a 'perspective matrix'. More...
 
Matrix4MakeRotation (const Quaternion< T > &rotation)
 Makes the matrix the representation of the quaternion. More...
 
Matrix4MakeScale (const Vector3< T > &scale)
 Makes the matrix with the scale. More...
 
Matrix4MakeTranslation (const Vector3< T > &translation)
 Makes the matrix with the translation. More...
 
Matrix4MakeTransform (const Vector3< T > &translation, const Quaternion< T > &rotation)
 Makes the matrix with the translation and the rotation. More...
 
Matrix4MakeTransform (const Vector3< T > &translation, const Quaternion< T > &rotation, const Vector3< T > &scale)
 Makes the matrix with the translation, the rotation and the scale. More...
 
Matrix4MakeViewMatrix (const Vector3< T > &translation, const Quaternion< T > &rotation)
 Makes the matrix a 'view matrix'. More...
 
Matrix4MakeZero ()
 Makes the matrix zero (with 0 everywhere) More...
 
Matrix4Set (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...
 
Matrix4Set (const T matrix[16])
 Sets the components of the matrix from an array of sixteen elements. More...
 
Matrix4Set (const Matrix4 &matrix)
 Sets the components of the matrix from another matrix. More...
 
template<typename U >
Matrix4Set (const Matrix4< U > &matrix)
 
Matrix4SetRotation (const Quaternion< T > &rotation)
 Sets the components of the matrix from a quaternion. More...
 
Matrix4SetScale (const Vector3< T > &scale)
 Sets the components of the matrix from a scale. More...
 
Matrix4SetTranslation (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...
 
Matrix4Transpose ()
 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...
 
operator() (unsigned int x, unsigned int y) const
 Gets the component (x, y) of the matrix. More...
 
Matrix4operator= (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...
 
Matrix4operator*= (const Matrix4 &matrix)
 Multiplies this matrix with another one. More...
 
Matrix4operator*= (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

m11
 
m12
 
m13
 
m14
 
m21
 
m22
 
m23
 
m24
 
m31
 
m32
 
m33
 
m34
 
m41
 
m42
 
m43
 
m44
 

Detailed Description

template<typename T>
class Nz::Matrix4< T >

Math class that represents a transformation of the four dimensional vector space with the notion of projectivity.

Remarks
Matrix4 is said to be "row-major" and affine if last column is made of (0, 0, 0, 1)

Constructor & Destructor Documentation

◆ Matrix4() [1/3]

template<typename T>
Nz::Matrix4< T >::Matrix4 ( r11,
r12,
r13,
r14,
r21,
r22,
r23,
r24,
r31,
r32,
r33,
r34,
r41,
r42,
r43,
r44 
)

Constructs a Matrix4 object from its components.

Parameters
rIJMatrix components at index(I, J)

◆ Matrix4() [2/3]

template<typename T>
Nz::Matrix4< T >::Matrix4 ( const T  matrix[16])

Constructs a Matrix4 object from an array of sixteen elements.

Parameters
matrix[16]Matrix components

◆ Matrix4() [3/3]

template<typename T >
template<typename U >
Nz::Matrix4< T >::Matrix4 ( const Matrix4< U > &  matrix)
explicit

Constructs a Matrix4 object from another type of Matrix4.

Parameters
matrixMatrix4 of type U to convert to type T

Member Function Documentation

◆ ApplyRotation()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::ApplyRotation ( const Quaternion< T > &  rotation)

Apply the rotation represented by the quaternion to this matrix.

Returns
A reference to this matrix which has been rotated
Parameters
rotationQuaternion representing a rotation of space

◆ ApplyScale()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::ApplyScale ( const Vector3< T > &  scale)

Apply the scale represented by the vector to this matrix.

Returns
A reference to this matrix which has been scaled
Parameters
scaleVector3 representing the homothety

◆ ApplyTranslation()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::ApplyTranslation ( const Vector3< T > &  translation)

Apply the translation represented by the vector to this matrix.

Returns
A reference to this matrix which has been translated
Parameters
translationVector3 representing the translation

◆ Concatenate() [1/2]

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::Concatenate ( const Matrix4< T > &  matrix)

Concatenates this matrix to other one.

Returns
A reference to this matrix which is the product with other one
Parameters
matrixMatrix to multiply with
Remarks
if NAZARA_MATH_MATRIX4_CHECK_AFFINE is defined, ConcatenateAffine is called
See also
ConcatenateAffine

◆ Concatenate() [2/2]

template<typename T >
Matrix4< T > Nz::Matrix4< T >::Concatenate ( const Matrix4< T > &  left,
const Matrix4< T > &  right 
)
static

Shorthand for the concatenation of two matrices.

Returns
A Matrix4 which is the product of two
Parameters
leftLeft-hand side matrix
rightRight-hand side matrix
See also
Concatenate

◆ ConcatenateAffine() [1/2]

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::ConcatenateAffine ( const Matrix4< T > &  matrix)

Concatenates this matrix to other one.

Returns
A reference to this matrix which is the product with other one
Parameters
matrixMatrix to multiply with
Remarks
if NAZARA_DEBUG is defined and matrices are not affine, a NazaraWarning is produced and Concatenate is called
See also
Concatenate

◆ ConcatenateAffine() [2/2]

template<typename T >
Matrix4< T > Nz::Matrix4< T >::ConcatenateAffine ( const Matrix4< T > &  left,
const Matrix4< T > &  right 
)
static

Shorthand for the concatenation of two affine matrices.

Returns
A Matrix4 which is the product of two
Parameters
leftLeft-hand side matrix
rightRight-hand side matrix
See also
ConcatenateAffine

◆ GetColumn()

template<typename T >
Vector4< T > Nz::Matrix4< T >::GetColumn ( unsigned int  column) const

Gets the ith column of the matrix.

Returns
Vector4 which is the transformation of this axis
Parameters
columnIndex of the column you want
Remarks
Produce a NazaraError if you try to access index greater than 3 with NAZARA_MATH_SAFE defined
Exceptions
std::out_of_rangeif 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 ?

◆ GetDeterminant()

template<typename T >
T Nz::Matrix4< T >::GetDeterminant ( ) const

Calcultes the determinant of this matrix.

Returns
The value of the determinant
Remarks
if NAZARA_MATH_MATRIX4_CHECK_AFFINE is defined, GetDeterminantAffine is called
See also
GetDeterminantAffine

◆ GetDeterminantAffine()

template<typename T >
T Nz::Matrix4< T >::GetDeterminantAffine ( ) const

Calcultes the determinant of this matrix.

Returns
The value of the determinant
Remarks
if NAZARA_DEBUG is defined and matrix is not affine, a NazaraWarning is produced and GetDeterminant is called
See also
GetDeterminant

◆ GetInverse()

template<typename T >
bool Nz::Matrix4< T >::GetInverse ( Matrix4< T > *  dest) const

Gets the inverse of this matrix.

Returns
true if matrix can be inverted
Parameters
destMatrix to put the result
Remarks
You can call this method on the same object
if NAZARA_MATH_MATRIX4_CHECK_AFFINE is defined, GetInverseAffine is called
if NAZARA_DEBUG is defined, a NazaraError is produced if dest is null and false is returned
See also
GetInverseAffine

◆ GetInverseAffine()

template<typename T >
bool Nz::Matrix4< T >::GetInverseAffine ( Matrix4< T > *  dest) const

Gets the inverse of this matrix.

Returns
true if matrix can be inverted
Parameters
destMatrix to put the result
Remarks
You can call this method on the same object
if NAZARA_DEBUG is defined and matrix is not affine, a NazaraWarning is produced and GetInverse is called
if NAZARA_DEBUG is defined, a NazaraError is produced if dest is null and false is returned
See also
GetInverse

◆ GetRotation()

template<typename T >
Quaternion< T > Nz::Matrix4< T >::GetRotation ( ) const

Gets the rotation from this matrix.

Returns
Quaternion which is the representation of the rotation in this matrix

◆ GetRow()

template<typename T >
Vector4< T > Nz::Matrix4< T >::GetRow ( unsigned int  row) const

Gets the ith row of the matrix.

Returns
Vector4 which is the ith row of the matrix
Parameters
rowIndex of the row you want
Remarks
Produce a NazaraError if you try to access index greater than 3 with NAZARA_MATH_SAFE defined
Exceptions
std::out_of_rangeif 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 ?

◆ GetScale()

template<typename T >
Vector3< T > Nz::Matrix4< T >::GetScale ( ) const

Gets the scale from this matrix.

Returns
Vector3 which is the representation of the scale in this matrix
See also
GetSquaredScale

◆ GetSquaredScale()

template<typename T >
Vector3< T > Nz::Matrix4< T >::GetSquaredScale ( ) const

Gets the squared scale from this matrix.

Returns
Vector3 which is the representation of the squared scale in this matrix
See also
GetScale

◆ GetTranslation()

template<typename T >
Vector3< T > Nz::Matrix4< T >::GetTranslation ( ) const

Gets the translation from this matrix.

Returns
Vector3 which is the representation of the translation in this matrix

◆ GetTransposed()

template<typename T >
void Nz::Matrix4< T >::GetTransposed ( Matrix4< T > *  dest) const

Gets the transposed of this matrix.

Parameters
destMatrix to put the result
Remarks
You can call this method on the same object
if NAZARA_DEBUG is defined, a NazaraError is produced if dest is null and dest is not changed
See also
Transpose

◆ HasNegativeScale()

template<typename T >
bool Nz::Matrix4< T >::HasNegativeScale ( ) const

Checks whetever matrix has negative scale.

Returns
true if determinant is negative
See also
GetDeterminant

◆ HasScale()

template<typename T >
bool Nz::Matrix4< T >::HasScale ( ) const

Checks whetever matrix has scale.

Returns
true if determinant has scale
See also
HasNegativeScale

◆ Identity()

template<typename T >
Matrix4< T > Nz::Matrix4< T >::Identity ( )
static

Shorthand for the identity matrix.

Returns
A Matrix4 which is the identity matrix
See also
MakeIdentity

◆ Inverse()

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::Inverse ( bool *  succeeded = nullptr)

Inverts this matrix.

Returns
A reference to this matrix inverted
Parameters
succeededOptional argument to know if matrix has been successfully inverted
See also
InverseAffine

◆ InverseAffine()

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::InverseAffine ( bool *  succeeded = nullptr)

Inverts this matrix.

Returns
A reference to this matrix inverted
Parameters
succeededOptional argument to know if matrix has been successfully inverted
See also
Inverse

◆ IsAffine()

template<typename T >
bool Nz::Matrix4< T >::IsAffine ( ) const

Checks whether the matrix is affine.

Returns
true if matrix is affine

◆ IsIdentity()

template<typename T >
bool Nz::Matrix4< T >::IsIdentity ( ) const

Checks whether the matrix is identity.

Returns
true if matrix is identity

◆ LookAt()

template<typename T>
Matrix4< T > Nz::Matrix4< T >::LookAt ( const Vector3< T > &  eye,
const Vector3< T > &  target,
const Vector3< T > &  up = Vector3<T>::Up() 
)
static

Shorthand for the 'look at' matrix.

Returns
A Matrix4 which is the 'look at' matrix
Parameters
eyePosition of the camera
targetPosition of the target of the camera
upDirection of up vector according to the orientation of camera
See also
MakeLookAt

◆ MakeIdentity()

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::MakeIdentity ( )

Makes the matrix identity (with 1 on diagonal and 0 for others)

Returns
A reference to this matrix with components (1 on diagonal and 0 for others)
See also
Identity

◆ MakeLookAt()

template<typename T>
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'.

Returns
A reference to this matrix transformed in 'look at matrix'
Parameters
eyePosition of the camera
targetPosition of the target of the camera
upDirection of up vector according to the orientation of camera
See also
LookAt

◆ MakeOrtho()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::MakeOrtho ( left,
right,
top,
bottom,
zNear = -1.0,
zFar = 1.0 
)

Makes the matrix a 'orthographic matrix'.

Returns
A reference to this matrix transformed in 'orthographic matrix'
Parameters
leftDistance between center and left
rightDistance between center and right
topDistance between center and top
bottomDistance between center and bottom
zNearDistance where 'vision' begins
zFarDistance where 'vision' ends
See also
Ortho

◆ MakePerspective()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::MakePerspective ( angle,
ratio,
zNear,
zFar 
)

Makes the matrix a 'perspective matrix'.

Returns
A reference to this matrix transformed in 'perspective matrix'
Parameters
angleUnit depends on NAZARA_MATH_ANGLE_RADIAN
ratioRendering ratio (typically 16/9 or 4/3)
zNearDistance where 'vision' begins
zFarDistance where 'vision' ends
See also
Perspective

◆ MakeRotation()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::MakeRotation ( const Quaternion< T > &  rotation)

Makes the matrix the representation of the quaternion.

Returns
A reference to this matrix which is the rotation of the quaternion
Parameters
rotationQuaternion representing a rotation of space
See also
Rotate

◆ MakeScale()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::MakeScale ( const Vector3< T > &  scale)

Makes the matrix with the scale.

Returns
A reference to this matrix which is the scale
Parameters
scaleVector3 representing the homothety
See also
Scale

◆ MakeTransform() [1/2]

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::MakeTransform ( const Vector3< T > &  translation,
const Quaternion< T > &  rotation 
)

Makes the matrix with the translation and the rotation.

Returns
A reference to this matrix which is transformation obtained by the translation and the rotation
Parameters
translationVector3 representing the translation
rotationQuaternion representing a rotation of space
Remarks
Rotation is applied first
See also
Transform

◆ MakeTransform() [2/2]

template<typename T>
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.

Returns
A reference to this matrix which is transformation obtained by the translation, the rotation and the scale
Parameters
translationVector3 representing the translation
rotationQuaternion representing a rotation of space
scaleVector3 representing the homothety
Remarks
Rotation is applied first, then translation
See also
Transform

◆ MakeTranslation()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::MakeTranslation ( const Vector3< T > &  translation)

Makes the matrix with the translation.

Returns
A reference to this matrix which is the translation
Parameters
translationVector3 representing the translation
See also
Translate

◆ MakeViewMatrix()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::MakeViewMatrix ( const Vector3< T > &  translation,
const Quaternion< T > &  rotation 
)

Makes the matrix a 'view matrix'.

Returns
A reference to this matrix transformed in 'view matrix'
Parameters
translationVector3 representing the translation
rotationQuaternion representing a rotation of space
See also
ViewMatrix

◆ MakeZero()

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::MakeZero ( )

Makes the matrix zero (with 0 everywhere)

Returns
A reference to this matrix with components (0 everywhere)
See also
Zero

◆ operator const T *()

template<typename T >
Nz::Matrix4< T >::operator const T * ( ) const

Converts matrix to pointer to its own data.

Returns
A constant pointer to the own data
Remarks
Access to index greather than 15 is undefined behavior

◆ operator T*()

template<typename T >
Nz::Matrix4< T >::operator T* ( )

Converts matrix to pointer to its own data.

Returns
A pointer to the own data
Remarks
Access to index greather than 15 is undefined behavior

◆ operator!=()

template<typename T >
bool Nz::Matrix4< T >::operator!= ( const Matrix4< T > &  mat) const

Compares the matrix to other one.

Returns
false if the matrices are the same
Parameters
matOther matrix to compare with

◆ operator()() [1/2]

template<typename T >
T & Nz::Matrix4< T >::operator() ( unsigned int  x,
unsigned int  y 
)

Gets the component (x, y) of the matrix.

Returns
A reference to the component (x, y)
Remarks
Produce a NazaraError if you try to access index greater than 3 for x or y with NAZARA_MATH_SAFE defined
Exceptions
std::out_of_rangeif NAZARA_MATH_SAFE is defined and if you try to access index greater than 3 for x or y

◆ operator()() [2/2]

template<typename T >
T Nz::Matrix4< T >::operator() ( unsigned int  x,
unsigned int  y 
) const

Gets the component (x, y) of the matrix.

Returns
The value of the component (x, y)
Remarks
Produce a NazaraError if you try to access index greater than 3 for x or y with NAZARA_MATH_SAFE defined
Exceptions
std::out_of_rangeif NAZARA_MATH_SAFE is defined and if you try to access index greater than 3 for x or y

◆ operator*() [1/5]

template<typename T >
Matrix4< T > Nz::Matrix4< T >::operator* ( const Matrix4< T > &  matrix) const

Multiplies the components of the matrix with other matrix.

Returns
A matrix where components are the product of this matrix and the other one according to matrix product
Parameters
matrixThe other matrix to multiply components with

◆ operator*() [2/5]

template<typename T>
Vector2< T > Nz::Matrix4< T >::operator* ( const Vector2< T > &  vector) const

Multiplies the components of the matrix with a vector.

Returns
A vector transposed by this matrix
Parameters
vectorThe vector to multiply the matrix with

◆ operator*() [3/5]

template<typename T>
Vector3< T > Nz::Matrix4< T >::operator* ( const Vector3< T > &  vector) const

Multiplies the components of the matrix with a vector.

Returns
A vector transposed by this matrix
Parameters
vectorThe vector to multiply the matrix with

◆ operator*() [4/5]

template<typename T>
Vector4< T > Nz::Matrix4< T >::operator* ( const Vector4< T > &  vector) const

Multiplies the components of the matrix with a vector.

Returns
A vector transposed by this matrix
Parameters
vectorThe vector to multiply the matrix with

◆ operator*() [5/5]

template<typename T>
Matrix4< T > Nz::Matrix4< T >::operator* ( scalar) const

Multiplies the components of the matrix with a scalar.

Returns
A Matrix4 where components are the product of matrix'components and the scalar
Parameters
scalarThe scalar to multiply the matrix'components with

◆ operator*=() [1/2]

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::operator*= ( const Matrix4< T > &  matrix)

Multiplies this matrix with another one.

Returns
A reference to this matrix which is the product with the other one
Parameters
matrixThe matrix to multiply with

◆ operator*=() [2/2]

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::operator*= ( scalar)

Multiplies the components of the matrix with a scalar.

Returns
A reference to this matrix where components are the product with the scalar
Parameters
scalarThe scalar to multiply with

◆ operator==()

template<typename T >
bool Nz::Matrix4< T >::operator== ( const Matrix4< T > &  mat) const

Compares the matrix to other one.

Returns
true if the matrices are the same
Parameters
matOther matrix to compare with

◆ Ortho()

template<typename T>
Matrix4< T > Nz::Matrix4< T >::Ortho ( left,
right,
top,
bottom,
zNear = -1.0,
zFar = 1.0 
)
static

Shorthand for the 'orthographic' matrix.

Returns
A Matrix4 which is the 'orthographic' matrix
Parameters
leftDistance between center and left
rightDistance between center and right
topDistance between center and top
bottomDistance between center and bottom
zNearDistance where 'vision' begins
zFarDistance where 'vision' ends
See also
MakeOrtho

◆ Perspective()

template<typename T>
Matrix4< T > Nz::Matrix4< T >::Perspective ( angle,
ratio,
zNear,
zFar 
)
static

Shorthand for the 'perspective' matrix.

Returns
A Matrix4 which is the 'perspective' matrix
Parameters
angleUnit depends on NAZARA_MATH_ANGLE_RADIAN
ratioRendering ratio (typically 16/9 or 4/3)
zNearDistance where 'vision' begins
zFarDistance where 'vision' ends
See also
MakePerspective

◆ Rotate()

template<typename T>
Matrix4< T > Nz::Matrix4< T >::Rotate ( const Quaternion< T > &  rotation)
static

Shorthand for the 'rotation' matrix.

Returns
A Matrix4 which is the rotation of the quaternion
Parameters
rotationQuaternion representing a rotation of space
See also
MakeRotation

◆ Scale()

template<typename T>
Matrix4< T > Nz::Matrix4< T >::Scale ( const Vector3< T > &  scale)
static

Shorthand for the 'scale' matrix.

Returns
A Matrix4 which is is the scale
Parameters
scaleVector3 representing the homothety
See also
MakeScale

◆ Set() [1/4]

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::Set ( r11,
r12,
r13,
r14,
r21,
r22,
r23,
r24,
r31,
r32,
r33,
r34,
r41,
r42,
r43,
r44 
)

Sets the components of the matrix.

Returns
A reference to this matrix
Parameters
rIJMatrix components at index(I, J)

◆ Set() [2/4]

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::Set ( const T  matrix[16])

Sets the components of the matrix from an array of sixteen elements.

Returns
A reference to this matrix
Parameters
matrix[16]Matrix components

◆ Set() [3/4]

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::Set ( const Matrix4< T > &  matrix)

Sets the components of the matrix from another matrix.

Returns
A reference to this matrix
Parameters
matrixThe other matrix

◆ Set() [4/4]

template<typename T>
template<typename U >
Matrix4<T>& Nz::Matrix4< T >::Set ( const Matrix4< U > &  matrix)

Sets the components of the matrix from another type of Matrix4.

Returns
A reference to this matrix
Parameters
matrixMatrix4 of type U to convert its components

◆ SetRotation()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::SetRotation ( const Quaternion< T > &  rotation)

Sets the components of the matrix from a quaternion.

Returns
A reference to this matrix which is the rotation of the quaternion
Parameters
rotationQuaternion representing a rotation of space
Remarks
3rd column and row are unchanged

◆ SetScale()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::SetScale ( const Vector3< T > &  scale)

Sets the components of the matrix from a scale.

Returns
A reference to this matrix which is the scale of the Vector3
Parameters
scaleVector3 representing the homothety
Remarks
Components are unchanged, except the three first on the diagonal

◆ SetTranslation()

template<typename T>
Matrix4< T > & Nz::Matrix4< T >::SetTranslation ( const Vector3< T > &  translation)

Sets the components of the matrix from a translation.

Returns
A reference to this matrix which is the translation of the Vector3
Parameters
translationVector3 representing the translation
Remarks
Components are unchanged, except the three first on the third row

◆ ToString()

template<typename T >
String Nz::Matrix4< T >::ToString ( ) const

Gives a string representation.

Returns
A string representation of the object: "Matrix4(m11, m12, m13, m14,\n ...)"

◆ Transform() [1/5]

template<typename T>
Vector2< T > Nz::Matrix4< T >::Transform ( const Vector2< T > &  vector,
z = 0.0,
w = 1.0 
) const

Transforms the Vector2 and two components by the matrix.

Returns
Vector2 transformed by the matrix
Parameters
vectorTo transform
zZ Component of the imaginary Vector4
wW Component of the imaginary Vector4

◆ Transform() [2/5]

template<typename T>
Vector3< T > Nz::Matrix4< T >::Transform ( const Vector3< T > &  vector,
w = 1.0 
) const

Transforms the Vector3 and one component by the matrix.

Returns
Vector3 transformed by the matrix
Parameters
vectorTo transform
wW Component of the imaginary Vector4

◆ Transform() [3/5]

template<typename T>
Vector4< T > Nz::Matrix4< T >::Transform ( const Vector4< T > &  vector) const

Transforms the Vector4 by the matrix.

Returns
Vector4 transformed by the matrix
Parameters
vectorTo transform

◆ Transform() [4/5]

template<typename T>
Matrix4< T > Nz::Matrix4< T >::Transform ( const Vector3< T > &  translation,
const Quaternion< T > &  rotation 
)
static

Shorthand for the 'transform' matrix.

Returns
A Matrix4 which is transformation obtained by the translation and the rotation
Parameters
translationVector3 representing the translation
rotationQuaternion representing a rotation of space
Remarks
Rotation is applied first
See also
MakeTransform

◆ Transform() [5/5]

template<typename T>
Matrix4< T > Nz::Matrix4< T >::Transform ( const Vector3< T > &  translation,
const Quaternion< T > &  rotation,
const Vector3< T > &  scale 
)
static

Shorthand for the 'transform' matrix.

Returns
A Matrix4 which is transformation obtained by the translation, the rotation and the scale
Parameters
translationVector3 representing the translation
rotationQuaternion representing a rotation of space
scaleVector3 representing the homothety
Remarks
Rotation is applied first, then translation
See also
MakeTransform

◆ Translate()

template<typename T>
Matrix4< T > Nz::Matrix4< T >::Translate ( const Vector3< T > &  translation)
static

Shorthand for the 'translation' matrix.

Returns
A Matrix4 which is is the translation
Parameters
translationVector3 representing the translation
See also
MakeTranslation

◆ Transpose()

template<typename T >
Matrix4< T > & Nz::Matrix4< T >::Transpose ( )

Transposes the matrix.

Returns
A reference to this matrix transposed
See also
GetTransposed

◆ ViewMatrix()

template<typename T>
Matrix4< T > Nz::Matrix4< T >::ViewMatrix ( const Vector3< T > &  translation,
const Quaternion< T > &  rotation 
)
static

Shorthand for the 'view' matrix.

Returns
A Matrix4 which is the 'view matrix'
Parameters
translationVector3 representing the translation
rotationQuaternion representing a rotation of space
See also
MakeViewMatrix

◆ Zero()

template<typename T >
Matrix4< T > Nz::Matrix4< T >::Zero ( )
static

Shorthand for the 'zero' matrix.

Returns
A Matrix4 with components (0 everywhere)
See also
MakeZero

The documentation for this class was generated from the following files: