Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Quat.h File Reference
#include "../BasicTypes.h"
#include "UnrealMathUtility.h"
#include "Vector.h"
#include "Rotator.h"
+ Include dependency graph for Quat.h:

Go to the source code of this file.

Classes

struct  TIsPODType< FQuat >
 

Functions

 MS_ALIGN (16) struct FQuat
 
 GCC_ALIGN (16)
 

Function Documentation

◆ GCC_ALIGN()

GCC_ALIGN ( 16 )

◆ MS_ALIGN()

MS_ALIGN ( 16 )

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.

The quaternion's X-component.

The quaternion's Y-component.

The quaternion's Z-component.

The quaternion's W-component.

Identity quaternion.

Default constructor (no initialization).

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)

Constructor.

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

Copy constructor.

Parameters
QA FQuat object to use to create new quaternion from.

Creates and initializes a new quaternion from the given rotator.

Parameters
RThe rotator to initialize from.

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)

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.

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.

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.

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.

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.

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.

Rotate a vector by this quaternion.

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

Multiply this quaternion by a scaling factor.

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

Get the result of scaling this quaternion.

Parameters
ScaleThe scaling factor.
Returns
The result of scaling.

Divide this quaternion by scale.

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

Divide this quaternion by scale.

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

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

Checks whether two quaternions are not identical.

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

Calculates dot product of two quaternions.

Parameters
QThe other quaternions.
Returns
The dot product.

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

Parameters
Eulerthe Euler angles
Returns
constructed FQuat

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

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.

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

Parameters
ToleranceMinimum squared length of quaternion for normalization.

Get the length of this quaternion.

Returns
The length of this quaternion.

Get the length squared of this quaternion.

Returns
The length of this quaternion.

Get the angle of this quaternion

get the axis and angle of rotation of this quaternion

Parameters
Axis{out]vector of axis of the quaternion
Angle{out]angle of the quaternion
Warning
: assumes normalized quaternions.

Get the swing and twist decomposition for a specified axis

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

Rotate a vector by this quaternion.

Parameters
Vthe vector to be rotated
Returns
vector after rotation

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.
quaternion with W=0 and V=theta*v.
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))
Returns
inverse of this quaternion

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

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

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

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

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

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

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

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

Get the FRotator representation of this Quaternion.

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, FVector(1,0,0) is returned.

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

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.

Get a textual representation of the vector.

Returns
Text describing the vector.

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

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

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

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

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

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.

FQuat::Error with auto-normalization.

Fast Linear Quaternion Interpolation. Result is NOT normalized.

Bi-Linear Quaternion interpolation. Result is NOT normalized.

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

Spherical interpolation. Will correct alignment. Result is normalized.

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.

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.

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.

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.

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

Definition at line 21 of file Quat.h.