![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <Quat.h>
Public Types | |
| using | FReal = T |
| using | QuatVectorRegister = TVectorRegisterType< T > |
Public Attributes | |
| T | X |
| T | Y |
| T | Z |
| T | W |
Static Public Attributes | |
| static CORE_API const TQuat< T > | Identity |
Protected Member Functions | |
| TQuat (QuatVectorRegister V) | |
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.
| using UE::Math::TQuat< T >::FReal = T |
Type of the template param (float or double)
| using UE::Math::TQuat< T >::QuatVectorRegister = TVectorRegisterType<T> |
|
default |
Default constructor (no initialization).
|
explicit |
Creates and initializes a new quaternion, with the W component either 0 or 1.
| EForceInit | Force init enum: if equal to ForceInitToZero then W is 0, otherwise W = 1 (creating an identity transform) |
|
inline |
Constructor.
| InX | X component of the quaternion |
| InY | Y component of the quaternion |
| InZ | Z component of the quaternion |
| InW | W component of the quaternion |
|
inlineexplicit |
Initializes all elements to V
|
inlineexplicitprotected |
Creates and initializes a new quaternion from the XYZW values in the given VectorRegister4Float.
| V | XYZW components of the quaternion packed into a single VectorRegister4Float |
|
inlineexplicit |
Creates and initializes a new quaternion from the given rotator.
| R | The rotator to initialize from. |
|
inlineexplicit |
Creates and initializes a new quaternion from the given matrix.
| M | The rotation matrix to initialize from. |
|
inline |
Creates and initializes a new quaternion from the a rotation around the given axis.
| Axis | assumed to be a normalized vector |
| Angle | angle to rotate above the given axis (in radians) |
|
inlineexplicit |
| T UE::Math::TQuat< T >::AngularDistance | ( | const TQuat< T > & | Q | ) | const |
Find the angular distance between two rotation quaternions (in radians)
|
static |
Calculate tangents between given points
| PrevP | quaternion at P-1 |
| P | quaternion to return the tangent |
| NextP | quaternion P+1 |
| Tension | |
| OutTan | Out control point |
|
inline |
Utility to check if there are any non-finite values (NaN or Inf) in this Quat.
|
inline |
|
inline |
|
inline |
Enforce that the delta between this Quaternion and another one represents the shortest possible rotation angle
|
inline |
Checks whether another Quaternion is equal to this, within specified tolerance.
| Q | The other Quaternion. |
| Tolerance | Error tolerance for comparison with other Quaternion. |
|
inlinestatic |
Error measure (angle) between two quaternions, ranged [0..1]. Returns the hypersphere-angle between two quaternions; alignment shouldn't matter, though
|
inlinestatic |
TQuat<T>::Error with auto-normalization.
| TVector< T > UE::Math::TQuat< T >::Euler | ( | ) | const |
Convert a Quaternion into floating-point Euler angles (in degrees).
| TQuat< T > UE::Math::TQuat< T >::Exp | ( | ) | const |
|
inlinestatic |
Bi-Linear Quaternion interpolation. Result is NOT normalized.
|
inlinestatic |
Fast Linear Quaternion Interpolation. Result is NOT normalized.
|
inlinestatic |
Generates the 'smallest' (geodesic) rotation between two vectors of arbitrary length.
|
static |
Generates the 'smallest' (geodesic) rotation between two normals (assumed to be unit length).
|
static |
Generates the 'smallest' (geodesic) rotation between two vectors of arbitrary length.
| UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::GetAngle | ( | ) | const |
Get the angle in radians of this quaternion
| 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.
| 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.
| 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.
| 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.
|
inline |
Get a normalized copy of this quaternion. If it is too small, returns an identity quaternion.
| Tolerance | Minimum squared length of quaternion for normalization. |
| 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.
|
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.
|
inline |
Returns the version of this quaternion that represents the shortest rotation angle to the other quaternion
| T UE::Math::TQuat< T >::GetTwistAngle | ( | const TVector< T > & | TwistAxis | ) | const |
Get the twist angle (in radians) for a specified axis
| TwistAxis | Axis to use for decomposition |
| 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.
| 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.
|
inline |
|
inline |
| UE_FORCEINLINE_HINT 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.
| Tolerance | Error tolerance for comparison with Identity Quaternion. |
|
inline |
| TQuat< T > UE::Math::TQuat< T >::Log | ( | ) | const |
|
static |
Convert a vector of floating-point Euler angles (in degrees) into a Quaternion.
| Euler | the Euler angles |
|
static |
|
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.
|
inlinestatic |
|
inlinestatic |
| bool UE::Math::TQuat< T >::NetSerialize | ( | FArchive & | Ar, |
| class UPackageMap * | Map, | ||
| bool & | bOutSuccess | ||
| ) |
Serializes the vector compressed for e.g. network transmission.
| Ar | Archive to serialize to/ from. |
|
inline |
Normalize this quaternion if it is large enough. If it is too small, returns an identity quaternion.
| Tolerance | Minimum squared length of quaternion for normalization. |
|
inline |
Checks whether two quaternions are not identical.
| Q | The other quaternion. |
|
inline |
Get the result of scaling this quaternion.
| Scale | The scaling factor. |
| 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.
| M | Matrix to multiply by. |
|
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).
| Q | The Quaternion to multiply this by. |
| UE_FORCEINLINE_HINT TVector< T > UE::Math::TQuat< T >::operator* | ( | const TVector< T > & | V | ) | const |
Rotate a vector by this quaternion.
| V | the vector to be rotated |
|
inline |
Multiply this quaternion by a scaling factor.
| Scale | The scaling factor. |
|
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).
| Q | the quaternion to multiply this by. |
|
inline |
Gets the result of adding a Quaternion to this. This is a component-wise addition; composing quaternions should be done via multiplication.
| Q | The Quaternion to add. |
|
inline |
Adds to this quaternion. This is a component-wise addition; composing quaternions should be done via multiplication.
| Other | The quaternion to add to this. |
|
inline |
Negates the quaternion. Note that this represents the same rotation.
|
inline |
Gets the result of subtracting a Quaternion to this. This is a component-wise subtraction; composing quaternions should be done via multiplication.
| Q | The Quaternion to subtract. |
|
inline |
Subtracts another quaternion from this. This is a component-wise subtraction; composing quaternions should be done via multiplication.
| Q | The other quaternion. |
|
inline |
Divide this quaternion by scale.
| Scale | What to divide by. |
|
inline |
Divide this quaternion by scale.
| Scale | What to divide by. |
|
inline |
| UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::operator| | ( | const TQuat< T > & | Q | ) | const |
Calculates dot product of two quaternions.
| Q | The other quaternions. |
|
inline |
Rotate a vector by this quaternion.
| V | the vector to be rotated |
| CORE_API TRotator< T > UE::Math::TQuat< T >::Rotator | ( | ) | const |
Get the TRotator<T> representation of this Quaternion.
|
inline |
|
inline |
| UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::Size | ( | ) | const |
Get the length of this quaternion.
| UE_FORCEINLINE_HINT T UE::Math::TQuat< T >::SizeSquared | ( | ) | const |
Get the length squared of this quaternion.
|
inlinestatic |
Spherical interpolation. Will correct alignment. Result is normalized.
|
static |
Spherical interpolation. Will correct alignment. Result is NOT normalized.
|
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.
|
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.
|
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.
|
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.
|
inline |
|
inline |
get the axis and angle of rotation of this quaternion
| Axis{out] | Normalized rotation axis of the quaternion |
| Angle{out] | Angle of the quaternion in radians |
| TTuple< T, T, T > UE::Math::TQuat< T >::ToLUFEuler | ( | ) | const |
|
inline |
Get the TMatrix<T> representation of this Quaternion.
| void UE::Math::TQuat< T >::ToMatrix | ( | TMatrix< T > & | Mat | ) | const |
Get the TMatrix<T> representation of this Quaternion and store it in Mat
|
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.
| UE_FORCEINLINE_HINT FString UE::Math::TQuat< T >::ToString | ( | ) | const |
Get a textual representation of the vector.
| 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
| InTwistAxis | Axis to use for decomposition |
| OutSwing | swing component quaternion |
| OutTwist | Twist component quaternion |
|
inline |
Rotate a vector by the inverse of this quaternion.
| V | the vector to be rotated |
| 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().
|
static |
Identity quaternion.
| T UE::Math::TQuat< T >::W |
The quaternion's W-component.
| T UE::Math::TQuat< T >::X |
The quaternion's X-component.
| T UE::Math::TQuat< T >::Y |
The quaternion's Y-component.
| T UE::Math::TQuat< T >::Z |
The quaternion's Z-component.