Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
UE::Math::TQuat< T > Struct Template Reference

#include <Quat.h>

Public Types

using FReal = T
 
using QuatVectorRegister = TVectorRegisterType<T>
 

Public Member Functions

FORCEINLINE TQuat ()
 
FORCEINLINE TQuat (EForceInit)
 
FORCEINLINE TQuat (T InX, T InY, T InZ, T InW)
 
template<TEMPLATE_REQUIRES(std::is_arithmetic< T >::value) >
FORCEINLINE TQuat (T V)
 
 TQuat (const TRotator< T > &R)
 
 TQuat (const TMatrix< T > &M)
 
 TQuat (TVector< T > Axis, T AngleRad)
 
FORCEINLINE TQuat< Toperator+ (const TQuat< T > &Q) const
 
FORCEINLINE TQuat< Toperator+= (const TQuat< T > &Q)
 
FORCEINLINE TQuat< Toperator- (const TQuat< T > &Q) const
 
FORCEINLINE TQuat< Toperator- () const
 
FORCEINLINE bool Equals (const TQuat< T > &Q, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
FORCEINLINE bool IsIdentity (T Tolerance=UE_SMALL_NUMBER) const
 
FORCEINLINE TQuat< Toperator-= (const TQuat< T > &Q)
 
FORCEINLINE TQuat< Toperator* (const TQuat< T > &Q) const
 
FORCEINLINE TQuat< Toperator*= (const TQuat< T > &Q)
 
TVector< Toperator* (const TVector< T > &V) const
 
TMatrix< Toperator* (const TMatrix< T > &M) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TQuat< Toperator*= (const FArg Scale)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TQuat< Toperator* (const FArg Scale) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TQuat< Toperator/= (const FArg Scale)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TQuat< Toperator/ (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
 
T operator| (const TQuat< T > &Q) const
 
TVector< TEuler () const
 
FORCEINLINE void Normalize (T Tolerance=UE_SMALL_NUMBER)
 
FORCEINLINE TQuat< TGetNormalized (T Tolerance=UE_SMALL_NUMBER) const
 
bool IsNormalized () const
 
FORCEINLINE T Size () const
 
FORCEINLINE T SizeSquared () const
 
FORCEINLINE T GetAngle () const
 
void ToAxisAndAngle (TVector< T > &Axis, float &Angle) const
 
void ToAxisAndAngle (TVector< T > &Axis, double &Angle) const
 
TVector< TToRotationVector () const
 
void ToSwingTwist (const TVector< T > &InTwistAxis, TQuat< T > &OutSwing, TQuat< T > &OutTwist) const
 
T GetTwistAngle (const TVector< T > &TwistAxis) const
 
TVector< TRotateVector (TVector< T > V) const
 
TVector< TUnrotateVector (TVector< T > V) const
 
TQuat< TLog () const
 
TQuat< TExp () const
 
FORCEINLINE TQuat< TInverse () const
 
void EnforceShortestArcWith (const TQuat< T > &OtherQuat)
 
FORCEINLINE TVector< TGetAxisX () const
 
FORCEINLINE TVector< TGetAxisY () const
 
FORCEINLINE TVector< TGetAxisZ () const
 
FORCEINLINE TVector< TGetForwardVector () const
 
FORCEINLINE TVector< TGetRightVector () const
 
FORCEINLINE TVector< TGetUpVector () const
 
FORCEINLINE TVector< TVector () const
 
TRotator< TRotator () const
 
FORCEINLINE TMatrix< TToMatrix () const
 
void ToMatrix (TMatrix< T > &Mat) const
 
FORCEINLINE TVector< TGetRotationAxis () const
 
FORCEINLINE T AngularDistance (const TQuat< T > &Q) const
 
bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
bool ContainsNaN () const
 
FString ToString () const
 
bool InitFromString (const FString &InSourceString)
 
FORCEINLINE void DiagnosticCheckNaN () const
 
FORCEINLINE void DiagnosticCheckNaN (const TCHAR *Message) const
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
 TQuat (const TQuat< FArg > &From)
 

Static Public Member Functions

static FORCEINLINE TQuat< TMakeFromVectorRegister (const QuatVectorRegister &V)
 
static FORCEINLINE TQuat< TMakeFromRotator (const TRotator< T > &R)
 
static TQuat< TMakeFromEuler (const TVector< T > &Euler)
 
static TQuat< TMakeFromRotationVector (const TVector< T > &RotationVector)
 
static FORCEINLINE TQuat< TFindBetween (const TVector< T > &Vector1, const TVector< T > &Vector2)
 
static TQuat< TFindBetweenNormals (const TVector< T > &Normal1, const TVector< T > &Normal2)
 
static TQuat< TFindBetweenVectors (const TVector< T > &Vector1, const TVector< T > &Vector2)
 
static FORCEINLINE T Error (const TQuat< T > &Q1, const TQuat< T > &Q2)
 
static FORCEINLINE T ErrorAutoNormalize (const TQuat< T > &A, const TQuat< T > &B)
 
static FORCEINLINE TQuat< TFastLerp (const TQuat< T > &A, const TQuat< T > &B, const T Alpha)
 
static FORCEINLINE TQuat< TFastBilerp (const TQuat< T > &P00, const TQuat< T > &P10, const TQuat< T > &P01, const TQuat< T > &P11, T FracX, T FracY)
 
static TQuat< TSlerp_NotNormalized (const TQuat< T > &Quat1, const TQuat< T > &Quat2, T Slerp)
 
static FORCEINLINE TQuat< TSlerp (const TQuat< T > &Quat1, const TQuat< T > &Quat2, T Slerp)
 
static TQuat< TSlerpFullPath_NotNormalized (const TQuat< T > &quat1, const TQuat< T > &quat2, T Alpha)
 
static FORCEINLINE TQuat< TSlerpFullPath (const TQuat< T > &quat1, const TQuat< T > &quat2, T Alpha)
 
static TQuat< TSquad (const TQuat< T > &quat1, const TQuat< T > &tang1, const TQuat< T > &quat2, const TQuat< T > &tang2, T Alpha)
 
static TQuat< TSquadFullPath (const TQuat< T > &quat1, const TQuat< T > &tang1, const TQuat< T > &quat2, const TQuat< T > &tang2, T Alpha)
 
static void CalcTangents (const TQuat< T > &PrevP, const TQuat< T > &P, const TQuat< T > &NextP, T Tension, TQuat< T > &OutTan)
 

Public Attributes

T X
 
T Y
 
T Z
 
T W
 

Static Public Attributes

static const TQuat< TIdentity
 

Protected Member Functions

 TQuat (const 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.

Definition at line 37 of file Quat.h.

Member Typedef Documentation

◆ FReal

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

Type of the template param (float or double)

Definition at line 44 of file Quat.h.

◆ QuatVectorRegister

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

Definition at line 45 of file Quat.h.

Constructor & Destructor Documentation

◆ TQuat() [1/9]

template<typename T >
FORCEINLINE UE::Math::TQuat< T >::TQuat ( )
inline

Default constructor (no initialization).

Definition at line 67 of file Quat.h.

◆ TQuat() [2/9]

template<typename T >
FORCEINLINE 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)

Definition at line 826 of file Quat.h.

◆ TQuat() [3/9]

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

Constructor.

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

Definition at line 831 of file Quat.h.

◆ TQuat() [4/9]

template<typename T >
template<TEMPLATE_REQUIRES(std::is_arithmetic< T >::value) >
FORCEINLINE UE::Math::TQuat< T >::TQuat ( T V)
inlineexplicit

Initializes all elements to V

Definition at line 90 of file Quat.h.

◆ TQuat() [5/9]

template<typename T >
FORCEINLINE UE::Math::TQuat< T >::TQuat ( const QuatVectorRegister & V)
explicitprotected

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

Definition at line 842 of file Quat.h.

◆ TQuat() [6/9]

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

Creates and initializes a new quaternion from the given rotator.

Parameters
RThe rotator to initialize from.

Definition at line 810 of file Quat.h.

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

Definition at line 734 of file Quat.h.

◆ TQuat() [8/9]

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

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)

Definition at line 871 of file Quat.h.

◆ TQuat() [9/9]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
UE::Math::TQuat< T >::TQuat ( const TQuat< FArg > & From)
inlineexplicit

Definition at line 692 of file Quat.h.

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)

Definition at line 1188 of file Quat.h.

◆ CalcTangents()

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

Calculate tangents between given points

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

◆ ContainsNaN()

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

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.

Definition at line 1345 of file Quat.h.

◆ DiagnosticCheckNaN() [1/2]

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

Definition at line 582 of file Quat.h.

◆ DiagnosticCheckNaN() [2/2]

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

Definition at line 583 of file Quat.h.

◆ EnforceShortestArcWith()

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

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

Definition at line 1234 of file Quat.h.

◆ Equals()

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

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.

Definition at line 942 of file Quat.h.

◆ Error()

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

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.

Definition at line 1300 of file Quat.h.

◆ ErrorAutoNormalize()

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

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

Definition at line 1308 of file Quat.h.

◆ 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 >
FORCEINLINE TQuat< T > UE::Math::TQuat< T >::FastBilerp ( const TQuat< T > & P00,
const TQuat< T > & P10,
const TQuat< T > & P01,
const TQuat< T > & P11,
T FracX,
T FracY )
static

Bi-Linear Quaternion interpolation. Result is NOT normalized.

Definition at line 1334 of file Quat.h.

◆ FastLerp()

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

Fast Linear Quaternion Interpolation. Result is NOT normalized.

Definition at line 1324 of file Quat.h.

◆ FindBetween()

template<typename T >
static FORCEINLINE 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.

Definition at line 591 of file Quat.h.

◆ FindBetweenNormals()

template<typename T >
static 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 >
static 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 >
FORCEINLINE T UE::Math::TQuat< T >::GetAngle ( ) const

Get the angle in radians of this quaternion

Definition at line 1132 of file Quat.h.

◆ GetAxisX()

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

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

Definition at line 1247 of file Quat.h.

◆ GetAxisY()

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

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

Definition at line 1254 of file Quat.h.

◆ GetAxisZ()

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

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

Definition at line 1261 of file Quat.h.

◆ GetForwardVector()

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

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

Definition at line 1268 of file Quat.h.

◆ GetNormalized()

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

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

Parameters
ToleranceMinimum squared length of quaternion for normalization.

Definition at line 1098 of file Quat.h.

◆ GetRightVector()

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

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

Definition at line 1274 of file Quat.h.

◆ GetRotationAxis()

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

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.

Definition at line 1168 of file Quat.h.

◆ 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 >
FORCEINLINE TVector< T > UE::Math::TQuat< T >::GetUpVector ( ) const

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

Definition at line 1280 of file Quat.h.

◆ Identical()

template<typename T >
FORCEINLINE 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.

Definition at line 1026 of file Quat.h.

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

Definition at line 856 of file Quat.h.

◆ Inverse()

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

Definition at line 1222 of file Quat.h.

◆ IsIdentity()

template<typename T >
FORCEINLINE bool UE::Math::TQuat< T >::IsIdentity ( T 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.

Definition at line 959 of file Quat.h.

◆ IsNormalized()

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

Definition at line 1107 of file Quat.h.

◆ Log()

template<typename T >
TQuat< T > UE::Math::TQuat< T >::Log ( ) const
Returns
quaternion with W=0 and V=theta*v.

◆ MakeFromEuler()

template<typename T >
static 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

◆ MakeFromRotationVector()

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

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

Definition at line 1161 of file Quat.h.

◆ MakeFromRotator()

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

Definition at line 115 of file Quat.h.

◆ MakeFromVectorRegister()

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

Definition at line 106 of file Quat.h.

◆ 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 >
FORCEINLINE void UE::Math::TQuat< T >::Normalize ( T Tolerance = UE_SMALL_NUMBER)

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.

Definition at line 1065 of file Quat.h.

◆ operator!=()

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

Checks whether two quaternions are not identical.

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

Definition at line 1045 of file Quat.h.

◆ operator*() [1/4]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 268 of file Quat.h.

◆ 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 >
FORCEINLINE TQuat< T > UE::Math::TQuat< T >::operator* ( const TQuat< T > & Q) const

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

Definition at line 985 of file Quat.h.

◆ operator*() [4/4]

template<typename T >
FORCEINLINE 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

Definition at line 817 of file Quat.h.

◆ operator*=() [1/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 244 of file Quat.h.

◆ operator*=() [2/2]

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

Definition at line 997 of file Quat.h.

◆ operator+()

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

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.

Definition at line 887 of file Quat.h.

◆ operator+=()

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.

Definition at line 900 of file Quat.h.

◆ operator-() [1/2]

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

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

Returns
The result of negation.

Definition at line 932 of file Quat.h.

◆ operator-() [2/2]

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

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.

Definition at line 920 of file Quat.h.

◆ operator-=()

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.

Definition at line 965 of file Quat.h.

◆ operator/()

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 311 of file Quat.h.

◆ operator/=()

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 286 of file Quat.h.

◆ operator==()

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

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

Definition at line 1032 of file Quat.h.

◆ operator|()

template<typename T >
FORCEINLINE 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.

Definition at line 1058 of file Quat.h.

◆ RotateVector()

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

Rotate a vector by this quaternion.

Parameters
Vthe vector to be rotated
Returns
vector after rotation

Definition at line 1196 of file Quat.h.

◆ Rotator()

FRotator3d FQuat4d::Rotator ( ) const

Get the TRotator<T> representation of this Quaternion.

◆ Serialize()

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

Definition at line 682 of file Quat.h.

◆ SerializeFromMismatchedTag()

bool FQuat4d::SerializeFromMismatchedTag ( FName StructTag,
FArchive & Ar )
inline

Definition at line 1389 of file Quat.h.

◆ Size()

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

Get the length of this quaternion.

Returns
The length of this quaternion.

Definition at line 1120 of file Quat.h.

◆ SizeSquared()

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

Get the length squared of this quaternion.

Returns
The length of this quaternion.

Definition at line 1126 of file Quat.h.

◆ Slerp()

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

Spherical interpolation. Will correct alignment. Result is normalized.

Definition at line 635 of file Quat.h.

◆ Slerp_NotNormalized()

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

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

◆ SlerpFullPath()

template<typename T >
static FORCEINLINE TQuat< T > UE::Math::TQuat< T >::SlerpFullPath ( const TQuat< T > & quat1,
const TQuat< T > & quat2,
T 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.

Definition at line 652 of file Quat.h.

◆ SlerpFullPath_NotNormalized()

template<typename T >
static TQuat< T > UE::Math::TQuat< T >::SlerpFullPath_NotNormalized ( const TQuat< T > & quat1,
const TQuat< T > & quat2,
T 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 >
static TQuat< T > UE::Math::TQuat< T >::Squad ( const TQuat< T > & quat1,
const TQuat< T > & tang1,
const TQuat< T > & quat2,
const TQuat< T > & tang2,
T 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 >
static TQuat< T > UE::Math::TQuat< T >::SquadFullPath ( const TQuat< T > & quat1,
const TQuat< T > & tang1,
const TQuat< T > & quat2,
const TQuat< T > & tang2,
T 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 >
FORCEINLINE void UE::Math::TQuat< T >::ToAxisAndAngle ( TVector< T > & Axis,
double & Angle ) const

Definition at line 1146 of file Quat.h.

◆ ToAxisAndAngle() [2/2]

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

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.

Definition at line 1139 of file Quat.h.

◆ ToMatrix() [1/2]

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

Get the TMatrix<T> representation of this Quaternion.

Definition at line 1292 of file Quat.h.

◆ 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 >
FORCEINLINE TVector< T > UE::Math::TQuat< T >::ToRotationVector ( ) const

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.

Definition at line 1153 of file Quat.h.

◆ ToString()

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

Get a textual representation of the vector.

Returns
Text describing the vector.

Definition at line 850 of file Quat.h.

◆ 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 >
FORCEINLINE TVector< T > UE::Math::TQuat< T >::UnrotateVector ( TVector< T > V) const

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.

Definition at line 1212 of file Quat.h.

◆ Vector()

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

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

Definition at line 1286 of file Quat.h.

Member Data Documentation

◆ Identity

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

Identity quaternion.

Definition at line 62 of file Quat.h.

◆ W

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

The quaternion's W-component.

Definition at line 57 of file Quat.h.

◆ X

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

The quaternion's X-component.

Definition at line 48 of file Quat.h.

◆ Y

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

The quaternion's Y-component.

Definition at line 51 of file Quat.h.

◆ Z

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

The quaternion's Z-component.

Definition at line 54 of file Quat.h.


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