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

#include <TransformCalculus2D.h>

Public Types

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

Public Member Functions

 TQuat2 ()
 
 TQuat2 (T RotRadians)
 
template<typename VType >
 TQuat2 (const UE::Math::TVector2< VType > &InRot)
 
template<typename ArgType >
UE::Math::TVector2< ArgTypeTransformPoint (const UE::Math::TVector2< ArgType > &Point) const
 
template<typename ArgType >
UE::Math::TVector2< ArgTypeTransformVector (const UE::Math::TVector2< ArgType > &Vector) const
 
TQuat2 Concatenate (const TQuat2 &RHS) const
 
TQuat2 Inverse () const
 
bool operator== (const TQuat2 &Other) const
 
bool operator!= (const TQuat2 &Other) const
 
const Vector2TypeGetVector () const
 

Detailed Description

template<typename T>
class TQuat2< T >

Represents a 2D rotation as a complex number (analagous to quaternions). Rot(theta) == cos(theta) + i * sin(theta) General transformation follows complex number algebra from there. Does not use "spinor" notation using theta/2 as we don't need that decomposition for our purposes. This makes the implementation for straightforward and efficient for 2D.

Member Typedef Documentation

◆ FReal

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

◆ Vector2Type

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

Constructor & Destructor Documentation

◆ TQuat2() [1/3]

template<typename T >
TQuat2< T >::TQuat2 ( )
inline

Ctor. initialize to an identity rotation.

◆ TQuat2() [2/3]

template<typename T >
TQuat2< T >::TQuat2 ( RotRadians)
inlineexplicit

Ctor. initialize from a rotation in radians.

◆ TQuat2() [3/3]

template<typename T >
template<typename VType >
TQuat2< T >::TQuat2 ( const UE::Math::TVector2< VType > &  InRot)
inlineexplicit

Ctor. initialize from an FVector2D, representing a complex number.

Member Function Documentation

◆ Concatenate()

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

Transform 2 rotations defined by complex numbers: In imaginary land: (A + Bi) * (C + Di) == (AC - BD) + (AD + BC)i

Looking at this as a matrix, A == cos(theta), B == sin(theta), C == cos(sigma), D == sin(sigma):

[ A B] * [ C D] == [ AC-BD AD+BC] [-B A] [-D C] [-(AD+BC) AC-BD]

If you look at how the vector multiply works out: [X(AC-BD)+Y(-BC-AD) X(AD+BC)+Y(-BD+AC)] you can see it follows the same form of the imaginary form. Indeed, check out how the matrix nicely works out to [ A B] for a visual proof of the results. [-B A]

◆ GetVector()

template<typename T >
const Vector2Type & TQuat2< T >::GetVector ( ) const
inline

Access to the underlying FVector2D that stores the complex number.

◆ Inverse()

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

Invert the rotation defined by complex numbers: In imaginary land, an inverse is a complex conjugate, which is equivalent to reflecting about the X axis: Conj(A + Bi) == A - Bi

◆ operator!=()

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

Inequality.

◆ operator==()

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

Equality.

◆ TransformPoint()

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

Transform a 2D point by the 2D complex number representing the rotation: In imaginary land: (x + yi) * (u + vi) == (xu - yv) + (xv + yu)i

Looking at this as a matrix, x == cos(A), y == sin(A)

[x y] * [ cosA sinA] == [x y] * [ u v] == [xu-yv xv+yu] [-sinA cosA] [-v u]

Looking at the above results, we see the equivalence with matrix multiplication.

◆ TransformVector()

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

Vector rotation is equivalent to rotating a point.


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