Navigation
Unreal Engine C++ API Reference > Runtime > Core > Math
Inheritance Hierarchy
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/Math/MathFwd.h |
Include | #include "Math/MathFwd.h" |
Syntax
template<typename T>
struct TQuat
Remarks
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.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
T | W | The quaternion's W-component. |
![]() |
T | X | The quaternion's X-component. |
![]() |
T | Y | The quaternion's Y-component. |
![]() |
T | Z | The quaternion's Z-component. |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
TQuat () |
Default constructor (no initialization). | |
![]() |
TQuat
(
EForceInit |
Creates and initializes a new quaternion, with the W component either 0 or 1. | |
![]() |
TQuat
(
T V |
Initializes all elements to V | |
![]() |
Creates and initializes a new quaternion from the given rotator. | ||
![]() |
Creates and initializes a new quaternion from the given matrix. | ||
![]() |
Conversion to other type. | ||
![]() |
TQuat
(
const QuatVectorRegister& V |
Creates and initializes a new quaternion from the XYZW values in the given VectorRegister4Float. | |
![]() |
Creates and initializes a new quaternion from the a rotation around the given axis. | ||
![]() |
TQuat
(
T InX, |
Constructor. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
T | AngularDistance
(
const TQuat< T >& Q |
Find the angular distance between two rotation quaternions (in radians) |
![]() ![]() |
void | CalcTangents
(
const TQuat< T >& PrevP, |
Calculate tangents between given points |
![]() ![]() |
bool | ContainsNaN () |
Utility to check if there are any non-finite values (NaN or Inf) in this Quat. |
![]() ![]() |
void | DiagnosticCheckNaN
(
const TCHAR* Message |
|
![]() ![]() |
void | ||
![]() |
void | EnforceShortestArcWith
(
const TQuat< T >& OtherQuat |
Enforce that the delta between this Quaternion and another one represents the shortest possible rotation angle |
![]() ![]() |
bool | Checks whether another Quaternion is equal to this, within specified tolerance. | |
![]() ![]() |
T | Error measure (angle) between two quaternions, ranged [0..1]. | |
![]() ![]() |
T | ErrorAutoNormalize
(
const TQuat< T >& A, |
TQuat |
![]() ![]() |
TVector< T > | Euler () |
Convert a Quaternion into floating-point Euler angles (in degrees). |
![]() ![]() |
TQuat< T > | Exp () |
Exp should really only be used after Log. |
![]() ![]() |
TQuat< T > | FastBilerp
(
const TQuat< T >& P00, |
Bi-Linear Quaternion interpolation. Result is NOT normalized. |
![]() ![]() |
TQuat< T > | Fast Linear Quaternion Interpolation. Result is NOT normalized. | |
![]() ![]() |
TQuat< T > | FindBetween
(
const TVector< T >& Vector1, |
Generates the 'smallest' (geodesic) rotation between two vectors of arbitrary length. |
![]() ![]() |
TQuat< T > | FindBetweenNormals
(
const TVector< T >& Normal1, |
Generates the 'smallest' (geodesic) rotation between two normals (assumed to be unit length). |
![]() ![]() |
TQuat< T > | FindBetweenVectors
(
const TVector< T >& Vector1, |
Generates the 'smallest' (geodesic) rotation between two vectors of arbitrary length. |
![]() ![]() |
T | GetAngle () |
Get the angle in radians of this quaternion |
![]() ![]() |
TVector< T > | GetAxisX () |
Get the forward direction (X axis) after it has been rotated by this Quaternion. |
![]() ![]() |
TVector< T > | GetAxisY () |
Get the right direction (Y axis) after it has been rotated by this Quaternion. |
![]() ![]() |
TVector< T > | GetAxisZ () |
Get the up direction (Z axis) after it has been rotated by this Quaternion. |
![]() ![]() |
TVector< T > | Get the forward direction (X axis) after it has been rotated by this Quaternion. | |
![]() ![]() |
TQuat< T > | GetNormalized
(
T Tolerance |
Get a normalized copy of this quaternion. If it is too small, returns an identity quaternion. |
![]() ![]() |
TVector< T > | Get the right direction (Y axis) after it has been rotated by this Quaternion. | |
![]() ![]() |
TVector< T > | Get the axis of rotation of the Quaternion. | |
![]() ![]() |
T | GetTwistAngle
(
const TVector< T >& TwistAxis |
Get the twist angle (in radians) for a specified axis |
![]() ![]() |
TVector< T > | GetUpVector () |
Get the up direction (Z axis) after it has been rotated by this Quaternion. |
![]() ![]() |
bool | Identical implementation for TQuat properties. | |
![]() |
bool | InitFromString
(
const FString& InSourceString |
Initialize this TQuat from a FString. |
![]() ![]() |
TQuat< T > | Inverse () |
: Requires this quaternion to be normalized. |
![]() ![]() |
bool | IsIdentity
(
T Tolerance |
Checks whether this Quaternion is an Identity Quaternion. Assumes Quaternion tested is normalized. |
![]() ![]() |
bool | IsNormalized () |
Return true if this quaternion is normalized. |
![]() ![]() |
TQuat< T > | Log () |
|
![]() ![]() |
TQuat< T > | MakeFromEuler
(
const TVector< T >& Euler |
Convert a vector of floating-point Euler angles (in degrees) into a Quaternion. |
![]() ![]() |
TQuat< T > | MakeFromRotationVector
(
const TVector< T >& RotationVector |
Constructs a quaternion corresponding to the rotation vector. |
![]() ![]() |
TQuat< T > | MakeFromRotator
(
const TRotator< T >& R |
|
![]() ![]() |
TQuat< T > | MakeFromVectorRegister
(
const QuatVectorRegister& V |
|
![]() |
bool | NetSerialize
(
FArchive& Ar, |
Serializes the vector compressed for e.g. network transmission. |
![]() |
void | Normalize
(
T Tolerance |
Normalize this quaternion if it is large enough. |
![]() ![]() |
TVector< T > | RotateVector
(
TVector< T > V |
Rotate a vector by this quaternion. |
![]() ![]() |
TRotator< T > | Rotator () |
Get the TRotator |
![]() |
bool | ||
![]() |
bool | SerializeFromMismatchedTag
(
FName StructTag, |
|
![]() ![]() |
T | Size () |
Get the length of this quaternion. |
![]() ![]() |
T | SizeSquared () |
Get the length squared of this quaternion. |
![]() ![]() |
TQuat< T > | Spherical interpolation. Will correct alignment. Result is normalized. | |
![]() ![]() |
TQuat< T > | Slerp_NotNormalized
(
const TQuat< T >& Quat1, |
Spherical interpolation. Will correct alignment. Result is NOT normalized. |
![]() ![]() |
TQuat< T > | SlerpFullPath
(
const TQuat< T >& quat1, |
Simpler Slerp that doesn't do any checks for 'shortest distance' etc. |
![]() ![]() |
TQuat< T > | SlerpFullPath_NotNormalized
(
const TQuat< T >& quat1, |
Simpler Slerp that doesn't do any checks for 'shortest distance' etc. |
![]() ![]() |
TQuat< T > | 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. | |
![]() ![]() |
TQuat< T > | SquadFullPath
(
const TQuat< T >& quat1, |
Simpler Squad that doesn't do any checks for 'shortest distance' etc. |
![]() ![]() |
void | ToAxisAndAngle
(
TVector< T >& Axis, |
Get the axis and angle of rotation of this quaternion |
![]() ![]() |
void | ToAxisAndAngle
(
TVector< T >& Axis, |
Get the axis and angle of rotation of this quaternion |
![]() ![]() |
void | Get the TMatrix |
|
![]() ![]() |
TMatrix< T > | ToMatrix () |
Get the TMatrix |
![]() ![]() |
TVector< T > | Get the rotation vector corresponding to this quaternion. | |
![]() ![]() |
FString | ToString () |
Get a textual representation of the vector. |
![]() ![]() |
void | ToSwingTwist
(
const TVector< T >& InTwistAxis, |
Get the swing and twist decomposition for a specified axis |
![]() ![]() |
TVector< T > | UnrotateVector
(
TVector< T > V |
Rotate a vector by the inverse of this quaternion. |
![]() ![]() |
TVector< T > | Vector () |
Convert a rotation into a unit vector facing in its direction. |
Operators
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
TQuat< T > | Gets the result of subtracting a Quaternion to this. | |
![]() ![]() |
TQuat< T > | operator- () |
Negates the quaternion. Note that this represents the same rotation. |
![]() ![]() |
bool | operator!=
(
const TQuat< T >& Q |
Checks whether two quaternions are not identical. |
![]() ![]() |
TQuat< T > | operator*
(
const FArg Scale |
Get the result of scaling this quaternion. |
![]() ![]() |
TMatrix< T > | Multiply this by a matrix. | |
![]() ![]() |
TVector< T > | Rotate a vector by this quaternion. | |
![]() ![]() |
TQuat< T > | Gets the result of multiplying this by another quaternion (this * Q). | |
![]() |
TQuat< T > | operator*=
(
const FArg Scale |
Multiply this quaternion by a scaling factor. |
![]() |
TQuat< T > | operator*=
(
const TQuat< T >& Q |
Multiply this by a quaternion (this = this * Q). |
![]() ![]() |
TQuat< T > | operator/
(
const FArg Scale |
Divide this quaternion by scale. |
![]() |
TQuat< T > | operator/=
(
const FArg Scale |
Divide this quaternion by scale. |
![]() ![]() |
T | Calculates dot product of two quaternions. | |
![]() ![]() |
TQuat< T > | Gets the result of adding a Quaternion to this. | |
![]() |
TQuat< T > | operator+=
(
const TQuat< T >& Q |
Adds to this quaternion. |
![]() |
TQuat< T > | operator-=
(
const TQuat< T >& Q |
Subtracts another quaternion from this. |
![]() ![]() |
bool | operator==
(
const TQuat< T >& Q |
Checks whether two quaternions are identical. |
Typedefs
Name | Description |
---|---|
FReal | Can't have a TEMPLATE_REQUIRES in the declaration because of the forward declarations, so check for allowed types here. |
QuatVectorRegister |
Constants
Name | Description |
---|---|
Identity | Identity quaternion. |