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

#include <Rotator.h>

Public Types

using FReal = T
 

Public Member Functions

FORCEINLINE void DiagnosticCheckNaN () const
 
FORCEINLINE void DiagnosticCheckNaN (const TCHAR *Message) const
 
FORCEINLINE TRotator ()
 
FORCEINLINE TRotator (T InF)
 
FORCEINLINE TRotator (T InPitch, T InYaw, T InRoll)
 
FORCEINLINE TRotator (EForceInit)
 
 TRotator (const TQuat< T > &Quat)
 
TRotator operator+ (const TRotator< T > &R) const
 
TRotator operator- (const TRotator< T > &R) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TRotator operator* (FArg Scale) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TRotator operator*= (FArg Scale)
 
bool operator== (const TRotator< T > &R) const
 
bool operator!= (const TRotator< T > &V) const
 
TRotator operator+= (const TRotator< T > &R)
 
TRotator operator-= (const TRotator< T > &R)
 
bool IsNearlyZero (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
bool IsZero () const
 
bool Equals (const TRotator< T > &R, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
TRotator Add (T DeltaPitch, T DeltaYaw, T DeltaRoll)
 
TRotator GetInverse () const
 
TRotator GridSnap (const TRotator< T > &RotGrid) const
 
TVector< TVector () const
 
TQuat< TQuaternion () const
 
TVector< TEuler () const
 
TVector< TRotateVector (const UE::Math::TVector< T > &V) const
 
TVector< TUnrotateVector (const UE::Math::TVector< T > &V) const
 
TRotator< TClamp () const
 
TRotator< TGetNormalized () const
 
TRotator< TGetDenormalized () const
 
T GetComponentForAxis (EAxis::Type Axis) const
 
void SetComponentForAxis (EAxis::Type Axis, T Component)
 
void Normalize ()
 
void GetWindingAndRemainder (TRotator< T > &Winding, TRotator< T > &Remainder) const
 
T GetManhattanDistance (const TRotator< T > &Rotator) const
 
TRotator GetEquivalentRotator () const
 
void SetClosestToMe (TRotator &MakeClosest) const
 
FString ToString () const
 
FString ToCompactString () const
 
bool InitFromString (const FString &InSourceString)
 
bool ContainsNaN () const
 
void SerializeCompressed (FArchive &Ar)
 
void SerializeCompressedShort (FArchive &Ar)
 
bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
 TRotator (const TRotator< FArg > &From)
 

Static Public Member Functions

static T ClampAxis (T Angle)
 
static T NormalizeAxis (T Angle)
 
static uint8 CompressAxisToByte (T Angle)
 
static T DecompressAxisFromByte (uint8 Angle)
 
static uint16 CompressAxisToShort (T Angle)
 
static T DecompressAxisFromShort (uint16 Angle)
 
static TRotator MakeFromEuler (const TVector< T > &Euler)
 

Public Attributes

T Pitch
 
T Yaw
 
T Roll
 

Static Public Attributes

static const TRotator< TZeroRotator
 

Detailed Description

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

Implements a container for rotation information.

All rotation values are stored in degrees.

The angles are interpreted as intrinsic rotations applied in the order Yaw, then Pitch, then Roll. I.e., an object would be rotated first by the specified yaw around its up axis (with positive angles interpreted as clockwise when viewed from above, along -Z), then pitched around its (new) right axis (with positive angles interpreted as 'nose up', i.e. clockwise when viewed along +Y), and then finally rolled around its (final) forward axis (with positive angles interpreted as clockwise rotations when viewed along +X).

Note that these conventions differ from quaternion axis/angle. UE Quat always considers a positive angle to be a left-handed rotation, whereas Rotator treats yaw as left-handed but pitch and roll as right-handed.

Definition at line 35 of file Rotator.h.

Member Typedef Documentation

◆ FReal

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

Definition at line 42 of file Rotator.h.

Constructor & Destructor Documentation

◆ TRotator() [1/6]

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

Default constructor (no initialization).

Definition at line 86 of file Rotator.h.

◆ TRotator() [2/6]

template<typename T >
FORCEINLINE UE::Math::TRotator< T >::TRotator ( T InF)
explicit

Constructor

Parameters
InFValue to set all components to.

Definition at line 530 of file Rotator.h.

◆ TRotator() [3/6]

template<typename T >
FORCEINLINE UE::Math::TRotator< T >::TRotator ( T InPitch,
T InYaw,
T InRoll )

Constructor.

Parameters
InPitchPitch in degrees.
InYawYaw in degrees.
InRollRoll in degrees.

Definition at line 537 of file Rotator.h.

◆ TRotator() [4/6]

template<typename T >
FORCEINLINE UE::Math::TRotator< T >::TRotator ( EForceInit )
explicit

Constructor.

Parameters
EForceInitForce Init Enum.

Definition at line 544 of file Rotator.h.

◆ TRotator() [5/6]

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

Constructor.

Parameters
QuatQuaternion used to specify rotation.

◆ TRotator() [6/6]

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

Definition at line 471 of file Rotator.h.

Member Function Documentation

◆ Add()

template<typename T >
FORCEINLINE TRotator< T > UE::Math::TRotator< T >::Add ( T DeltaPitch,
T DeltaYaw,
T DeltaRoll )

Adds to each component of the rotator.

Parameters
DeltaPitchChange in pitch. (+/-)
DeltaYawChange in yaw. (+/-)
DeltaRollChange in roll. (+/-)
Returns
Copy of rotator after addition.

Definition at line 627 of file Rotator.h.

◆ Clamp()

template<typename T >
FORCEINLINE TRotator< T > UE::Math::TRotator< T >::Clamp ( ) const

Gets the rotation values so they fall within the range [0,360]

Returns
Clamped version of rotator.

Definition at line 648 of file Rotator.h.

◆ ClampAxis()

template<typename T >
FORCEINLINE T UE::Math::TRotator< T >::ClampAxis ( T Angle)
static

Clamps an angle to the range of [0, 360).

Parameters
AngleThe angle to clamp.
Returns
The clamped angle.

Definition at line 654 of file Rotator.h.

◆ CompressAxisToByte()

template<typename T >
FORCEINLINE uint8 UE::Math::TRotator< T >::CompressAxisToByte ( T Angle)
static

Compresses a floating point angle into a byte.

Parameters
AngleThe angle to compress.
Returns
The angle as a byte.

Definition at line 684 of file Rotator.h.

◆ CompressAxisToShort()

template<typename T >
FORCEINLINE uint16 UE::Math::TRotator< T >::CompressAxisToShort ( T Angle)
static

Compress a floating point angle into a word.

Parameters
AngleThe angle to compress.
Returns
The decompressed angle.

Definition at line 698 of file Rotator.h.

◆ ContainsNaN()

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

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

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

Definition at line 832 of file Rotator.h.

◆ DecompressAxisFromByte()

template<typename T >
FORCEINLINE T UE::Math::TRotator< T >::DecompressAxisFromByte ( uint8 Angle)
static

Decompress a word into a floating point angle.

Parameters
AngleThe word angle.
Returns
The decompressed angle.

Definition at line 691 of file Rotator.h.

◆ DecompressAxisFromShort()

template<typename T >
FORCEINLINE T UE::Math::TRotator< T >::DecompressAxisFromShort ( uint16 Angle)
static

Decompress a short into a floating point angle.

Parameters
AngleThe word angle.
Returns
The decompressed angle.

Definition at line 705 of file Rotator.h.

◆ DiagnosticCheckNaN() [1/2]

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

Definition at line 79 of file Rotator.h.

◆ DiagnosticCheckNaN() [2/2]

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

Definition at line 80 of file Rotator.h.

◆ Equals()

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

Checks whether two rotators are equal within specified tolerance, when treated as an orientation. This means that TRotator(0, 0, 360).Equals(TRotator(0,0,0)) is true, because they represent the same final orientation.

Parameters
RThe other rotator.
ToleranceError Tolerance.
Returns
true if two rotators are equal, within specified tolerance, otherwise false.

Definition at line 611 of file Rotator.h.

◆ Euler()

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

Convert a Rotator into floating-point Euler angles (in degrees). Rotator now stored in degrees.

Returns
Rotation as a Euler angle vector.

◆ GetComponentForAxis()

template<typename T >
FORCEINLINE T UE::Math::TRotator< T >::GetComponentForAxis ( EAxis::Type Axis) const

Get a specific component of the vector, given a specific axis by enum

Definition at line 745 of file Rotator.h.

◆ GetDenormalized()

template<typename T >
FORCEINLINE TRotator< T > UE::Math::TRotator< T >::GetDenormalized ( ) const

Create a copy of this rotator and denormalize, clamping each axis to 0 - 360.

Returns
Denormalized copy of this rotator

Definition at line 720 of file Rotator.h.

◆ GetEquivalentRotator()

template<typename T >
FORCEINLINE TRotator< T > UE::Math::TRotator< T >::GetEquivalentRotator ( ) const

Return a Rotator that has the same rotation but has different degree values for Yaw, Pitch, and Roll. This rotator should be within -180,180 range,

Returns
A Rotator with the same rotation but different degrees.

Definition at line 846 of file Rotator.h.

◆ GetInverse()

template<typename T >
TRotator UE::Math::TRotator< T >::GetInverse ( ) const

Returns the inverse of the rotator.

◆ GetManhattanDistance()

template<typename T >
FORCEINLINE T UE::Math::TRotator< T >::GetManhattanDistance ( const TRotator< T > & Rotator) const

Return the manhattan distance in degrees between this Rotator and the passed in one.

Parameters
Rotator[In]the Rotator we are comparing with.
Returns
Distance(Manhattan) between the two rotators.

Definition at line 840 of file Rotator.h.

◆ GetNormalized()

template<typename T >
FORCEINLINE TRotator< T > UE::Math::TRotator< T >::GetNormalized ( ) const

Create a copy of this rotator and normalize, removes all winding and creates the "shortest route" rotation.

Returns
Normalized copy of this rotator

Definition at line 712 of file Rotator.h.

◆ GetWindingAndRemainder()

template<typename T >
void UE::Math::TRotator< T >::GetWindingAndRemainder ( TRotator< T > & Winding,
TRotator< T > & Remainder ) const

Decompose this Rotator into a Winding part (multiples of 360) and a Remainder part. Remainder will always be in [-180, 180] range.

Parameters
Winding[Out]the Winding part of this Rotator
Remainder[Out]the Remainder

◆ GridSnap()

template<typename T >
FORCEINLINE TRotator< T > UE::Math::TRotator< T >::GridSnap ( const TRotator< T > & RotGrid) const

Get the rotation, snapped to specified degree segments.

Parameters
RotGridA Rotator specifying how to snap each component.
Returns
Snapped version of rotation.

Definition at line 637 of file Rotator.h.

◆ InitFromString()

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

Initialize this Rotator based on an FString. The String is expected to contain P=, Y=, R=. The TRotator will be bogus when InitFromString returns false.

Parameters
InSourceStringFString containing the rotator values.
Returns
true if the P,Y,R values were read successfully; false otherwise.

Definition at line 821 of file Rotator.h.

◆ IsNearlyZero()

template<typename T >
FORCEINLINE bool UE::Math::TRotator< T >::IsNearlyZero ( T Tolerance = UE_KINDA_SMALL_NUMBER) const

Checks whether rotator is nearly zero within specified tolerance, when treated as an orientation. This means that TRotator(0, 0, 360) is "zero", because it is the same final orientation as the zero rotator.

Parameters
ToleranceError Tolerance.
Returns
true if rotator is nearly zero, within specified tolerance, otherwise false.

Definition at line 589 of file Rotator.h.

◆ IsZero()

template<typename T >
FORCEINLINE bool UE::Math::TRotator< T >::IsZero ( ) const

Checks whether this has exactly zero rotation, when treated as an orientation. This means that TRotator(0, 0, 360) is "zero", because it is the same final orientation as the zero rotator.

Returns
true if this has exactly zero rotation, otherwise false.

Definition at line 605 of file Rotator.h.

◆ MakeFromEuler()

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

Convert a vector of floating-point Euler angles (in degrees) into a Rotator. Rotator now stored in degrees

Parameters
EulerEuler angle vector.
Returns
A rotator from a Euler angle.

◆ NetSerialize()

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

◆ Normalize()

template<typename T >
FORCEINLINE void UE::Math::TRotator< T >::Normalize ( )

In-place normalize, removes all winding and creates the "shortest route" rotation.

Definition at line 730 of file Rotator.h.

◆ NormalizeAxis()

template<typename T >
FORCEINLINE T UE::Math::TRotator< T >::NormalizeAxis ( T Angle)
static

Clamps an angle to the range of (-180, 180].

Parameters
AngleThe Angle to clamp.
Returns
The clamped angle.

Definition at line 669 of file Rotator.h.

◆ operator!=()

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

Checks whether two rotators are different.

Parameters
VThe other rotator.
Returns
true if two rotators are different, otherwise false.

Definition at line 567 of file Rotator.h.

◆ operator*()

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TRotator UE::Math::TRotator< T >::operator* ( FArg Scale) const
inline

Get the result of scaling this rotator.

Parameters
ScaleThe scaling factor.
Returns
The result of scaling.

Definition at line 145 of file Rotator.h.

◆ operator*=()

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TRotator UE::Math::TRotator< T >::operator*= ( FArg Scale)
inline

Multiply this rotator by a scaling factor.

Parameters
ScaleThe scaling factor.
Returns
Copy of the rotator after scaling.

Definition at line 157 of file Rotator.h.

◆ operator+()

Get the result of adding a rotator to this.

Parameters
RThe other rotator.
Returns
The result of adding a rotator to this.

Definition at line 549 of file Rotator.h.

◆ operator+=()

Adds another rotator to this.

Parameters
RThe other rotator.
Returns
Copy of rotator after addition.

Definition at line 573 of file Rotator.h.

◆ operator-()

Get the result of subtracting a rotator from this.

Parameters
RThe other rotator.
Returns
The result of subtracting a rotator from this.

Definition at line 555 of file Rotator.h.

◆ operator-=()

Subtracts another rotator from this.

Parameters
RThe other rotator.
Returns
Copy of rotator after subtraction.

Definition at line 581 of file Rotator.h.

◆ operator==()

Checks whether two rotators are identical. This checks each component for exact equality.

Parameters
RThe other rotator.
Returns
true if two rotators are identical, otherwise false.
See also
Equals()

Definition at line 561 of file Rotator.h.

◆ Quaternion()

FQuat4d FRotator3d::Quaternion ( ) const

Get Rotation as a quaternion.

Returns
Rotation as a quaternion.

◆ RotateVector()

template<typename T >
TVector< T > UE::Math::TRotator< T >::RotateVector ( const UE::Math::TVector< T > & V) const

Rotate a vector rotated by this rotator.

Parameters
VThe vector to rotate.
Returns
The rotated vector.

◆ Serialize()

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

Definition at line 461 of file Rotator.h.

◆ SerializeCompressed()

template<typename T >
void UE::Math::TRotator< T >::SerializeCompressed ( FArchive & Ar)

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

Parameters
ArArchive to serialize to/ from

◆ SerializeCompressedShort()

template<typename T >
void UE::Math::TRotator< T >::SerializeCompressedShort ( FArchive & Ar)

Serializes the rotator compressed for e.g. network transmission (use shorts though).

Parameters
ArArchive to serialize to/ from

◆ SerializeFromMismatchedTag()

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

Definition at line 883 of file Rotator.h.

◆ SetClosestToMe()

template<typename T >
FORCEINLINE void UE::Math::TRotator< T >::SetClosestToMe ( TRotator< T > & MakeClosest) const

Modify if necessary the passed in rotator to be the closest rotator to it based upon it's equivalent. This Rotator should be within (-180, 180], usually just constructed from a Matrix or a Quaternion.

Parameters
MakeClosest[In/Out]the Rotator we want to make closest to us. Should be between (-180, 180]. This Rotator may change if we need to use different degree values to make it closer.

Definition at line 852 of file Rotator.h.

◆ SetComponentForAxis()

template<typename T >
FORCEINLINE void UE::Math::TRotator< T >::SetComponentForAxis ( EAxis::Type Axis,
T Component )

Set a specified componet of the vector, given a specific axis by enum

Definition at line 761 of file Rotator.h.

◆ ToCompactString()

template<typename T >
FORCEINLINE FString UE::Math::TRotator< T >::ToCompactString ( ) const

Get a short textural representation of this vector, for compact readable logging.

Definition at line 784 of file Rotator.h.

◆ ToString()

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

Get a textual representation of the vector.

Returns
Text describing the vector.

Definition at line 778 of file Rotator.h.

◆ UnrotateVector()

template<typename T >
TVector< T > UE::Math::TRotator< T >::UnrotateVector ( const UE::Math::TVector< T > & V) const

Returns the vector rotated by the inverse of this rotator.

Parameters
VThe vector to rotate.
Returns
The rotated vector.

◆ Vector()

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

Convert a rotation into a unit vector facing in its direction.

Returns
Rotation as a unit direction vector.

Member Data Documentation

◆ Pitch

template<typename T >
T UE::Math::TRotator< T >::Pitch

Rotation around the right axis (around Y axis), Looking up and down (0=Straight Ahead, +Up, -Down)

Definition at line 45 of file Rotator.h.

◆ Roll

template<typename T >
T UE::Math::TRotator< T >::Roll

Rotation around the forward axis (around X axis), Tilting your head, (0=Straight, +Clockwise, -CCW)

Definition at line 51 of file Rotator.h.

◆ Yaw

template<typename T >
T UE::Math::TRotator< T >::Yaw

Rotation around the up axis (around Z axis), Turning around (0=Forward, +Right, -Left)

Definition at line 48 of file Rotator.h.

◆ ZeroRotator

template<typename T >
const TRotator<T> UE::Math::TRotator< T >::ZeroRotator
static

A rotator of zero degrees on each axis.

Definition at line 56 of file Rotator.h.


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