UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TTransform2< T > Class Template Reference

#include <TransformCalculus2D.h>

Public Types

using FReal = T
 
using Vector2Type = UE::Math::TVector2< T >
 
using Matrix2Type = TMatrix2x2< T >
 

Public Member Functions

template<typename VType = float>
 TTransform2 (const UE::Math::TVector2< VType > &Translation=UE::Math::TVector2< VType >(0.f, 0.f))
 
template<typename VType = float>
 TTransform2 (T UniformScale, const UE::Math::TVector2< VType > &Translation=UE::Math::TVector2< VType >(0.f, 0.f))
 
template<typename VType = float>
 TTransform2 (const TScale2< T > &Scale, const UE::Math::TVector2< VType > &Translation=UE::Math::TVector2< VType >(0.f, 0.f))
 
template<typename VType = float>
 TTransform2 (const TShear2< T > &Shear, const UE::Math::TVector2< VType > &Translation=UE::Math::TVector2< VType >(0.f, 0.f))
 
template<typename VType = float>
 TTransform2 (const TQuat2< T > &Rot, const UE::Math::TVector2< VType > &Translation=UE::Math::TVector2< VType >(0.f, 0.f))
 
template<typename VType = float>
 TTransform2 (const TMatrix2x2< T > &Transform, const UE::Math::TVector2< VType > &Translation=UE::Math::TVector2< VType >(0.f, 0.f))
 
template<typename VType >
UE::Math::TVector2< VTypeTransformPoint (const UE::Math::TVector2< VType > &Point) const
 
template<typename VType >
UE::Math::TVector2< VTypeTransformVector (const UE::Math::TVector2< VType > &Vector) const
 
TTransform2 Concatenate (const TTransform2 &RHS) const
 
TTransform2 Inverse () const
 
bool operator== (const TTransform2 &Other) const
 
bool operator!= (const TTransform2 &Other) const
 
const Matrix2TypeGetMatrix () const
 
const FVector2D GetTranslation () const
 
template<typename VType >
void SetTranslation (const UE::Math::TVector2< VType > &InTrans)
 
bool IsIdentity () const
 
UE::Math::TMatrix< T > To3DMatrix () const
 
bool ContainsNaN () const
 

Detailed Description

template<typename T>
class TTransform2< T >

Support for generalized 2D affine transforms. Implemented as a 2x2 transform followed by translation. In matrix form: [A B 0] [C D 0] [X Y 1]

Member Typedef Documentation

◆ FReal

template<typename T >
using TTransform2< T >::FReal = T

◆ Matrix2Type

template<typename T >
using TTransform2< T >::Matrix2Type = TMatrix2x2<T>

◆ Vector2Type

template<typename T >
using TTransform2< T >::Vector2Type = UE::Math::TVector2<T>

Constructor & Destructor Documentation

◆ TTransform2() [1/6]

template<typename T >
template<typename VType = float>
TTransform2< T >::TTransform2 ( const UE::Math::TVector2< VType > &  Translation = UE::Math::TVector2<VType>(0.f, 0.f))
inline

Initialize the transform using an identity matrix and a translation.

◆ TTransform2() [2/6]

template<typename T >
template<typename VType = float>
TTransform2< T >::TTransform2 ( UniformScale,
const UE::Math::TVector2< VType > &  Translation = UE::Math::TVector2<VType>(0.f, 0.f) 
)
inlineexplicit

Initialize the transform using a uniform scale and a translation.

◆ TTransform2() [3/6]

template<typename T >
template<typename VType = float>
TTransform2< T >::TTransform2 ( const TScale2< T > &  Scale,
const UE::Math::TVector2< VType > &  Translation = UE::Math::TVector2<VType>(0.f, 0.f) 
)
inlineexplicit

Initialize the transform using a 2D scale and a translation.

◆ TTransform2() [4/6]

template<typename T >
template<typename VType = float>
TTransform2< T >::TTransform2 ( const TShear2< T > &  Shear,
const UE::Math::TVector2< VType > &  Translation = UE::Math::TVector2<VType>(0.f, 0.f) 
)
inlineexplicit

Initialize the transform using a 2D shear and a translation.

◆ TTransform2() [5/6]

template<typename T >
template<typename VType = float>
TTransform2< T >::TTransform2 ( const TQuat2< T > &  Rot,
const UE::Math::TVector2< VType > &  Translation = UE::Math::TVector2<VType>(0.f, 0.f) 
)
inlineexplicit

Initialize the transform using a 2D rotation and a translation.

◆ TTransform2() [6/6]

template<typename T >
template<typename VType = float>
TTransform2< T >::TTransform2 ( const TMatrix2x2< T > &  Transform,
const UE::Math::TVector2< VType > &  Translation = UE::Math::TVector2<VType>(0.f, 0.f) 
)
inlineexplicit

Initialize the transform using a general 2x2 transform and a translation.

Member Function Documentation

◆ Concatenate()

template<typename T >
TTransform2 TTransform2< T >::Concatenate ( const TTransform2< T > &  RHS) const
inline

Concatenates two transforms. Result is equivalent to transforming first by this, followed by RHS. Concat(A,B) == (P * MA + TA) * MB + TB == (P * MA * MB) + TA*MB + TB NewM == MA * MB NewT == TA * MB + TB

◆ ContainsNaN()

template<typename T >
bool TTransform2< T >::ContainsNaN ( ) const
inline

Utility to check if there are any non-finite values (NaN or Inf) in this transform.

◆ GetMatrix()

template<typename T >
const Matrix2Type & TTransform2< T >::GetMatrix ( ) const
inline

Access to the 2x2 transform

◆ GetTranslation()

template<typename T >
const FVector2D TTransform2< T >::GetTranslation ( ) const
inline

Access to the translation

◆ Inverse()

template<typename T >
TTransform2 TTransform2< T >::Inverse ( ) const
inline

Inverts a transform. So a transform from space A to space B results in a transform from space B to space A. Since this class applies the 2x2 transform followed by translation, our inversion logic needs to be able to recast the result as a M * T. It does it using the following identity: (M * T)^-1 == T^-1 * M^-1

In homogeneous form, we represent our affine transform like so: M * T [A B 0] [1 0 0] [A B 0] [C D 0] * [0 1 0] = [C D 0]. This class simply decomposes the 2x2 transform and translation. [0 0 1] [X Y 1] [X Y 1]

But if we were applying the transforms in reverse order (as we need to for the inverse identity above): T^-1 * M^-1 [1 0 0] [A B 0] [A B 0] where [X' Y'] = [X Y] * [A B] [0 1 0] * [C D 0] = [C D 0] [C D] [X Y 1] [0 0 1] [X' Y' 1]

This can be conceptualized by seeing that a translation effectively defines a new local origin for that frame of reference. Since there is a 2x2 transform AFTER that, the concatenated frame of reference has an origin that is the old origin transformed by the 2x2 transform.

In the last equation: We know that [X Y] is the translation induced by inverting T, or -Translate. We know that [[A B][C D]] == Inverse(M), so we can represent T^-1 * M^-1 as M'* T' where: M' == Inverse(M) T' == Inverse(Translate) * Inverse(M)

◆ IsIdentity()

template<typename T >
bool TTransform2< T >::IsIdentity ( ) const
inline

Specialized function to determine if a transform is precisely the identity transform. Uses exact float comparison, so rounding error is not considered.

◆ operator!=()

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

Inequality.

◆ operator==()

template<typename T >
bool TTransform2< T >::operator== ( const TTransform2< T > &  Other) const
inline

Equality.

◆ SetTranslation()

template<typename T >
template<typename VType >
void TTransform2< T >::SetTranslation ( const UE::Math::TVector2< VType > &  InTrans)
inline

◆ To3DMatrix()

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

Converts this affine 2D Transform into an affine 3D transform.

◆ TransformPoint()

template<typename T >
template<typename VType >
UE::Math::TVector2< VType > TTransform2< T >::TransformPoint ( const UE::Math::TVector2< VType > &  Point) const
inline

2D transformation of a point. Transforms position, rotation, and scale.

◆ TransformVector()

template<typename T >
template<typename VType >
UE::Math::TVector2< VType > TTransform2< T >::TransformVector ( const UE::Math::TVector2< VType > &  Vector) const
inline

2D transformation of a vector. Transforms rotation and scale.


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