UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Math::TMatrix< T > Struct Template Reference

#include <Matrix.h>

+ Inheritance diagram for UE::Math::TMatrix< T >:

Public Types

using FReal = T
 

Public Member Functions

void DiagnosticCheckNaN () const
 
 TMatrix ()=default
 
 TMatrix (EForceInit)
 
 TMatrix (const TPlane< T > &InX, const TPlane< T > &InY, const TPlane< T > &InZ, const TPlane< T > &InW)
 
 TMatrix (const TVector< T > &InX, const TVector< T > &InY, const TVector< T > &InZ, const TVector< T > &InW)
 
void SetIdentity ()
 
TMatrix< T > operator* (const TMatrix< T > &Other) const
 
void operator*= (const TMatrix< T > &Other)
 
TMatrix< T > operator+ (const TMatrix< T > &Other) const
 
void operator+= (const TMatrix< T > &Other)
 
TMatrix< T > operator* (T Other) const
 
void operator*= (T Other)
 
bool operator== (const TMatrix< T > &Other) const
 
bool Equals (const TMatrix< T > &Other, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
bool operator!= (const TMatrix< T > &Other) const
 
TVector4< T > TransformFVector4 (const TVector4< T > &V) const
 
TVector4< T > TransformPosition (const TVector< T > &V) const
 
TVector< T > InverseTransformPosition (const TVector< T > &V) const
 
TVector4< T > TransformVector (const TVector< T > &V) const
 
TVector< T > InverseTransformVector (const TVector< T > &V) const
 
TMatrix< T > GetTransposed () const
 
Determinant () const
 
RotDeterminant () const
 
TMatrix< T > InverseFast () const
 
TMatrix< T > Inverse () const
 
TMatrix< T > TransposeAdjoint () const
 
void RemoveScaling (T Tolerance=UE_SMALL_NUMBER)
 
TMatrix< T > GetMatrixWithoutScale (T Tolerance=UE_SMALL_NUMBER) const
 
TVector< T > ExtractScaling (T Tolerance=UE_SMALL_NUMBER)
 
TVector< T > GetScaleVector (T Tolerance=UE_SMALL_NUMBER) const
 
TMatrix< T > RemoveTranslation () const
 
TMatrix< T > ConcatTranslation (const TVector< T > &Translation) const
 
bool ContainsNaN () const
 
void ScaleTranslation (const TVector< T > &Scale3D)
 
GetMinimumAxisScale () const
 
GetMaximumAxisScale () const
 
TMatrix< T > ApplyScale (T Scale) const
 
TVector< T > GetOrigin () const
 
TVector< T > GetScaledAxis (EAxis::Type Axis) const
 
void GetScaledAxes (TVector< T > &X, TVector< T > &Y, TVector< T > &Z) const
 
TVector< T > GetUnitAxis (EAxis::Type Axis) const
 
void GetUnitAxes (TVector< T > &X, TVector< T > &Y, TVector< T > &Z) const
 
void SetAxis (int32 i, const TVector< T > &Axis)
 
void SetOrigin (const TVector< T > &NewOrigin)
 
void SetAxes (const TVector< T > *Axis0=NULL, const TVector< T > *Axis1=NULL, const TVector< T > *Axis2=NULL, const TVector< T > *Origin=NULL)
 
TVector< T > GetColumn (int32 i) const
 
void SetColumn (int32 i, TVector< T > Value)
 
CORE_API UE::Math::TRotator< T > Rotator () const
 
CORE_API UE::Math::TQuat< T > ToQuat () const
 
void To3x4MatrixTranspose (T *Out) const
 
bool GetFrustumNearPlane (TPlane< T > &OuTPln) const
 
bool GetFrustumFarPlane (TPlane< T > &OuTPln) const
 
bool GetFrustumLeftPlane (TPlane< T > &OuTPln) const
 
bool GetFrustumRightPlane (TPlane< T > &OuTPln) const
 
bool GetFrustumTopPlane (TPlane< T > &OuTPln) const
 
bool GetFrustumBottomPlane (TPlane< T > &OuTPln) const
 
void Mirror (EAxis::Type MirrorAxis, EAxis::Type FlipAxis)
 
FString ToString () const
 
void DebugPrint () const
 
uint32 ComputeHash () const
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
template<typename FArg UE_REQUIRES>
 TMatrix (const TMatrix< FArg > &From)
 
void To3x4MatrixTranspose (float *Out) const
 

Public Attributes

M [4][4]
 

Static Public Attributes

static CORE_API const TMatrix Identity
 

Member Typedef Documentation

◆ FReal

template<typename T >
using UE::Math::TMatrix< T >::FReal = T

Constructor & Destructor Documentation

◆ TMatrix() [1/5]

template<typename T >
UE::Math::TMatrix< T >::TMatrix ( )
default

◆ TMatrix() [2/5]

template<typename T >
UE::Math::TMatrix< T >::TMatrix ( EForceInit  )
inlineexplicit

Constructor.

Parameters
EForceInitForce Init Enum.

◆ TMatrix() [3/5]

template<typename T >
UE::Math::TMatrix< T >::TMatrix ( const TPlane< T > &  InX,
const TPlane< T > &  InY,
const TPlane< T > &  InZ,
const TPlane< T > &  InW 
)
inline

Constructor.

Parameters
InXX plane
InYY plane
InZZ plane
InWW plane

TMatrix inline functions.

◆ TMatrix() [4/5]

template<typename T >
UE::Math::TMatrix< T >::TMatrix ( const TVector< T > &  InX,
const TVector< T > &  InY,
const TVector< T > &  InZ,
const TVector< T > &  InW 
)
inline

Constructor.

Parameters
InXX vector
InYY vector
InZZ vector
InWW vector

◆ TMatrix() [5/5]

template<typename T >
template<typename FArg UE_REQUIRES>
UE::Math::TMatrix< T >::TMatrix ( const TMatrix< FArg > &  From)
inlineexplicit

Member Function Documentation

◆ ApplyScale()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::ApplyScale ( Scale) const
inline

Apply Scale to this matrix

◆ ComputeHash()

template<typename T >
uint32 UE::Math::TMatrix< T >::ComputeHash ( ) const
inline

For debugging purpose, could be changed

◆ ConcatTranslation()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::ConcatTranslation ( const TVector< T > &  Translation) const
inline

Returns a matrix with an additional translation concatenated.

◆ ContainsNaN()

template<typename T >
bool UE::Math::TMatrix< T >::ContainsNaN ( ) const
inline

Returns true if any element of this matrix is NaN

Returns true if any element of this matrix is not finite

◆ DebugPrint()

template<typename T >
void UE::Math::TMatrix< T >::DebugPrint ( ) const
inline

Output ToString

◆ Determinant()

template<typename T >
T UE::Math::TMatrix< T >::Determinant ( ) const
inline

◆ DiagnosticCheckNaN()

template<typename T >
void UE::Math::TMatrix< T >::DiagnosticCheckNaN ( ) const
inline

◆ Equals()

template<typename T >
bool UE::Math::TMatrix< T >::Equals ( const TMatrix< T > &  Other,
Tolerance = UE_KINDA_SMALL_NUMBER 
) const
inline

Checks whether another Matrix is equal to this, within specified tolerance.

Parameters
OtherThe other Matrix.
ToleranceError Tolerance.
Returns
true if two Matrix are equal, within specified tolerance, otherwise false.

◆ ExtractScaling()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::ExtractScaling ( Tolerance = UE_SMALL_NUMBER)
inline

Remove any scaling from this matrix (ie magnitude of each row is 1) and return the 3D scale vector that was initially present with error Tolerance

Remove any scaling from this matrix (ie magnitude of each row is 1) and return the 3D scale vector that was initially present.

◆ GetColumn()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::GetColumn ( int32  i) const
inline

get a column of this matrix

Parameters
iindex into the column of the matrix
Returns
vector of the column

◆ GetFrustumBottomPlane()

template<typename T >
bool UE::Math::TMatrix< T >::GetFrustumBottomPlane ( TPlane< T > &  OuTPln) const
inline
Parameters
OuTPlnthe bottom plane of the Frustum of this matrix

◆ GetFrustumFarPlane()

template<typename T >
bool UE::Math::TMatrix< T >::GetFrustumFarPlane ( TPlane< T > &  OuTPln) const
inline
Parameters
OuTPlnthe far plane of the Frustum of this matrix

◆ GetFrustumLeftPlane()

template<typename T >
bool UE::Math::TMatrix< T >::GetFrustumLeftPlane ( TPlane< T > &  OuTPln) const
inline
Parameters
OuTPlnthe left plane of the Frustum of this matrix

◆ GetFrustumNearPlane()

template<typename T >
bool UE::Math::TMatrix< T >::GetFrustumNearPlane ( TPlane< T > &  OuTPln) const
inline
Parameters
OuTPlnthe near plane of the Frustum of this matrix

◆ GetFrustumRightPlane()

template<typename T >
bool UE::Math::TMatrix< T >::GetFrustumRightPlane ( TPlane< T > &  OuTPln) const
inline
Parameters
OuTPlnthe right plane of the Frustum of this matrix

◆ GetFrustumTopPlane()

template<typename T >
bool UE::Math::TMatrix< T >::GetFrustumTopPlane ( TPlane< T > &  OuTPln) const
inline
Parameters
OuTPlnthe top plane of the Frustum of this matrix

◆ GetMatrixWithoutScale()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::GetMatrixWithoutScale ( Tolerance = UE_SMALL_NUMBER) const
inline

◆ GetMaximumAxisScale()

template<typename T >
T UE::Math::TMatrix< T >::GetMaximumAxisScale ( ) const
inline
Returns
the maximum magnitude of any row of the matrix.

◆ GetMinimumAxisScale()

template<typename T >
T UE::Math::TMatrix< T >::GetMinimumAxisScale ( ) const
inline
Returns
the minimum magnitude of any row of the matrix.

◆ GetOrigin()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::GetOrigin ( ) const
inline

◆ GetScaledAxes()

template<typename T >
void UE::Math::TMatrix< T >::GetScaledAxes ( TVector< T > &  X,
TVector< T > &  Y,
TVector< T > &  Z 
) const
inline

get axes of this matrix scaled by the scale of the matrix

Parameters
Xaxes returned to this param
Yaxes returned to this param
Zaxes returned to this param

◆ GetScaledAxis()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::GetScaledAxis ( EAxis::Type  Axis) const
inline

get axis of this matrix scaled by the scale of the matrix

Parameters
iindex into the axis of the matrix @ return vector of the axis

◆ GetScaleVector()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::GetScaleVector ( Tolerance = UE_SMALL_NUMBER) const
inline

return a 3D scale vector calculated from this matrix (where each component is the magnitude of a row vector) with error Tolerance.

return a 3D scale vector calculated from this matrix (where each component is the magnitude of a row vector).

◆ GetTransposed()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::GetTransposed ( ) const
inline

◆ GetUnitAxes()

template<typename T >
void UE::Math::TMatrix< T >::GetUnitAxes ( TVector< T > &  X,
TVector< T > &  Y,
TVector< T > &  Z 
) const
inline

get unit length axes of this matrix

Parameters
Xaxes returned to this param
Yaxes returned to this param
Zaxes returned to this param

◆ GetUnitAxis()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::GetUnitAxis ( EAxis::Type  Axis) const
inline

get unit length axis of this matrix

Parameters
iindex into the axis of the matrix
Returns
vector of the axis

◆ Inverse()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::Inverse ( ) const
inline

Get the inverse of this matrix. Will silently change nil/nan matrices to identity.

◆ InverseFast()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::InverseFast ( ) const
inline

Get the inverse of this matrix. Will ensure on nil matrices in non-final builds. Not faster than Inverse.

◆ InverseTransformPosition()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::InverseTransformPosition ( const TVector< T > &  V) const
inline

Inverts the matrix and then transforms V - correctly handles scaling in this matrix.

◆ InverseTransformVector()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::InverseTransformVector ( const TVector< T > &  V) const
inline

Transform a direction vector by the inverse of this matrix - will not take into account translation part. If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT with adjoint of matrix inverse.

Faster version of InverseTransformVector that assumes no scaling. WARNING: Will NOT work correctly if there is scaling in the matrix.

◆ Mirror()

template<typename T >
void UE::Math::TMatrix< T >::Mirror ( EAxis::Type  MirrorAxis,
EAxis::Type  FlipAxis 
)
inline

Utility for mirroring this transform across a certain plane, and flipping one of the axis as well.

◆ operator!=()

template<typename T >
bool UE::Math::TMatrix< T >::operator!= ( const TMatrix< T > &  Other) const
inline

Checks whether another Matrix is not equal to this, within specified tolerance.

Parameters
OtherThe other Matrix.
Returns
true if two Matrix are not equal, within specified tolerance, otherwise false.

◆ operator*() [1/2]

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::operator* ( const TMatrix< T > &  Other) const
inline

Gets the result of multiplying a Matrix to this.

Parameters
OtherThe matrix to multiply this by.
Returns
The result of multiplication.

◆ operator*() [2/2]

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::operator* ( Other) const
inline

This isn't applying SCALE, just multiplying the value to all members - i.e. weighting

◆ operator*=() [1/2]

template<typename T >
void UE::Math::TMatrix< T >::operator*= ( const TMatrix< T > &  Other)
inline

Multiply this by a matrix.

Parameters
Otherthe matrix to multiply by this.
Returns
reference to this after multiply.

◆ operator*=() [2/2]

template<typename T >
void UE::Math::TMatrix< T >::operator*= ( Other)
inline

Multiply this matrix by a weighting factor.

Parameters
otherThe weight.
Returns
a reference to this after weighting.

◆ operator+()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::operator+ ( const TMatrix< T > &  Other) const
inline

Gets the result of adding a matrix to this.

Parameters
OtherThe Matrix to add.
Returns
The result of addition.

◆ operator+=()

template<typename T >
void UE::Math::TMatrix< T >::operator+= ( const TMatrix< T > &  Other)
inline

Adds to this matrix.

Parameters
OtherThe matrix to add to this.
Returns
Reference to this after addition.

◆ operator==()

template<typename T >
bool UE::Math::TMatrix< T >::operator== ( const TMatrix< T > &  Other) const
inline

Checks whether two matrix are identical.

Parameters
OtherThe other matrix.
Returns
true if two matrix are identical, otherwise false.

◆ RemoveScaling()

template<typename T >
void UE::Math::TMatrix< T >::RemoveScaling ( Tolerance = UE_SMALL_NUMBER)
inline

◆ RemoveTranslation()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::RemoveTranslation ( ) const
inline

◆ Rotator()

template<typename T >
UE::Math::TRotator< T > UE::Math::TMatrix< T >::Rotator ( ) const
Returns
rotator representation of this matrix

◆ RotDeterminant()

template<typename T >
T UE::Math::TMatrix< T >::RotDeterminant ( ) const
inline
Returns
the determinant of rotation 3x3 matrix

Calculate determinant of rotation 3x3 matrix

◆ ScaleTranslation()

template<typename T >
void UE::Math::TMatrix< T >::ScaleTranslation ( const TVector< T > &  Scale3D)
inline

Scale the translation part of the matrix by the supplied vector.

◆ Serialize()

template<typename T >
bool UE::Math::TMatrix< T >::Serialize ( FArchive Ar)
inline

◆ SerializeFromMismatchedTag()

template<typename T >
bool UE::Math::TMatrix< T >::SerializeFromMismatchedTag ( FName  StructTag,
FArchive Ar 
)
inline

◆ SetAxes()

template<typename T >
void UE::Math::TMatrix< T >::SetAxes ( const TVector< T > *  Axis0 = NULL,
const TVector< T > *  Axis1 = NULL,
const TVector< T > *  Axis2 = NULL,
const TVector< T > *  Origin = NULL 
)
inline

Update the axes of the matrix if any value is NULL do not update that axis

Parameters
Axis0set matrix row 0
Axis1set matrix row 1
Axis2set matrix row 2
Originset matrix row 3

◆ SetAxis()

template<typename T >
void UE::Math::TMatrix< T >::SetAxis ( int32  i,
const TVector< T > &  Axis 
)
inline

set an axis of this matrix

Parameters
iindex into the axis of the matrix
Axisvector of the axis

◆ SetColumn()

template<typename T >
void UE::Math::TMatrix< T >::SetColumn ( int32  i,
TVector< T >  Value 
)
inline

Set a column of this matrix

Parameters
iindex of the matrix column
Valuenew value of the column

◆ SetIdentity()

template<typename T >
void UE::Math::TMatrix< T >::SetIdentity ( )
inline

◆ SetOrigin()

template<typename T >
void UE::Math::TMatrix< T >::SetOrigin ( const TVector< T > &  NewOrigin)
inline

◆ To3x4MatrixTranspose() [1/2]

void UE::Math::TMatrix< float >::To3x4MatrixTranspose ( float Out) const
inline

◆ To3x4MatrixTranspose() [2/2]

template<typename T >
void UE::Math::TMatrix< T >::To3x4MatrixTranspose ( T *  Out) const
inline

Convert this Atom to the 3x4 transpose of the transformation matrix.

◆ ToQuat()

template<typename T >
CORE_API UE::Math::TQuat< T > UE::Math::TMatrix< T >::ToQuat ( ) const

Transform a rotation matrix into a quaternion.

Warning
rotation part will need to be unit length for this to be right!

◆ ToString()

template<typename T >
FString UE::Math::TMatrix< T >::ToString ( ) const
inline

Get a textual representation of the vector.

Returns
Text describing the vector.

◆ TransformFVector4()

template<typename T >
TVector4< T > UE::Math::TMatrix< T >::TransformFVector4 ( const TVector4< T > &  V) const
inline

◆ TransformPosition()

template<typename T >
UE_FORCEINLINE_HINT TVector4< T > UE::Math::TMatrix< T >::TransformPosition ( const TVector< T > &  V) const

Transform a location - will take into account translation part of the TMatrix<T>.

◆ TransformVector()

template<typename T >
UE_FORCEINLINE_HINT TVector4< T > UE::Math::TMatrix< T >::TransformVector ( const TVector< T > &  V) const

Transform a direction vector - will not take into account translation part of the TMatrix<T>. If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT.

◆ TransposeAdjoint()

template<typename T >
TMatrix< T > UE::Math::TMatrix< T >::TransposeAdjoint ( ) const
inline

Member Data Documentation

◆ Identity

template<typename T >
CORE_API const TMatrix UE::Math::TMatrix< T >::Identity
static

◆ M

template<typename T >
T UE::Math::TMatrix< T >::M[4][4]

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