![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#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< ArgType > | TransformPoint (const UE::Math::TVector2< ArgType > &Point) const |
| template<typename ArgType > | |
| UE::Math::TVector2< ArgType > | TransformVector (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 Vector2Type & | GetVector () const |
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.
| using TQuat2< T >::Vector2Type = UE::Math::TVector2<T> |
Ctor. initialize from a rotation in radians.
|
inlineexplicit |
Ctor. initialize from an FVector2D, representing a complex number.
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]
|
inline |
Access to the underlying FVector2D that stores the complex number.
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
|
inline |
Inequality.
Equality.
|
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.
|
inline |
Vector rotation is equivalent to rotating a point.