Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
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< TTo3DMatrix () const
 

Private Attributes

Matrix2Type M
 
Vector2Type Trans
 

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]

Definition at line 643 of file TransformCalculus2D.h.

Member Typedef Documentation

◆ FReal

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

Definition at line 648 of file TransformCalculus2D.h.

◆ Matrix2Type

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

Definition at line 650 of file TransformCalculus2D.h.

◆ Vector2Type

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

Definition at line 649 of file TransformCalculus2D.h.

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.

Definition at line 654 of file TransformCalculus2D.h.

◆ TTransform2() [2/6]

template<typename T >
template<typename VType = float>
TTransform2< T >::TTransform2 ( T 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.

Definition at line 661 of file TransformCalculus2D.h.

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

Definition at line 668 of file TransformCalculus2D.h.

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

Definition at line 675 of file TransformCalculus2D.h.

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

Definition at line 682 of file TransformCalculus2D.h.

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

Definition at line 689 of file TransformCalculus2D.h.

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

Definition at line 719 of file TransformCalculus2D.h.

◆ GetMatrix()

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

Access to the 2x2 transform

Definition at line 774 of file TransformCalculus2D.h.

◆ GetTranslation()

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

Access to the translation

Definition at line 777 of file TransformCalculus2D.h.

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

Definition at line 754 of file TransformCalculus2D.h.

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

Definition at line 785 of file TransformCalculus2D.h.

◆ operator!=()

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

Inequality.

Definition at line 768 of file TransformCalculus2D.h.

◆ operator==()

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

Equality.

Definition at line 762 of file TransformCalculus2D.h.

◆ SetTranslation()

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

Definition at line 780 of file TransformCalculus2D.h.

◆ To3DMatrix()

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

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

Definition at line 793 of file TransformCalculus2D.h.

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

Definition at line 698 of file TransformCalculus2D.h.

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

Definition at line 707 of file TransformCalculus2D.h.

Member Data Documentation

◆ M

template<typename T >
Matrix2Type TTransform2< T >::M
private

Definition at line 807 of file TransformCalculus2D.h.

◆ Trans

template<typename T >
Vector2Type TTransform2< T >::Trans
private

Definition at line 808 of file TransformCalculus2D.h.


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