UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Math::TQuat< T > Struct Template Reference

#include <Quat.h>

Public Types

using FReal = T
 
using QuatVectorRegister = TVectorRegisterType< T >
 

Public Member Functions

 TQuat ()=default
 
UE_FORCEINLINE_HINT TQuat (EForceInit)
 
 TQuat (T InX, T InY, T InZ, T InW)
 
template<typename DummyT = T UE_REQUIRES(std::is_arithmetic_v<T>)>
 TQuat (T V)
 
 TQuat (const TRotator< T > &R)
 
 TQuat (const TMatrix< T > &M)
 
 TQuat (TVector< T > Axis, T AngleRad)
 
TQuat< T > operator+ (const TQuat< T > &Q) const
 
TQuat< T > operator+= (const TQuat< T > &Q)
 
TQuat< T > operator- (const TQuat< T > &Q) const
 
TQuat< T > operator- () const
 
bool Equals (const TQuat< T > &Q, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
UE_FORCEINLINE_HINT bool IsIdentity (T Tolerance=UE_SMALL_NUMBER) const
 
TQuat< T > operator-= (const TQuat< T > &Q)
 
TQuat< T > operator* (const TQuat< T > &Q) const
 
TQuat< T > operator*= (const TQuat< T > &Q)
 
TVector< T > operator* (const TVector< T > &V) const
 
CORE_API TMatrix< T > operator* (const TMatrix< T > &M) const
 
template<typename FArg UE_REQUIRES>
TQuat< T > operator*= (const FArg Scale)
 
template<typename FArg UE_REQUIRES>
TQuat< T > operator* (const FArg Scale) const
 
template<typename FArg UE_REQUIRES>
TQuat< T > operator/= (const FArg Scale)
 
template<typename FArg UE_REQUIRES>
TQuat< T > operator/ (const FArg Scale) const
 
bool Identical (const TQuat *Q, const uint32 PortFlags) const
 
bool operator== (const TQuat< T > &Q) const
 
bool operator!= (const TQuat< T > &Q) const
 
operator| (const TQuat< T > &Q) const
 
CORE_API TVector< T > Euler () const
 
void Normalize (T Tolerance=UE_SMALL_NUMBER)
 
TQuat< T > GetNormalized (T Tolerance=UE_SMALL_NUMBER) const
 
bool IsNormalized () const
 
UE_FORCEINLINE_HINTSize () const
 
UE_FORCEINLINE_HINTSizeSquared () const
 
UE_FORCEINLINE_HINTGetAngle () const
 
void ToAxisAndAngle (TVector< T > &Axis, float &Angle) const
 
void ToAxisAndAngle (TVector< T > &Axis, double &Angle) const
 
TVector< T > ToRotationVector () const
 
CORE_API void ToSwingTwist (const TVector< T > &InTwistAxis, TQuat< T > &OutSwing, TQuat< T > &OutTwist) const
 
CORE_APIGetTwistAngle (const TVector< T > &TwistAxis) const
 
TVector< T > RotateVector (TVector< T > V) const
 
TVector< T > UnrotateVector (TVector< T > V) const
 
CORE_API TQuat< T > Log () const
 
CORE_API TQuat< T > Exp () const
 
TQuat< T > Inverse () const
 
void EnforceShortestArcWith (const TQuat< T > &OtherQuat)
 
TQuat< T > GetShortestArcWith (const TQuat< T > &OtherQuat) const
 
UE_FORCEINLINE_HINT TVector< T > GetAxisX () const
 
UE_FORCEINLINE_HINT TVector< T > GetAxisY () const
 
UE_FORCEINLINE_HINT TVector< T > GetAxisZ () const
 
UE_FORCEINLINE_HINT TVector< T > GetForwardVector () const
 
UE_FORCEINLINE_HINT TVector< T > GetRightVector () const
 
UE_FORCEINLINE_HINT TVector< T > GetUpVector () const
 
UE_FORCEINLINE_HINT TVector< T > Vector () const
 
CORE_API TRotator< T > Rotator () const
 
UE_FORCEINLINE_HINT TMatrix< T > ToMatrix () const
 
CORE_API void ToMatrix (TMatrix< T > &Mat) const
 
TVector< T > GetRotationAxis () const
 
AngularDistance (const TQuat< T > &Q) const
 
CORE_API bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
bool ContainsNaN () const
 
FString ToString () const
 
bool InitFromString (const FString &InSourceString)
 
UE_FORCEINLINE_HINT void DiagnosticCheckNaN () const
 
UE_FORCEINLINE_HINT void DiagnosticCheckNaN (const TCHAR *Message) const
 
TTuple< T, T, T > ToLUFEuler () const
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
template<typename FArg UE_REQUIRES>
 TQuat (const TQuat< FArg > &From)
 

Static Public Member Functions

static UE_FORCEINLINE_HINT TQuat< T > MakeFromVectorRegister (QuatVectorRegister V)
 
static UE_FORCEINLINE_HINT TQuat< T > MakeFromRotator (const TRotator< T > &R)
 
static CORE_API TQuat< T > MakeFromEuler (const TVector< T > &Euler)
 
static TQuat< T > MakeFromRotationVector (const TVector< T > &RotationVector)
 
static UE_FORCEINLINE_HINT TQuat< T > FindBetween (const TVector< T > &Vector1, const TVector< T > &Vector2)
 
static CORE_API TQuat< T > FindBetweenNormals (const TVector< T > &Normal1, const TVector< T > &Normal2)
 
static CORE_API TQuat< T > FindBetweenVectors (const TVector< T > &Vector1, const TVector< T > &Vector2)
 
staticError (const TQuat< T > &Q1, const TQuat< T > &Q2)
 
staticErrorAutoNormalize (const TQuat< T > &A, const TQuat< T > &B)
 
static TQuat< T > FastLerp (const TQuat< T > &A, const TQuat< T > &B, const T Alpha)
 
static TQuat< T > FastBilerp (const TQuat< T > &P00, const TQuat< T > &P10, const TQuat< T > &P01, const TQuat< T > &P11, T FracX, T FracY)
 
static CORE_API TQuat< T > Slerp_NotNormalized (const TQuat< T > &Quat1, const TQuat< T > &Quat2, T Slerp)
 
static UE_FORCEINLINE_HINT TQuat< T > Slerp (const TQuat< T > &Quat1, const TQuat< T > &Quat2, T Slerp)
 
static CORE_API TQuat< T > SlerpFullPath_NotNormalized (const TQuat< T > &quat1, const TQuat< T > &quat2, T Alpha)
 
static UE_FORCEINLINE_HINT TQuat< T > SlerpFullPath (const TQuat< T > &quat1, const TQuat< T > &quat2, T Alpha)
 
static CORE_API TQuat< T > Squad (const TQuat< T > &quat1, const TQuat< T > &tang1, const TQuat< T > &quat2, const TQuat< T > &tang2, T Alpha)
 
static CORE_API TQuat< T > SquadFullPath (const TQuat< T > &quat1, const TQuat< T > &tang1, const TQuat< T > &quat2, const TQuat< T > &tang2, T Alpha)
 
static CORE_API void CalcTangents (const TQuat< T > &PrevP, const TQuat< T > &P, const TQuat< T > &NextP, T Tension, TQuat< T > &OutTan)
 
static TQuat MakeFromLUFEuler (const TTuple< T, T, T > &InLUFEuler)
 

Public Attributes

X
 
Y
 
Z
 
W
 

Static Public Attributes

static CORE_API const TQuat< T > Identity
 

Protected Member Functions

 TQuat (QuatVectorRegister V)
 

Detailed Description

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

Floating point quaternion that can represent a rotation about an axis in 3-D space. The X, Y, Z, W components also double as the Axis/Angle format.

Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left). Note that this is the opposite order of FTransform multiplication.

Example: LocalToWorld = (LocalToWorld * DeltaRotation) will change rotation in local space by DeltaRotation. Example: LocalToWorld = (DeltaRotation * LocalToWorld) will change rotation in world space by DeltaRotation.

Member Typedef Documentation

◆ FReal

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

Type of the template param (float or double)

◆ QuatVectorRegister

template<typename T >
using UE::Math::TQuat< T >::QuatVectorRegister = TVectorRegisterType<T>

Constructor & Destructor Documentation

◆ TQuat() [1/9]

template<typename T >
UE::Math::TQuat< T >::TQuat ( )
default

Default constructor (no initialization).

◆ TQuat() [2/9]

template<typename T >
UE_FORCEINLINE_HINT UE::Math::TQuat< T >::TQuat ( EForceInit  ZeroOrNot)
explicit

Creates and initializes a new quaternion, with the W component either 0 or 1.

Parameters
EForceInitForce init enum: if equal to ForceInitToZero then W is 0, otherwise W = 1 (creating an identity transform)

◆ TQuat() [3/9]

template<typename T >
UE::Math::TQuat< T >::TQuat ( InX,
InY,
InZ,
InW 
)
inline

Constructor.

Parameters
InXX component of the quaternion
InYY component of the quaternion
InZZ component of the quaternion
InWW component of the quaternion

◆ TQuat() [4/9]

template<typename T >
template<typename DummyT = T UE_REQUIRES(std::is_arithmetic_v<T>)>
UE::Math::TQuat< T >::TQuat ( V)
inlineexplicit

Initializes all elements to V

◆ TQuat() [5/9]

template<typename T >
UE::Math::TQuat< T >::TQuat ( QuatVectorRegister  V)
inlineexplicitprotected

Creates and initializes a new quaternion from the XYZW values in the given VectorRegister4Float.

Parameters
VXYZW components of the quaternion packed into a single VectorRegister4Float

◆ TQuat() [6/9]

template<typename T >
UE::Math::TQuat< T >::TQuat ( const TRotator< T > &  R)
inlineexplicit

Creates and initializes a new quaternion from the given rotator.

Parameters
RThe rotator to initialize from.

◆ TQuat() [7/9]

template<typename T >
UE::Math::TQuat< T >::TQuat ( const TMatrix< T > &  M)
inlineexplicit

Creates and initializes a new quaternion from the given matrix.

Parameters
MThe rotation matrix to initialize from.

◆ TQuat() [8/9]

template<typename T >
UE::Math::TQuat< T >::TQuat ( TVector< T >  Axis,
AngleRad 
)
inline

Creates and initializes a new quaternion from the a rotation around the given axis.

Parameters
Axisassumed to be a normalized vector
Angleangle to rotate above the given axis (in radians)

◆ TQuat() [9/9]

template<typename T >
template<typename FArg UE_REQUIRES>
UE::Math::TQuat< T >::TQuat ( const TQuat< FArg > &  From)
inlineexplicit

Member Function Documentation

◆ AngularDistance()

template<typename T >
T UE::Math::TQuat< T >::AngularDistance ( const TQuat< T > &  Q) const

Find the angular distance between two rotation quaternions (in radians)

◆ CalcTangents()

template<typename T >
void UE::Math::TQuat< T >::CalcTangents ( const TQuat< T > &  PrevP,
const TQuat< T > &  P,
const TQuat< T > &  NextP,
Tension,
TQuat< T > &  OutTan 
)
static

Calculate tangents between given points

Parameters
PrevPquaternion at P-1
Pquaternion to return the tangent
NextPquaternion P+1
Tension
OutTanOut control point

◆ ContainsNaN()

template<typename T >
bool UE::Math::TQuat< T >::ContainsNaN ( ) const
inline

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

Returns
true if there are any non-finite values in this Quaternion, otherwise false.

◆ DiagnosticCheckNaN() [1/2]

template<typename T >
UE_FORCEINLINE_HINT void UE::Math::TQuat< T >::DiagnosticCheckNaN ( ) const
inline

◆ DiagnosticCheckNaN() [2/2]

template<typename T >
UE_FORCEINLINE_HINT void UE::Math::TQuat< T >::DiagnosticCheckNaN ( const TCHAR Message) const
inline

◆ EnforceShortestArcWith()

template<typename T >
void UE::Math::TQuat< T >::EnforceShortestArcWith ( const TQuat< T > &  OtherQuat)
inline

Enforce that the delta between this Quaternion and another one represents the shortest possible rotation angle

◆ Equals()

template<typename T >
bool UE::Math::TQuat< T >::Equals ( const TQuat< T > &  Q,
Tolerance = UE_KINDA_SMALL_NUMBER 
) const
inline

Checks whether another Quaternion is equal to this, within specified tolerance.

Parameters
QThe other Quaternion.
ToleranceError tolerance for comparison with other Quaternion.
Returns
true if two Quaternions are equal, within specified tolerance, otherwise false.

◆ Error()

template<typename T >
T UE::Math::TQuat< T >::Error ( const TQuat< T > &  Q1,
const TQuat< T > &  Q2 
)
inlinestatic

Error measure (angle) between two quaternions, ranged [0..1]. Returns the hypersphere-angle between two quaternions; alignment shouldn't matter, though

Note
normalized input is expected.

◆ ErrorAutoNormalize()

template<typename T >
T UE::Math::TQuat< T >::ErrorAutoNormalize ( const TQuat< T > &  A,
const TQuat< T > &  B 
)
inlinestatic

TQuat<T>::Error with auto-normalization.

◆ Euler()

template<typename T >
TVector< T > UE::Math::TQuat< T >::Euler ( ) const

Convert a Quaternion into floating-point Euler angles (in degrees).

◆ Exp()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::Exp ( ) const
Note
Exp should really only be used after Log. Assumes a quaternion with W=0 and V=theta*v (where |v| = 1). Exp(q) = (sin(theta)*v, cos(theta))

◆ FastBilerp()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::FastBilerp ( const TQuat< T > &  P00,
const TQuat< T > &  P10,
const TQuat< T > &  P01,
const TQuat< T > &  P11,
FracX,
FracY 
)
inlinestatic

Bi-Linear Quaternion interpolation. Result is NOT normalized.

◆ FastLerp()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::FastLerp ( const TQuat< T > &  A,
const TQuat< T > &  B,
const T  Alpha 
)
inlinestatic

Fast Linear Quaternion Interpolation. Result is NOT normalized.

◆ FindBetween()

template<typename T >
static UE_FORCEINLINE_HINT TQuat< T > UE::Math::TQuat< T >::FindBetween ( const TVector< T > &  Vector1,
const TVector< T > &  Vector2 
)
inlinestatic

Generates the 'smallest' (geodesic) rotation between two vectors of arbitrary length.

◆ FindBetweenNormals()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::FindBetweenNormals ( const TVector< T > &  Normal1,
const TVector< T > &  Normal2 
)
static

Generates the 'smallest' (geodesic) rotation between two normals (assumed to be unit length).

◆ FindBetweenVectors()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::FindBetweenVectors ( const TVector< T > &  Vector1,
const TVector< T > &  Vector2 
)
static

Generates the 'smallest' (geodesic) rotation between two vectors of arbitrary length.

◆ GetAngle()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::GetAngle ( ) const

Get the angle in radians of this quaternion

Warning
: The rotation returned may not be the shortest version. You may wish to call GetShortestArcWith(FQuat::Identity) first.

◆ GetAxisX()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::GetAxisX ( ) const

Get the forward direction (X axis) after it has been rotated by this Quaternion.

◆ GetAxisY()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::GetAxisY ( ) const

Get the right direction (Y axis) after it has been rotated by this Quaternion.

◆ GetAxisZ()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::GetAxisZ ( ) const

Get the up direction (Z axis) after it has been rotated by this Quaternion.

◆ GetForwardVector()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::GetForwardVector ( ) const

Get the forward direction (X axis) after it has been rotated by this Quaternion.

◆ GetNormalized()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::GetNormalized ( Tolerance = UE_SMALL_NUMBER) const
inline

Get a normalized copy of this quaternion. If it is too small, returns an identity quaternion.

Parameters
ToleranceMinimum squared length of quaternion for normalization.

◆ GetRightVector()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::GetRightVector ( ) const

Get the right direction (Y axis) after it has been rotated by this Quaternion.

◆ GetRotationAxis()

template<typename T >
TVector< T > UE::Math::TQuat< T >::GetRotationAxis ( ) const
inline

Get the axis of rotation of the Quaternion. This is the axis around which rotation occurs to transform the canonical coordinate system to the target orientation. For the identity Quaternion which has no such rotation, TVector<T>(1,0,0) is returned.

◆ GetShortestArcWith()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::GetShortestArcWith ( const TQuat< T > &  OtherQuat) const
inline

Returns the version of this quaternion that represents the shortest rotation angle to the other quaternion

◆ GetTwistAngle()

template<typename T >
T UE::Math::TQuat< T >::GetTwistAngle ( const TVector< T > &  TwistAxis) const

Get the twist angle (in radians) for a specified axis

Parameters
TwistAxisAxis to use for decomposition
Returns
Twist angle (in radians)
Warning
assumes normalized quaternion and twist axis

◆ GetUpVector()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::GetUpVector ( ) const

Get the up direction (Z axis) after it has been rotated by this Quaternion.

◆ Identical()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TQuat< T >::Identical ( const TQuat< T > *  Q,
const uint32  PortFlags 
) const

Identical implementation for TQuat properties. Avoids intrinsics to remain consistent with previous per-property comparison.

◆ InitFromString()

template<typename T >
bool UE::Math::TQuat< T >::InitFromString ( const FString &  InSourceString)
inline

Initialize this TQuat from a FString. The string is expected to contain X=, Y=, Z=, W=, otherwise this TQuat will have indeterminate (invalid) values.

Parameters
InSourceStringFString containing the quaternion values.
Returns
true if the TQuat was initialized; false otherwise.

◆ Inverse()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::Inverse ( ) const
inline
Returns
inverse of this quaternion
Warning
: Requires this quaternion to be normalized.

◆ IsIdentity()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TQuat< T >::IsIdentity ( Tolerance = UE_SMALL_NUMBER) const

Checks whether this Quaternion is an Identity Quaternion. Assumes Quaternion tested is normalized.

Parameters
ToleranceError tolerance for comparison with Identity Quaternion.
Returns
true if Quaternion is a normalized Identity Quaternion.

◆ IsNormalized()

template<typename T >
bool UE::Math::TQuat< T >::IsNormalized ( ) const
inline

◆ Log()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::Log ( ) const
Returns
quaternion with W=0 and V=theta*v.
Warning
: The rotation returned may not be the shortest version. You may wish to call GetShortestArcWith(FQuat::Identity) first.

◆ MakeFromEuler()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::MakeFromEuler ( const TVector< T > &  Euler)
static

Convert a vector of floating-point Euler angles (in degrees) into a Quaternion.

Parameters
Eulerthe Euler angles
Returns
constructed TQuat

◆ MakeFromLUFEuler()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::MakeFromLUFEuler ( const TTuple< T, T, T > &  InLUFEuler)
static

◆ MakeFromRotationVector()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::MakeFromRotationVector ( const TVector< T > &  RotationVector)
inlinestatic

Constructs a quaternion corresponding to the rotation vector. The direction of the vector represents the rotation axis, and the magnitude the angle in radians.

◆ MakeFromRotator()

template<typename T >
static UE_FORCEINLINE_HINT TQuat< T > UE::Math::TQuat< T >::MakeFromRotator ( const TRotator< T > &  R)
inlinestatic

◆ MakeFromVectorRegister()

template<typename T >
static UE_FORCEINLINE_HINT TQuat< T > UE::Math::TQuat< T >::MakeFromVectorRegister ( QuatVectorRegister  V)
inlinestatic

◆ NetSerialize()

template<typename T >
bool UE::Math::TQuat< T >::NetSerialize ( FArchive Ar,
class UPackageMap Map,
bool bOutSuccess 
)

Serializes the vector compressed for e.g. network transmission.

Parameters
ArArchive to serialize to/ from.
Returns
false to allow the ordinary struct code to run (this never happens).

◆ Normalize()

template<typename T >
void UE::Math::TQuat< T >::Normalize ( Tolerance = UE_SMALL_NUMBER)
inline

Normalize this quaternion if it is large enough. If it is too small, returns an identity quaternion.

Parameters
ToleranceMinimum squared length of quaternion for normalization.

◆ operator!=()

template<typename T >
bool UE::Math::TQuat< T >::operator!= ( const TQuat< T > &  Q) const
inline

Checks whether two quaternions are not identical.

Parameters
QThe other quaternion.
Returns
true if two quaternion are not identical, otherwise false.

◆ operator*() [1/4]

template<typename T >
template<typename FArg UE_REQUIRES>
TQuat< T > UE::Math::TQuat< T >::operator* ( const FArg  Scale) const
inline

Get the result of scaling this quaternion.

Parameters
ScaleThe scaling factor.
Returns
The result of scaling.

◆ operator*() [2/4]

template<typename T >
TMatrix< T > UE::Math::TQuat< T >::operator* ( const TMatrix< T > &  M) const

Multiply this by a matrix. This matrix conversion came from http://www.m-hikari.com/ija/ija-password-2008/ija-password17-20-2008/aristidouIJA17-20-2008.pdf used for non-uniform scaling transform.

Parameters
MMatrix to multiply by.
Returns
Matrix result after multiplication.

◆ operator*() [3/4]

template<typename T >
TQuat< T > UE::Math::TQuat< T >::operator* ( const TQuat< T > &  Q) const
inline

Gets the result of multiplying this by another quaternion (this * Q).

Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left).

Parameters
QThe Quaternion to multiply this by.
Returns
The result of multiplication (this * Q).

◆ operator*() [4/4]

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::operator* ( const TVector< T > &  V) const

Rotate a vector by this quaternion.

Parameters
Vthe vector to be rotated
Returns
vector after rotation
See also
RotateVector

◆ operator*=() [1/2]

template<typename T >
template<typename FArg UE_REQUIRES>
TQuat< T > UE::Math::TQuat< T >::operator*= ( const FArg  Scale)
inline

Multiply this quaternion by a scaling factor.

Parameters
ScaleThe scaling factor.
Returns
a reference to this after scaling.

◆ operator*=() [2/2]

template<typename T >
TQuat< T > UE::Math::TQuat< T >::operator*= ( const TQuat< T > &  Q)
inline

Multiply this by a quaternion (this = this * Q).

Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left).

Parameters
Qthe quaternion to multiply this by.
Returns
The result of multiplication (this * Q).

◆ operator+()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::operator+ ( const TQuat< T > &  Q) const
inline

Gets the result of adding a Quaternion to this. This is a component-wise addition; composing quaternions should be done via multiplication.

Parameters
QThe Quaternion to add.
Returns
The result of addition.

◆ operator+=()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::operator+= ( const TQuat< T > &  Q)
inline

Adds to this quaternion. This is a component-wise addition; composing quaternions should be done via multiplication.

Parameters
OtherThe quaternion to add to this.
Returns
Result after addition.

◆ operator-() [1/2]

template<typename T >
TQuat< T > UE::Math::TQuat< T >::operator- ( ) const
inline

Negates the quaternion. Note that this represents the same rotation.

Returns
The result of negation.

◆ operator-() [2/2]

template<typename T >
TQuat< T > UE::Math::TQuat< T >::operator- ( const TQuat< T > &  Q) const
inline

Gets the result of subtracting a Quaternion to this. This is a component-wise subtraction; composing quaternions should be done via multiplication.

Parameters
QThe Quaternion to subtract.
Returns
The result of subtraction.

◆ operator-=()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::operator-= ( const TQuat< T > &  Q)
inline

Subtracts another quaternion from this. This is a component-wise subtraction; composing quaternions should be done via multiplication.

Parameters
QThe other quaternion.
Returns
reference to this after subtraction.

◆ operator/()

template<typename T >
template<typename FArg UE_REQUIRES>
TQuat< T > UE::Math::TQuat< T >::operator/ ( const FArg  Scale) const
inline

Divide this quaternion by scale.

Parameters
ScaleWhat to divide by.
Returns
new Quaternion of this after division by scale.

◆ operator/=()

template<typename T >
template<typename FArg UE_REQUIRES>
TQuat< T > UE::Math::TQuat< T >::operator/= ( const FArg  Scale)
inline

Divide this quaternion by scale.

Parameters
ScaleWhat to divide by.
Returns
a reference to this after scaling.

◆ operator==()

template<typename T >
bool UE::Math::TQuat< T >::operator== ( const TQuat< T > &  Q) const
inline

Checks whether two quaternions are identical. This is an exact comparison per-component;see Equals() for a comparison that allows for a small error tolerance and flipped axes of rotation.

Parameters
QThe other quaternion.
Returns
true if two quaternion are identical, otherwise false.
See also
Equals

◆ operator|()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::operator| ( const TQuat< T > &  Q) const

Calculates dot product of two quaternions.

Parameters
QThe other quaternions.
Returns
The dot product.

◆ RotateVector()

template<typename T >
TVector< T > UE::Math::TQuat< T >::RotateVector ( TVector< T >  V) const
inline

Rotate a vector by this quaternion.

Parameters
Vthe vector to be rotated
Returns
vector after rotation

◆ Rotator()

template<typename T >
CORE_API TRotator< T > UE::Math::TQuat< T >::Rotator ( ) const

Get the TRotator<T> representation of this Quaternion.

◆ Serialize()

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

◆ SerializeFromMismatchedTag()

template<typename T >
bool UE::Math::TQuat< T >::SerializeFromMismatchedTag ( FName  StructTag,
FArchive Ar 
)
inline

◆ Size()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::Size ( ) const

Get the length of this quaternion.

Returns
The length of this quaternion.

◆ SizeSquared()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::SizeSquared ( ) const

Get the length squared of this quaternion.

Returns
The length of this quaternion.

◆ Slerp()

template<typename T >
static UE_FORCEINLINE_HINT TQuat< T > UE::Math::TQuat< T >::Slerp ( const TQuat< T > &  Quat1,
const TQuat< T > &  Quat2,
Slerp 
)
inlinestatic

Spherical interpolation. Will correct alignment. Result is normalized.

◆ Slerp_NotNormalized()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::Slerp_NotNormalized ( const TQuat< T > &  Quat1,
const TQuat< T > &  Quat2,
Slerp 
)
static

Spherical interpolation. Will correct alignment. Result is NOT normalized.

◆ SlerpFullPath()

template<typename T >
static UE_FORCEINLINE_HINT TQuat< T > UE::Math::TQuat< T >::SlerpFullPath ( const TQuat< T > &  quat1,
const TQuat< T > &  quat2,
Alpha 
)
inlinestatic

Simpler Slerp that doesn't do any checks for 'shortest distance' etc. We need this for the cubic interpolation stuff so that the multiple Slerps dont go in different directions. Result is normalized.

◆ SlerpFullPath_NotNormalized()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::SlerpFullPath_NotNormalized ( const TQuat< T > &  quat1,
const TQuat< T > &  quat2,
Alpha 
)
static

Simpler Slerp that doesn't do any checks for 'shortest distance' etc. We need this for the cubic interpolation stuff so that the multiple Slerps dont go in different directions. Result is NOT normalized.

◆ Squad()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::Squad ( const TQuat< T > &  quat1,
const TQuat< T > &  tang1,
const TQuat< T > &  quat2,
const TQuat< T > &  tang2,
Alpha 
)
static

Given start and end quaternions of quat1 and quat2, and tangents at those points tang1 and tang2, calculate the point at Alpha (between 0 and 1) between them. Result is normalized. This will correct alignment by ensuring that the shortest path is taken.

◆ SquadFullPath()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::SquadFullPath ( const TQuat< T > &  quat1,
const TQuat< T > &  tang1,
const TQuat< T > &  quat2,
const TQuat< T > &  tang2,
Alpha 
)
static

Simpler Squad that doesn't do any checks for 'shortest distance' etc. Given start and end quaternions of quat1 and quat2, and tangents at those points tang1 and tang2, calculate the point at Alpha (between 0 and 1) between them. Result is normalized.

◆ ToAxisAndAngle() [1/2]

template<typename T >
void UE::Math::TQuat< T >::ToAxisAndAngle ( TVector< T > &  Axis,
double Angle 
) const
inline

◆ ToAxisAndAngle() [2/2]

template<typename T >
void UE::Math::TQuat< T >::ToAxisAndAngle ( TVector< T > &  Axis,
float Angle 
) const
inline

get the axis and angle of rotation of this quaternion

Parameters
Axis{out]Normalized rotation axis of the quaternion
Angle{out]Angle of the quaternion in radians
Warning
: Requires this quaternion to be normalized.
: The rotation returned may not be the shortest version. You may wish to call GetShortestArcWith(FQuat::Identity) first.

◆ ToLUFEuler()

template<typename T >
TTuple< T, T, T > UE::Math::TQuat< T >::ToLUFEuler ( ) const

◆ ToMatrix() [1/2]

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

Get the TMatrix<T> representation of this Quaternion.

◆ ToMatrix() [2/2]

template<typename T >
void UE::Math::TQuat< T >::ToMatrix ( TMatrix< T > &  Mat) const

Get the TMatrix<T> representation of this Quaternion and store it in Mat

◆ ToRotationVector()

template<typename T >
TVector< T > UE::Math::TQuat< T >::ToRotationVector ( ) const
inline

Get the rotation vector corresponding to this quaternion. The direction of the vector represents the rotation axis, and the magnitude the angle in radians.

Warning
: Requires this quaternion to be normalized.
: The rotation returned may not be the shortest version. You may wish to call GetShortestArcWith(FQuat::Identity) first.

◆ ToString()

template<typename T >
UE_FORCEINLINE_HINT FString UE::Math::TQuat< T >::ToString ( ) const

Get a textual representation of the vector.

Returns
Text describing the vector.

◆ ToSwingTwist()

template<typename T >
void UE::Math::TQuat< T >::ToSwingTwist ( const TVector< T > &  InTwistAxis,
TQuat< T > &  OutSwing,
TQuat< T > &  OutTwist 
) const

Get the swing and twist decomposition for a specified axis

Parameters
InTwistAxisAxis to use for decomposition
OutSwingswing component quaternion
OutTwistTwist component quaternion
Warning
assumes normalized quaternion and twist axis

◆ UnrotateVector()

template<typename T >
TVector< T > UE::Math::TQuat< T >::UnrotateVector ( TVector< T >  V) const
inline

Rotate a vector by the inverse of this quaternion.

Parameters
Vthe vector to be rotated
Returns
vector after rotation by the inverse of this quaternion.

◆ Vector()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::Vector ( ) const

Convert a rotation into a unit vector facing in its direction. Equivalent to GetForwardVector().

Member Data Documentation

◆ Identity

template<typename T >
CORE_API const TQuat<T> UE::Math::TQuat< T >::Identity
static

Identity quaternion.

◆ W

template<typename T >
T UE::Math::TQuat< T >::W

The quaternion's W-component.

◆ X

template<typename T >
T UE::Math::TQuat< T >::X

The quaternion's X-component.

◆ Y

template<typename T >
T UE::Math::TQuat< T >::Y

The quaternion's Y-component.

◆ Z

template<typename T >
T UE::Math::TQuat< T >::Z

The quaternion's Z-component.


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