Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
UE::Math::TMatrix< T > Struct Template Reference

#include <Matrix.h>

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

Public Types

using FReal = T
 

Public Member Functions

FORCEINLINE void DiagnosticCheckNaN () const
 
FORCEINLINE TMatrix ()
 
FORCEINLINE TMatrix (EForceInit)
 
FORCEINLINE TMatrix (const TPlane< T > &InX, const TPlane< T > &InY, const TPlane< T > &InZ, const TPlane< T > &InW)
 
FORCEINLINE TMatrix (const TVector< T > &InX, const TVector< T > &InY, const TVector< T > &InZ, const TVector< T > &InW)
 
void SetIdentity ()
 
FORCEINLINE TMatrix< Toperator* (const TMatrix< T > &Other) const
 
FORCEINLINE void operator*= (const TMatrix< T > &Other)
 
FORCEINLINE TMatrix< Toperator+ (const TMatrix< T > &Other) const
 
FORCEINLINE void operator+= (const TMatrix< T > &Other)
 
FORCEINLINE TMatrix< Toperator* (T Other) const
 
FORCEINLINE 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
 
FORCEINLINE TVector4< TTransformFVector4 (const TVector4< T > &V) const
 
FORCEINLINE TVector4< TTransformPosition (const TVector< T > &V) const
 
FORCEINLINE TVector< TInverseTransformPosition (const TVector< T > &V) const
 
FORCEINLINE TVector4< TTransformVector (const TVector< T > &V) const
 
FORCEINLINE TVector< TInverseTransformVector (const TVector< T > &V) const
 
FORCEINLINE TMatrix< TGetTransposed () const
 
T Determinant () const
 
T RotDeterminant () const
 
TMatrix< TInverseFast () const
 
TMatrix< TInverse () const
 
TMatrix< TTransposeAdjoint () const
 
void RemoveScaling (T Tolerance=UE_SMALL_NUMBER)
 
TMatrix< TGetMatrixWithoutScale (T Tolerance=UE_SMALL_NUMBER) const
 
TVector< TExtractScaling (T Tolerance=UE_SMALL_NUMBER)
 
TVector< TGetScaleVector (T Tolerance=UE_SMALL_NUMBER) const
 
TMatrix< TRemoveTranslation () const
 
TMatrix< TConcatTranslation (const TVector< T > &Translation) const
 
bool ContainsNaN () const
 
void ScaleTranslation (const TVector< T > &Scale3D)
 
T GetMinimumAxisScale () const
 
T GetMaximumAxisScale () const
 
TMatrix< TApplyScale (T Scale) const
 
TVector< TGetOrigin () const
 
TVector< TGetScaledAxis (EAxis::Type Axis) const
 
void GetScaledAxes (TVector< T > &X, TVector< T > &Y, TVector< T > &Z) const
 
TVector< TGetUnitAxis (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< TGetColumn (int32 i) const
 
void SetColumn (int32 i, TVector< T > Value)
 
UE::Math::TRotator< TRotator () const
 
UE::Math::TQuat< TToQuat () const
 
FORCEINLINE bool GetFrustumNearPlane (TPlane< T > &OuTPln) const
 
FORCEINLINE bool GetFrustumFarPlane (TPlane< T > &OuTPln) const
 
FORCEINLINE bool GetFrustumLeftPlane (TPlane< T > &OuTPln) const
 
FORCEINLINE bool GetFrustumRightPlane (TPlane< T > &OuTPln) const
 
FORCEINLINE bool GetFrustumTopPlane (TPlane< T > &OuTPln) const
 
FORCEINLINE 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)
 
void To3x4MatrixTranspose (T *Out) const
 
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
 TMatrix (const TMatrix< FArg > &From)
 

Public Attributes

T M [4][4]
 

Static Public Attributes

static const TMatrix Identity
 

Static Private Member Functions

static void ErrorEnsure (const TCHAR *Message)
 

Detailed Description

template<typename T>
struct UE::Math::TMatrix< T >

Definition at line 39 of file Matrix.h.

Member Typedef Documentation

◆ FReal

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

Definition at line 44 of file Matrix.h.

Constructor & Destructor Documentation

◆ TMatrix() [1/5]

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

TMatrix inline functions.

Definition at line 27 of file Matrix.inl.

◆ TMatrix() [2/5]

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

Constructor.

Parameters
EForceInitForce Init Enum.

Definition at line 74 of file Matrix.h.

◆ TMatrix() [3/5]

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

Constructor.

Parameters
InXX plane
InYY plane
InZZ plane
InWW plane

Definition at line 32 of file Matrix.inl.

◆ TMatrix() [4/5]

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

Constructor.

Parameters
InXX vector
InYY vector
InZZ vector
InWW vector

Definition at line 42 of file Matrix.inl.

◆ TMatrix() [5/5]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
UE::Math::TMatrix< T >::TMatrix ( const TMatrix< FArg > & From)
inlineexplicit

Definition at line 431 of file Matrix.h.

Member Function Documentation

◆ ApplyScale()

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

Apply Scale to this matrix

Definition at line 846 of file Matrix.inl.

◆ ComputeHash()

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

For debugging purpose, could be changed

Definition at line 379 of file Matrix.h.

◆ ConcatTranslation()

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

Returns a matrix with an additional translation concatenated.

Definition at line 504 of file Matrix.inl.

◆ 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

Definition at line 535 of file Matrix.inl.

◆ DebugPrint()

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

Output ToString

Definition at line 373 of file Matrix.h.

◆ Determinant()

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

Definition at line 256 of file Matrix.inl.

◆ DiagnosticCheckNaN()

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

Definition at line 62 of file Matrix.h.

◆ Equals()

template<typename T >
bool UE::Math::TMatrix< T >::Equals ( const TMatrix< T > & Other,
T 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.

Definition at line 149 of file Matrix.inl.

◆ ErrorEnsure()

template<typename T >
static void UE::Math::TMatrix< T >::ErrorEnsure ( const TCHAR * Message)
inlinestaticprivate

Output an error message and trigger an ensure

Definition at line 446 of file Matrix.h.

◆ ExtractScaling()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::ExtractScaling ( T 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.

Definition at line 416 of file Matrix.inl.

◆ 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

Definition at line 688 of file Matrix.inl.

◆ GetFrustumBottomPlane()

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

Definition at line 779 of file Matrix.inl.

◆ GetFrustumFarPlane()

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

Definition at line 731 of file Matrix.inl.

◆ GetFrustumLeftPlane()

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

Definition at line 743 of file Matrix.inl.

◆ GetFrustumNearPlane()

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

Definition at line 719 of file Matrix.inl.

◆ GetFrustumRightPlane()

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

Definition at line 755 of file Matrix.inl.

◆ GetFrustumTopPlane()

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

Definition at line 767 of file Matrix.inl.

◆ GetMatrixWithoutScale()

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

Definition at line 407 of file Matrix.inl.

◆ GetMaximumAxisScale()

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

Definition at line 567 of file Matrix.inl.

◆ GetMinimumAxisScale()

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

Definition at line 553 of file Matrix.inl.

◆ GetOrigin()

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

Definition at line 590 of file Matrix.inl.

◆ 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

Definition at line 616 of file Matrix.inl.

◆ 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

Definition at line 596 of file Matrix.inl.

◆ GetScaleVector()

template<typename T >
TVector< T > UE::Math::TMatrix< T >::GetScaleVector ( T 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).

Definition at line 472 of file Matrix.inl.

◆ GetTransposed()

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

Definition at line 226 of file Matrix.inl.

◆ 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

Definition at line 630 of file Matrix.inl.

◆ 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

Definition at line 624 of file Matrix.inl.

◆ Inverse()

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

Fast path, and handles nil matrices.

Definition at line 322 of file Matrix.inl.

◆ InverseFast()

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

Fast path, doesn't check for nil matrices in final release builds

Definition at line 293 of file Matrix.inl.

◆ InverseTransformPosition()

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

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

Definition at line 196 of file Matrix.inl.

◆ InverseTransformVector()

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

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.

Definition at line 216 of file Matrix.inl.

◆ 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.

Definition at line 795 of file Matrix.inl.

◆ 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.

Definition at line 166 of file Matrix.inl.

◆ operator*() [1/2]

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

Gets the result of multiplying a Matrix to this.

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

Definition at line 71 of file Matrix.inl.

◆ operator*() [2/2]

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

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

Definition at line 105 of file Matrix.inl.

◆ operator*=() [1/2]

Multiply this by a matrix.

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

Definition at line 63 of file Matrix.inl.

◆ operator*=() [2/2]

Multiply this matrix by a weighting factor.

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

Definition at line 122 of file Matrix.inl.

◆ operator+()

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

Gets the result of adding a matrix to this.

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

Definition at line 81 of file Matrix.inl.

◆ operator+=()

Adds to this matrix.

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

Definition at line 98 of file Matrix.inl.

◆ 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.

Definition at line 131 of file Matrix.inl.

◆ RemoveScaling()

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

Definition at line 384 of file Matrix.inl.

◆ RemoveTranslation()

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

Definition at line 494 of file Matrix.inl.

◆ 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

Definition at line 282 of file Matrix.inl.

◆ 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.

Definition at line 580 of file Matrix.inl.

◆ Serialize()

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

Definition at line 393 of file Matrix.h.

◆ SerializeFromMismatchedTag()

bool FMatrix44d::SerializeFromMismatchedTag ( FName StructTag,
FArchive & Ar )
inline

Definition at line 938 of file Matrix.inl.

◆ 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

Definition at line 658 of file Matrix.inl.

◆ 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

Definition at line 639 of file Matrix.inl.

◆ 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

Definition at line 695 of file Matrix.inl.

◆ SetIdentity()

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

Definition at line 53 of file Matrix.inl.

◆ SetOrigin()

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

Definition at line 649 of file Matrix.inl.

◆ To3x4MatrixTranspose()

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

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

Definition at line 408 of file Matrix.h.

◆ ToQuat()

FQuat4d FMatrix44d::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.

Definition at line 360 of file Matrix.h.

◆ TransformFVector4()

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

Definition at line 175 of file Matrix.inl.

◆ TransformPosition()

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

Definition at line 189 of file Matrix.inl.

◆ TransformVector()

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

Definition at line 209 of file Matrix.inl.

◆ TransposeAdjoint()

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

Definition at line 353 of file Matrix.inl.

Member Data Documentation

◆ Identity

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

Definition at line 49 of file Matrix.h.

◆ M

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

Definition at line 46 of file Matrix.h.


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