Assimp v5.2.2 (January 2022)
The Asset-Importer-Lib API documentation.
aiMatrix4x4t< TReal > Class Template Reference

Represents a row-major 4x4 matrix, use this for homogeneous coordinates. More...

#include <matrix4x4.h>

Public Member Functions

 aiMatrix4x4t () AI_NO_EXCEPT
 set to identity More...
 
 aiMatrix4x4t (const aiMatrix3x3t< TReal > &m)
 construction from 3x3 matrix, remaining elements are set to identity More...
 
 aiMatrix4x4t (const aiVector3t< TReal > &scaling, const aiQuaterniont< TReal > &rotation, const aiVector3t< TReal > &position)
 construction from position, rotation and scaling components More...
 
 aiMatrix4x4t (TReal _a1, TReal _a2, TReal _a3, TReal _a4, TReal _b1, TReal _b2, TReal _b3, TReal _b4, TReal _c1, TReal _c2, TReal _c3, TReal _c4, TReal _d1, TReal _d2, TReal _d3, TReal _d4)
 construction from single values More...
 
void Decompose (aiVector3t< TReal > &pScaling, aiVector3t< TReal > &pRotation, aiVector3t< TReal > &pPosition) const
 Decompose a trafo matrix into its original components. More...
 
void Decompose (aiVector3t< TReal > &pScaling, aiVector3t< TReal > &pRotationAxis, TReal &pRotationAngle, aiVector3t< TReal > &pPosition) const
 Decompose a trafo matrix into its original components Thx to good FAQ at http://www.gamedev.ru/code/articles/faq_matrix_quat. More...
 
void Decompose (aiVector3t< TReal > &scaling, aiQuaterniont< TReal > &rotation, aiVector3t< TReal > &position) const
 Decompose a trafo matrix into its original components. More...
 
void DecomposeNoScaling (aiQuaterniont< TReal > &rotation, aiVector3t< TReal > &position) const
 Decompose a trafo matrix with no scaling into its original components. More...
 
TReal Determinant () const
 
bool Equal (const aiMatrix4x4t &m, TReal epsilon=ai_epsilon) const
 
aiMatrix4x4tFromEulerAnglesXYZ (const aiVector3t< TReal > &blubb)
 
aiMatrix4x4tFromEulerAnglesXYZ (TReal x, TReal y, TReal z)
 Creates a trafo matrix from a set of euler angles. More...
 
aiMatrix4x4tInverse ()
 Invert the matrix. More...
 
bool IsIdentity () const
 Returns true of the matrix is the identity matrix. More...
 
template<typename TOther >
 operator aiMatrix4x4t< TOther > () const
 
bool operator!= (const aiMatrix4x4t &m) const
 
aiMatrix4x4t operator* (const aiMatrix4x4t &m) const
 
aiMatrix4x4t operator* (const TReal &aFloat) const
 
aiMatrix4x4toperator*= (const aiMatrix4x4t &m)
 
aiMatrix4x4t operator+ (const aiMatrix4x4t &aMatrix) const
 
bool operator== (const aiMatrix4x4t &m) const
 
TReal * operator[] (unsigned int p_iIndex)
 
const TReal * operator[] (unsigned int p_iIndex) const
 
aiMatrix4x4tTranspose ()
 Transpose the matrix. More...
 

Static Public Member Functions

static aiMatrix4x4tFromToMatrix (const aiVector3t< TReal > &from, const aiVector3t< TReal > &to, aiMatrix4x4t &out)
 A function for creating a rotation matrix that rotates a vector called "from" into another vector called "to". More...
 
static aiMatrix4x4tRotation (TReal a, const aiVector3t< TReal > &axis, aiMatrix4x4t &out)
 Returns a rotation matrix for a rotation around an arbitrary axis. More...
 
static aiMatrix4x4tRotationX (TReal a, aiMatrix4x4t &out)
 Returns a rotation matrix for a rotation around the x axis. More...
 
static aiMatrix4x4tRotationY (TReal a, aiMatrix4x4t &out)
 Returns a rotation matrix for a rotation around the y axis. More...
 
static aiMatrix4x4tRotationZ (TReal a, aiMatrix4x4t &out)
 Returns a rotation matrix for a rotation around the z axis. More...
 
static aiMatrix4x4tScaling (const aiVector3t< TReal > &v, aiMatrix4x4t &out)
 Returns a scaling matrix. More...
 
static aiMatrix4x4tTranslation (const aiVector3t< TReal > &v, aiMatrix4x4t &out)
 Returns a translation matrix. More...
 

Public Attributes

TReal a1
 
TReal a2
 
TReal a3
 
TReal a4
 
TReal b1
 
TReal b2
 
TReal b3
 
TReal b4
 
TReal c1
 
TReal c2
 
TReal c3
 
TReal c4
 
TReal d1
 
TReal d2
 
TReal d3
 
TReal d4
 

Detailed Description

template<typename TReal>
class aiMatrix4x4t< TReal >

Represents a row-major 4x4 matrix, use this for homogeneous coordinates.

There's much confusion about matrix layouts (column vs. row order). This is always a row-major matrix. Not even with the aiProcess_ConvertToLeftHanded flag, which absolutely does not affect matrix order - it just affects the handedness of the coordinate system defined thereby.

Constructor & Destructor Documentation

◆ aiMatrix4x4t() [1/4]

template<typename TReal >
aiMatrix4x4t< TReal >::aiMatrix4x4t

set to identity

◆ aiMatrix4x4t() [2/4]

template<typename TReal >
aiMatrix4x4t< TReal >::aiMatrix4x4t ( TReal  _a1,
TReal  _a2,
TReal  _a3,
TReal  _a4,
TReal  _b1,
TReal  _b2,
TReal  _b3,
TReal  _b4,
TReal  _c1,
TReal  _c2,
TReal  _c3,
TReal  _c4,
TReal  _d1,
TReal  _d2,
TReal  _d3,
TReal  _d4 
)

construction from single values

◆ aiMatrix4x4t() [3/4]

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal >::aiMatrix4x4t ( const aiMatrix3x3t< TReal > &  m)
explicit

construction from 3x3 matrix, remaining elements are set to identity

◆ aiMatrix4x4t() [4/4]

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal >::aiMatrix4x4t ( const aiVector3t< TReal > &  scaling,
const aiQuaterniont< TReal > &  rotation,
const aiVector3t< TReal > &  position 
)

construction from position, rotation and scaling components

Parameters
scalingThe scaling for the x,y,z axes
rotationThe rotation as a hamilton quaternion
positionThe position for the x,y,z axes

Member Function Documentation

◆ Decompose() [1/3]

template<typename TReal >
AI_FORCE_INLINE void aiMatrix4x4t< TReal >::Decompose ( aiVector3t< TReal > &  pScaling,
aiVector3t< TReal > &  pRotation,
aiVector3t< TReal > &  pPosition 
) const

Decompose a trafo matrix into its original components.

Thx to good FAQ at http://www.gamedev.ru/code/articles/faq_matrix_quat

Parameters
[out]pScaling- Receives the output scaling for the x,y,z axes.
[out]pRotation- Receives the output rotation as a Euler angles.
[out]pPosition- Receives the output position for the x,y,z axes.

◆ Decompose() [2/3]

template<typename TReal >
AI_FORCE_INLINE void aiMatrix4x4t< TReal >::Decompose ( aiVector3t< TReal > &  pScaling,
aiVector3t< TReal > &  pRotationAxis,
TReal &  pRotationAngle,
aiVector3t< TReal > &  pPosition 
) const

Decompose a trafo matrix into its original components Thx to good FAQ at http://www.gamedev.ru/code/articles/faq_matrix_quat.

Parameters
[out]pScaling- Receives the output scaling for the x,y,z axes.
[out]pRotationAxis- Receives the output rotation axis.
[out]pRotationAngle- Receives the output rotation angle for pRotationAxis.
[out]pPosition- Receives the output position for the x,y,z axes.

◆ Decompose() [3/3]

template<typename TReal >
AI_FORCE_INLINE void aiMatrix4x4t< TReal >::Decompose ( aiVector3t< TReal > &  scaling,
aiQuaterniont< TReal > &  rotation,
aiVector3t< TReal > &  position 
) const

Decompose a trafo matrix into its original components.

Parameters
scalingReceives the output scaling for the x,y,z axes
rotationReceives the output rotation as a hamilton quaternion
positionReceives the output position for the x,y,z axes

◆ DecomposeNoScaling()

template<typename TReal >
AI_FORCE_INLINE void aiMatrix4x4t< TReal >::DecomposeNoScaling ( aiQuaterniont< TReal > &  rotation,
aiVector3t< TReal > &  position 
) const

Decompose a trafo matrix with no scaling into its original components.

Parameters
rotationReceives the output rotation as a hamilton quaternion
positionReceives the output position for the x,y,z axes

◆ Determinant()

template<typename TReal >
AI_FORCE_INLINE TReal aiMatrix4x4t< TReal >::Determinant

◆ Equal()

template<typename TReal >
AI_FORCE_INLINE bool aiMatrix4x4t< TReal >::Equal ( const aiMatrix4x4t< TReal > &  m,
TReal  epsilon = ai_epsilon 
) const

◆ FromEulerAnglesXYZ() [1/2]

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::FromEulerAnglesXYZ ( const aiVector3t< TReal > &  blubb)

◆ FromEulerAnglesXYZ() [2/2]

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::FromEulerAnglesXYZ ( TReal  x,
TReal  y,
TReal  z 
)

Creates a trafo matrix from a set of euler angles.

Parameters
xRotation angle for the x-axis, in radians
yRotation angle for the y-axis, in radians
zRotation angle for the z-axis, in radians

◆ FromToMatrix()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::FromToMatrix ( const aiVector3t< TReal > &  from,
const aiVector3t< TReal > &  to,
aiMatrix4x4t< TReal > &  out 
)
static

A function for creating a rotation matrix that rotates a vector called "from" into another vector called "to".

Input : from[3], to[3] which both must be normalized non-zero vectors Output: mtx[3][3] – a 3x3 matrix in column-major form Authors: Tomas Mueller, John Hughes "Efficiently Building a Matrix to Rotate One Vector to Another" Journal of Graphics Tools, 4(4):1-4, 1999

Input : from[3], to[3] which both must be normalized non-zero vectors Output: mtx[3][3] – a 3x3 matrix in colum-major form Authors: Tomas Möller, John Hughes "Efficiently Building a Matrix to Rotate One Vector to Another" Journal of Graphics Tools, 4(4):1-4, 1999

◆ Inverse()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::Inverse

Invert the matrix.

If the matrix is not invertible all elements are set to qnan. Beware, use (f != f) to check whether a TReal f is qnan.

◆ IsIdentity()

template<typename TReal >
AI_FORCE_INLINE bool aiMatrix4x4t< TReal >::IsIdentity
inline

Returns true of the matrix is the identity matrix.

The check is performed against a not so small epsilon.

◆ operator aiMatrix4x4t< TOther >()

template<typename TReal >
template<typename TOther >
aiMatrix4x4t< TReal >::operator aiMatrix4x4t< TOther >

◆ operator!=()

template<typename TReal >
AI_FORCE_INLINE bool aiMatrix4x4t< TReal >::operator!= ( const aiMatrix4x4t< TReal > &  m) const

◆ operator*() [1/2]

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > aiMatrix4x4t< TReal >::operator* ( const aiMatrix4x4t< TReal > &  m) const

◆ operator*() [2/2]

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > aiMatrix4x4t< TReal >::operator* ( const TReal &  aFloat) const

◆ operator*=()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::operator*= ( const aiMatrix4x4t< TReal > &  m)

◆ operator+()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > aiMatrix4x4t< TReal >::operator+ ( const aiMatrix4x4t< TReal > &  aMatrix) const

◆ operator==()

template<typename TReal >
AI_FORCE_INLINE bool aiMatrix4x4t< TReal >::operator== ( const aiMatrix4x4t< TReal > &  m) const

◆ operator[]() [1/2]

template<typename TReal >
AI_FORCE_INLINE TReal * aiMatrix4x4t< TReal >::operator[] ( unsigned int  p_iIndex)
Parameters
[in]p_iIndex- index of the row.
Returns
pointer to pointed row.

◆ operator[]() [2/2]

template<typename TReal >
AI_FORCE_INLINE const TReal * aiMatrix4x4t< TReal >::operator[] ( unsigned int  p_iIndex) const

◆ Rotation()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::Rotation ( TReal  a,
const aiVector3t< TReal > &  axis,
aiMatrix4x4t< TReal > &  out 
)
static

Returns a rotation matrix for a rotation around an arbitrary axis.

Parameters
aRotation angle, in radians
axisRotation axis, should be a normalized vector.
outReceives the output matrix
Returns
Reference to the output matrix

◆ RotationX()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::RotationX ( TReal  a,
aiMatrix4x4t< TReal > &  out 
)
static

Returns a rotation matrix for a rotation around the x axis.

Parameters
aRotation angle, in radians
outReceives the output matrix
Returns
Reference to the output matrix

◆ RotationY()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::RotationY ( TReal  a,
aiMatrix4x4t< TReal > &  out 
)
static

Returns a rotation matrix for a rotation around the y axis.

Parameters
aRotation angle, in radians
outReceives the output matrix
Returns
Reference to the output matrix

◆ RotationZ()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::RotationZ ( TReal  a,
aiMatrix4x4t< TReal > &  out 
)
static

Returns a rotation matrix for a rotation around the z axis.

Parameters
aRotation angle, in radians
outReceives the output matrix
Returns
Reference to the output matrix

◆ Scaling()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::Scaling ( const aiVector3t< TReal > &  v,
aiMatrix4x4t< TReal > &  out 
)
static

Returns a scaling matrix.

Parameters
vScaling vector
outReceives the output matrix
Returns
Reference to the output matrix

◆ Translation()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::Translation ( const aiVector3t< TReal > &  v,
aiMatrix4x4t< TReal > &  out 
)
static

Returns a translation matrix.

Parameters
vTranslation vector
outReceives the output matrix
Returns
Reference to the output matrix

◆ Transpose()

template<typename TReal >
AI_FORCE_INLINE aiMatrix4x4t< TReal > & aiMatrix4x4t< TReal >::Transpose

Transpose the matrix.

Member Data Documentation

◆ a1

template<typename TReal >
TReal aiMatrix4x4t< TReal >::a1

◆ a2

template<typename TReal >
TReal aiMatrix4x4t< TReal >::a2

◆ a3

template<typename TReal >
TReal aiMatrix4x4t< TReal >::a3

◆ a4

template<typename TReal >
TReal aiMatrix4x4t< TReal >::a4

◆ b1

template<typename TReal >
TReal aiMatrix4x4t< TReal >::b1

◆ b2

template<typename TReal >
TReal aiMatrix4x4t< TReal >::b2

◆ b3

template<typename TReal >
TReal aiMatrix4x4t< TReal >::b3

◆ b4

template<typename TReal >
TReal aiMatrix4x4t< TReal >::b4

◆ c1

template<typename TReal >
TReal aiMatrix4x4t< TReal >::c1

◆ c2

template<typename TReal >
TReal aiMatrix4x4t< TReal >::c2

◆ c3

template<typename TReal >
TReal aiMatrix4x4t< TReal >::c3

◆ c4

template<typename TReal >
TReal aiMatrix4x4t< TReal >::c4

◆ d1

template<typename TReal >
TReal aiMatrix4x4t< TReal >::d1

◆ d2

template<typename TReal >
TReal aiMatrix4x4t< TReal >::d2

◆ d3

template<typename TReal >
TReal aiMatrix4x4t< TReal >::d3

◆ d4

template<typename TReal >
TReal aiMatrix4x4t< TReal >::d4

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