40 static_assert(std::is_floating_point_v<T>,
"TRotator only supports float and double types.");
61#if ENABLE_NAN_DIAGNOSTIC
145 template<
typename FArg UE_REQUIRES(std::is_arithmetic_v<FArg>)>
157 template<
typename FArg UE_REQUIRES(std::is_arithmetic_v<FArg>)>
487 if constexpr (std::is_same_v<T, float>)
498 template<
typename FArg UE_REQUIRES(!std::is_same_v<T, FArg>)>
505#if !defined(_MSC_VER) || defined(__clang__)
523 Ar <<
R.Pitch <<
R.Yaw <<
R.Roll;
531 Ar <<
R.Pitch <<
R.Yaw <<
R.Roll;
537 float Pitch, Yaw, Roll;
538 Ar <<
Pitch << Yaw << Roll;
554template<
typename T,
typename FArg UE_REQUIRES(std::is_arithmetic_v<FArg>)>
557 return R.operator*(
Scale );
576 :
Pitch(0), Yaw(0), Roll(0)
594 return Pitch==
R.Pitch && Yaw==
R.Yaw && Roll==
R.Roll;
607 DiagnosticCheckNaN();
615 DiagnosticCheckNaN();
622#if PLATFORM_ENABLE_VECTORINTRINSICS
629 FMath::Abs(NormalizeAxis(
Pitch))<=Tolerance
630 && FMath::Abs(NormalizeAxis(Yaw))<=Tolerance
631 && FMath::Abs(NormalizeAxis(Roll))<=Tolerance;
638 return (ClampAxis(
Pitch)==0.f) && (ClampAxis(Yaw)==0.f) && (ClampAxis(Roll)==0.f);
644#if PLATFORM_ENABLE_VECTORINTRINSICS
651 return (FMath::Abs(NormalizeAxis(
Pitch -
R.Pitch)) <= Tolerance)
652 && (FMath::Abs(NormalizeAxis(Yaw -
R.Yaw)) <= Tolerance)
653 && (FMath::Abs(NormalizeAxis(Roll -
R.Roll)) <= Tolerance);
660 return Quaternion().AngularDistance(
R.Quaternion()) <= Tolerance;
669 DiagnosticCheckNaN();
687 return TRotator(ClampAxis(
Pitch), ClampAxis(Yaw), ClampAxis(Roll));
711 if (
Angle > (T)180.0)
724 return FMath::RoundToInt(
Angle * (T)256.f / (T)360.f) & 0xFF;
731 return (
Angle * (T)360.f / (T)256.f);
738 return FMath::RoundToInt(
Angle * (T)65536.f / (T)360.f) & 0xFFFF;
745 return (
Angle * (T)360.f / (T)65536.f);
760 Rot.Pitch = ClampAxis(Rot.Pitch);
761 Rot.Yaw = ClampAxis(Rot.Yaw);
762 Rot.Roll = ClampAxis(Rot.Roll);
769#if PLATFORM_ENABLE_VECTORINTRINSICS
775 Yaw = NormalizeAxis(Yaw);
776 Roll = NormalizeAxis(Roll);
778 DiagnosticCheckNaN();
821 return FString::Printf(
TEXT(
"P=%f Y=%f R=%f"),
Pitch, Yaw, Roll );
829 return FString(
TEXT(
"R(0)"));
864 Pitch = Yaw = Roll = 0;
868 DiagnosticCheckNaN();
875 return (!FMath::IsFinite(
Pitch) ||
876 !FMath::IsFinite(Yaw) ||
877 !FMath::IsFinite(Roll));
935 return A + (
B -
A).GetNormalized() *
Alpha;
939template<
typename T,
typename U >
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
EForceInit
Definition CoreMiscDefines.h:154
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_SERIALIZE_VARIANT_FROM_MISMATCHED_TAG(AR_OR_SLOT, ALIAS, TYPE, ALT_TYPE)
Definition LargeWorldCoordinatesSerializer.h:9
#define UE_DECLARE_LWC_TYPE(...)
Definition LargeWorldCoordinates.h:27
#define logOrEnsureNanError(_FormatString_,...)
Definition LogMacros.h:436
#define DECLARE_INTRINSIC_TYPE_LAYOUT(T)
Definition MemoryLayout.h:760
@ LARGE_WORLD_COORDINATES
FORCEINLINE VectorRegister4Float VectorSubtract(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:731
FORCEINLINE uint32 VectorAnyGreaterThan(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1917
FORCEINLINE VectorRegister4Float VectorLoadFloat1(const float *Ptr)
Definition UnrealMathFPU.h:468
FORCEINLINE VectorRegister4Float VectorAbs(const VectorRegister4Float &Vec)
Definition UnrealMathFPU.h:661
FORCEINLINE void VectorStoreFloat3(const VectorRegister4Float &Vec, float *Dst)
Definition UnrealMathFPU.h:594
#define UE_KINDA_SMALL_NUMBER
Definition UnrealMathUtility.h:131
FORCEINLINE VectorRegister4Float VectorNormalizeRotator(VectorRegister4Float UnnormalizedRotator)
Definition UnrealMathVectorCommon.h.inl:628
FORCEINLINE VectorRegister4Float VectorLoadFloat3_W0(const float *Ptr)
VectorLoadFloat3_W0.
Definition UnrealMathVectorCommon.h.inl:129
typename UE::Math::VectorRegisterPrivate::TVectorRegisterTypeHelper< T >::Type TVectorRegisterType
Definition VectorRegister.h:49
Definition Archive.h:1208
UE_FORCEINLINE_HINT bool IsLoading() const
Definition Archive.h:236
UE_FORCEINLINE_HINT FPackageFileVersion UEVer() const
Definition Archive.h:204
Definition NameTypes.h:617
@ None
Definition Axis.h:12
FArchive & operator<<(FArchive &Ar, TBoxSphereBounds< float, float > &Bounds)
Definition BoxSphereBounds.h:396
UE_FORCEINLINE_HINT TQuat< T > operator*(const float Scale, const TQuat< T > &Q)
Definition Quat.h:1055
Definition AdvancedWidgetsModule.cpp:13
static UE::Math::TRotator< T > LerpRange(const UE::Math::TRotator< T > &A, const UE::Math::TRotator< T > &B, U Alpha)
static T ClampAngle(T AngleDegrees, T MinAngleDegrees, T MaxAngleDegrees)
Definition Rotator.h:947
static UE_FORCEINLINE_HINT bool IsNearlyZero(float Value, float ErrorTolerance=UE_SMALL_NUMBER)
Definition UnrealMathUtility.h:407
static constexpr UE_FORCEINLINE_HINT T GridSnap(T Location, T Grid)
Definition UnrealMathUtility.h:685
static CORE_API bool Value(const TCHAR *Stream, const TCHAR *Match, FName &Name)
Definition Parse.cpp:584
@ Value
Definition Array.h:46
static UE_FORCEINLINE_HINT RotatorType Lerp(const RotatorType &A, const RotatorType &B, const U &Alpha)
Definition Rotator.h:933
Definition UnrealMathUtility.h:261
static constexpr bool Value
Definition UnrealMathUtility.h:262
Definition IsPODType.h:12
@ Value
Definition IsPODType.h:13
Definition IsUECoreType.h:19
@ Value
Definition IsUECoreType.h:20
CORE_API TRotator GetInverse() const
Definition UnrealMath.cpp:406
CORE_API TVector< T > Euler() const
Definition UnrealMath.cpp:553
static T ClampAxis(T Angle)
Definition Rotator.h:691
TRotator operator+=(const TRotator< T > &R)
Definition Rotator.h:604
bool IsNearlyZero(T Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition Rotator.h:620
CORE_API void GetWindingAndRemainder(TRotator< T > &Winding, TRotator< T > &Remainder) const
Definition UnrealMath.cpp:577
bool ContainsNaN() const
Definition Rotator.h:873
T GetComponentForAxis(EAxis::Type Axis) const
Definition Rotator.h:782
FString ToString() const
Definition Rotator.h:819
CORE_API TVector< T > RotateVector(const UE::Math::TVector< T > &V) const
Definition UnrealMath.cpp:571
T Pitch
Definition Rotator.h:46
TRotator< T > GetNormalized() const
Definition Rotator.h:749
static T DecompressAxisFromByte(uint8 Angle)
Definition Rotator.h:728
UE_FORCEINLINE_HINT TRotator(T InPitch, T InYaw, T InRoll)
Definition Rotator.h:568
TRotator operator*=(FArg Scale)
Definition Rotator.h:158
static uint8 CompressAxisToByte(T Angle)
Definition Rotator.h:721
TRotator operator-=(const TRotator< T > &R)
Definition Rotator.h:612
TRotator operator+(const TRotator< T > &R) const
Definition Rotator.h:580
bool InitFromString(const FString &InSourceString)
Definition Rotator.h:862
TRotator Add(T DeltaPitch, T DeltaYaw, T DeltaRoll)
Definition Rotator.h:664
T Yaw
Definition Rotator.h:49
bool Serialize(FArchive &Ar)
Definition Rotator.h:479
bool EqualsOrientation(const TRotator< T > &R, T Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition Rotator.h:658
bool SerializeFromMismatchedTag(FName StructTag, FArchive &Ar)
Definition Rotator.h:485
UE_FORCEINLINE_HINT void DiagnosticCheckNaN() const
Definition Rotator.h:80
UE_FORCEINLINE_HINT TRotator(EForceInit)
Definition Rotator.h:575
CORE_API void SerializeCompressedShort(FArchive &Ar)
Definition UnrealMath.cpp:142
bool operator!=(const TRotator< T > &V) const
Definition Rotator.h:598
T FReal
Definition Rotator.h:43
TRotator< T > GetDenormalized() const
Definition Rotator.h:757
TRotator GridSnap(const TRotator< T > &RotGrid) const
Definition Rotator.h:674
CORE_API TVector< T > UnrotateVector(const UE::Math::TVector< T > &V) const
Definition UnrealMath.cpp:565
CORE_API TVector< T > Vector() const
Definition UnrealMath.cpp:371
TRotator GetEquivalentRotator() const
Definition Rotator.h:887
CORE_API TQuat< T > Quaternion() const
TRotator< T > Clamp() const
Definition Rotator.h:685
static T NormalizeAxis(T Angle)
Definition Rotator.h:706
UE_FORCEINLINE_HINT TRotator operator*(FArg Scale) const
Definition Rotator.h:146
T GetManhattanDistance(const TRotator< T > &Rotator) const
Definition Rotator.h:881
CORE_API void SerializeCompressed(FArchive &Ar)
Definition UnrealMath.cpp:84
UE_FORCEINLINE_HINT TRotator(T InF)
Definition Rotator.h:561
T Roll
Definition Rotator.h:52
static CORE_API const TRotator< T > ZeroRotator
Definition Rotator.h:57
static uint16 CompressAxisToShort(T Angle)
Definition Rotator.h:735
bool Equals(const TRotator< T > &R, T Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition Rotator.h:642
void SetClosestToMe(TRotator &MakeClosest) const
Definition Rotator.h:893
TRotator(const TRotator< FArg > &From)
Definition Rotator.h:499
UE_FORCEINLINE_HINT void DiagnosticCheckNaN(const TCHAR *Message) const
Definition Rotator.h:81
bool operator==(const TRotator< T > &R) const
Definition Rotator.h:592
void Normalize()
Definition Rotator.h:767
CORE_API bool NetSerialize(FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
Definition UnrealMath.cpp:76
TRotator operator-(const TRotator< T > &R) const
Definition Rotator.h:586
bool IsZero() const
Definition Rotator.h:636
void SetComponentForAxis(EAxis::Type Axis, T Component)
Definition Rotator.h:799
static CORE_API TRotator MakeFromEuler(const TVector< T > &Euler)
Definition UnrealMath.cpp:559
FString ToCompactString() const
Definition Rotator.h:825
static T DecompressAxisFromShort(uint16 Angle)
Definition Rotator.h:742