UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Vector2D.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Math/MathFwd.h" // IWYU pragma: export
8#include "Misc/Crc.h"
11#include "Misc/Parse.h"
13#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_4
14#include "Misc/NetworkVersion.h"
15#endif
17#include "Math/IntPoint.h"
18#include "Logging/LogMacros.h"
19
20#include <type_traits>
21
22#ifdef _MSC_VER
23#pragma warning (push)
24// Ensure template functions don't generate shadowing warnings against global variables at the point of instantiation.
25#pragma warning (disable : 4459)
26#endif
27
28
32namespace UE
33{
34namespace Math
35{
36template<typename T>
37struct TVector2
38{
39 static_assert(std::is_floating_point_v<T>, "T must be floating point");
40
41public:
42 using FReal = T;
43
44 union
45 {
46 struct
47 {
49 T X;
50
52 T Y;
53 };
54
55 UE_DEPRECATED(all, "For internal use only")
56 T XY[2];
57 };
58
61
64
71
78
80 static inline TVector2<T> One() { return TVector2<T>::UnitVector; }
81 static inline TVector2<T> UnitX() { return TVector2<T>(1, 0); }
82 static inline TVector2<T> UnitY() { return TVector2<T>(0, 1); }
83
84public:
85
87 [[nodiscard]] TVector2() = default;
88
96
103
109 template <typename IntType>
111
112 template <typename IntType>
114
121
128
135 [[nodiscard]] explicit inline TVector2<T>(const TVector<T>& V);
136
143 [[nodiscard]] explicit inline TVector2<T>(const TVector4<T>& V);
144
145public:
146
154
162
170
178
186
194
202
210
218
226
227public:
228
235 [[nodiscard]] bool operator==(const TVector2<T>& V) const;
236
243 [[nodiscard]] bool operator!=(const TVector2<T>& V) const;
244
252
260
268
276
277
284
292
300
308
316
324
332
340
348
356
364
372
373public:
374
383
392
401
410
419
428
437 [[nodiscard]] UE_FORCEINLINE_HINT static TVector2<T> Clamp(const TVector2<T>& V, const TVector2<T>& MinValue, const TVector2<T>& MaxValue);
438
446 [[nodiscard]] bool Equals(const TVector2<T>& V, T Tolerance=UE_KINDA_SMALL_NUMBER) const;
447
454 void Set(T InX, T InY);
455
461 [[nodiscard]] T GetMax() const;
462
468 [[nodiscard]] T GetAbsMax() const;
469
475 [[nodiscard]] T GetMin() const;
476
479
482
489 [[nodiscard]] T Size() const;
490
498 {
499 return Size();
500 }
501
508 [[nodiscard]] T SizeSquared() const;
509
517 {
518 return SizeSquared();
519 }
520
527 [[nodiscard]] T Dot(const TVector2<T>& V2) const;
528
536
545
554 bool Normalize(T Tolerance=UE_SMALL_NUMBER);
555
562 [[nodiscard]] bool IsNearlyZero(T Tolerance=UE_KINDA_SMALL_NUMBER) const;
563
571 template<typename FArg UE_REQUIRES(!std::is_same_v<T, FArg>)>
578
584 [[nodiscard]] bool IsZero() const;
585
592
599
605
611
617
625
632
638 [[nodiscard]] FString ToString() const;
639
647 bool InitFromString(const FString& InSourceString);
648
650 {
651 Ar << *this;
652 return true;
653 }
654
656 {
657 Slot << *this;
658 return true;
659 }
660
662 {
663 if constexpr (std::is_same_v<T, float>)
664 {
666 }
667 else
668 {
670 }
671 }
672
673#if ENABLE_NAN_DIAGNOSTIC
674 inline void DiagnosticCheckNaN()
675 {
676 if (ContainsNaN())
677 {
678 logOrEnsureNanError(TEXT("FVector2 contains NaN: %s"), *ToString());
680 }
681 }
682#else
684#endif
685
691 [[nodiscard]] inline bool ContainsNaN() const
692 {
693 return (!FMath::IsFinite(X) ||
694 !FMath::IsFinite(Y));
695 }
696
701 bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
702 {
704
706 {
707 Ar << X << Y;
708 }
709 else
710 {
711 checkf(Ar.IsLoading(), TEXT("float -> double conversion applied outside of load!"));
712 // Always serialize as float
713 float SX, SY;
714 Ar << SX << SY;
715 X = SX;
716 Y = SY;
717 }
718 return true;
719 }
720
723
724
725
726 // Conversion from other type.
727 template<typename FArg UE_REQUIRES(!std::is_same_v<T, FArg>)>
728 explicit TVector2(const TVector2<FArg>& From)
729 : TVector2<T>((T)From.X, (T)From.Y)
730 {
731 }
732};
733
740template<typename T>
742{
743 // Note: this assumes there's no padding in TVector2<T> that could contain uncompared data.
744 return FCrc::MemCrc_DEPRECATED(&Vector,sizeof(Vector));
745}
746
747/* TVector2<T> inline functions
748*****************************************************************************/
749
758{
759 // @warning BulkSerialize: TVector2<T> is serialized as memory dump
760 // See TArray::BulkSerialize for detailed description of implied limitations.
761 return Ar << V.X << V.Y;
762}
763
765{
766 // @warning BulkSerialize: TVector2<T> is serialized as memory dump
767 // See TArray::BulkSerialize for detailed description of implied limitations.
769 Stream.EnterElement() << V.X;
770 Stream.EnterElement() << V.Y;
771}
772
774{
775 // @warning BulkSerialize: TVector2<T> is serialized as memory dump
776 // See TArray::BulkSerialize for detailed description of implied limitations.
778 {
779 Ar << V.X << V.Y;
780 }
781 else
782 {
783 checkf(Ar.IsLoading(), TEXT("float -> double conversion applied outside of load!"));
784 // Stored as floats, so serialize float and copy.
785 float X, Y;
786 Ar << X << Y;
787 V = TVector2<double>(X, Y);
788 }
789 return Ar;
790}
791
793{
794 // @warning BulkSerialize: TVector2<T> is serialized as memory dump
795 // See TArray::BulkSerialize for detailed description of implied limitations.
798 {
799 Stream.EnterElement() << V.X;
800 Stream.EnterElement() << V.Y;
801 }
802 else
803 {
804 checkf(Slot.GetUnderlyingArchive().IsLoading(), TEXT("float -> double conversion applied outside of load!"));
805 // Stored as floats, so serialize float and copy.
806 float X, Y;
807 Stream.EnterElement() << X;
808 Stream.EnterElement() << Y;
809 V = TVector2<double>(X, Y);
810 }
811}
812
813#if !defined(_MSC_VER) || defined(__clang__) // MSVC can't forward declare explicit specializations
820#endif
821
829template<typename T, typename T2 UE_REQUIRES(std::is_arithmetic_v<T2>)>
831{
832 return V.operator*(Scale);
833}
834
835template<typename T>
839
840template<typename T>
844
845template<typename T>
846template<typename IntType>
848{
849 X = (T)InPos.X;
850 Y = (T)InPos.Y;
851}
852
853template<typename T>
854template<typename IntType>
856{
857 X = (T)V.X;
858 Y = (T)V.Y;
859}
860
861template<typename T>
866
867template<typename T>
869{
870 return TVector2<T>(X + V.X, Y + V.Y);
871}
872
873template<typename T>
875{
876 return TVector2<T>(X - V.X, Y - V.Y);
877}
878
879template<typename T>
884
885template<typename T>
887{
888 const T RScale = 1.f/Scale;
889 return TVector2<T>(X * RScale, Y * RScale);
890}
891
892template<typename T>
897
898template<typename T>
903
904template<typename T>
906{
907 return TVector2<T>(X * V.X, Y * V.Y);
908}
909
910template<typename T>
912{
913 return TVector2<T>(X / V.X, Y / V.Y);
914}
915
916template<typename T>
918{
919 return X*V.X + Y*V.Y;
920}
921
922template<typename T>
924{
925 return X*V.Y - Y*V.X;
926}
927
928template<typename T>
930{
931 return A | B;
932}
933
934template<typename T>
936{
937 return FMath::Square(V2.X-V1.X) + FMath::Square(V2.Y-V1.Y);
938}
939
940template<typename T>
942{
943 return FMath::Sqrt(TVector2<T>::DistSquared(V1, V2));
944}
945
946template<typename T>
948{
949 return A ^ B;
950}
951
952template<typename T>
954{
955 return TVector2<T>(FMath::Max(A.X, B.X), FMath::Max(A.Y, B.Y));
956}
957
958template<typename T>
960{
961 return TVector2<T>(FMath::Min(A.X, B.X), FMath::Min(A.Y, B.Y));
962}
963
964template<typename T>
966{
967 return TVector2<T>(FMath::Clamp(V.X, MinValue.X, MaxValue.X), FMath::Clamp(V.Y, MinValue.Y, MaxValue.Y));
968}
969
970template<typename T>
972{
973 return X==V.X && Y==V.Y;
974}
975
976template<typename T>
978{
979 return X!=V.X || Y!=V.Y;
980}
981
982template<typename T>
984{
985 return X < Other.X && Y < Other.Y;
986}
987
988template<typename T>
993
994template<typename T>
996{
997 return X <= Other.X && Y <= Other.Y;
998}
999
1000template<typename T>
1002{
1003 return X >= Other.X && Y >= Other.Y;
1004}
1005
1006template<typename T>
1007UE_FORCEINLINE_HINT bool TVector2<T>::Equals(const TVector2<T>& V, T Tolerance) const
1008{
1009 return FMath::Abs(X-V.X) <= Tolerance && FMath::Abs(Y-V.Y) <= Tolerance;
1010}
1011
1012template<typename T>
1017
1018template<typename T>
1020{
1021 X += V.X; Y += V.Y;
1022 return *this;
1023}
1024
1025template<typename T>
1027{
1028 X -= V.X; Y -= V.Y;
1029 return *this;
1030}
1031
1032template<typename T>
1034{
1035 X *= Scale; Y *= Scale;
1036 return *this;
1037}
1038
1039template<typename T>
1041{
1042 const T RV = 1.f/V;
1043 X *= RV; Y *= RV;
1044 return *this;
1045}
1046
1047template<typename T>
1049{
1050 X *= V.X; Y *= V.Y;
1051 return *this;
1052}
1053
1054template<typename T>
1056{
1057 X /= V.X; Y /= V.Y;
1058 return *this;
1059}
1060
1061template<typename T>
1066
1067template<typename T>
1072
1073template<typename T>
1074inline void TVector2<T>::Set(T InX, T InY)
1075{
1076 X = InX;
1077 Y = InY;
1078}
1079
1080template<typename T>
1082{
1083 return FMath::Max(X,Y);
1084}
1085
1086template<typename T>
1088{
1089 return FMath::Max(FMath::Abs(X),FMath::Abs(Y));
1090}
1091
1092template<typename T>
1094{
1095 return FMath::Min(X,Y);
1096}
1097
1098template<typename T>
1100{
1101 return TVector2<T>(FMath::Min(X, Other.X), FMath::Min(Y, Other.Y));
1102}
1103
1104template<typename T>
1106{
1107 return TVector2<T>(FMath::Max(X, Other.X), FMath::Max(Y, Other.Y));
1108}
1109
1110template<typename T>
1112{
1113 return FMath::Sqrt(X*X + Y*Y);
1114}
1115
1116template<typename T>
1118{
1119 return X*X + Y*Y;
1120}
1121
1122template<typename T>
1124{
1125 return X * V2.X + Y * V2.Y;
1126}
1127
1128template<typename T>
1130{
1131 // Based on FVector::RotateAngleAxis with Axis(0,0,1)
1132
1133 T S, C;
1135
1136 return TVector2<T>(
1137 C * X - S * Y,
1138 S * X + C * Y);
1139}
1140
1141template<typename T>
1143{
1144 const T SquareSum = X*X + Y*Y;
1145 if(SquareSum > Tolerance)
1146 {
1147 const T Scale = FMath::InvSqrt(SquareSum);
1148 return TVector2<T>(X*Scale, Y*Scale);
1149 }
1150 return TVector2<T>(0.f, 0.f);
1151}
1152
1153template<typename T>
1154inline bool TVector2<T>::Normalize(T Tolerance)
1155{
1156 const T SquareSum = X*X + Y*Y;
1157 if(SquareSum > Tolerance)
1158 {
1159 const T Scale = FMath::InvSqrt(SquareSum);
1160 X *= Scale;
1161 Y *= Scale;
1162 return true;
1163 }
1164 X = 0.0f;
1165 Y = 0.0f;
1166 return false;
1167}
1168
1169template<typename T>
1171{
1172 OutLength = Size();
1174 {
1175 T OneOverLength = static_cast<T>(1.0f) / OutLength;
1176 OutDir = TVector2<T>(static_cast<T>(X*OneOverLength), static_cast<T>(Y*OneOverLength));
1177 }
1178 else
1179 {
1181 }
1182}
1183
1184template<typename T>
1185inline bool TVector2<T>::IsNearlyZero(T Tolerance) const
1186{
1187 return FMath::Abs(X)<=Tolerance
1188 && FMath::Abs(Y)<=Tolerance;
1189}
1190
1191template<typename T>
1193{
1194 return X==0.f && Y==0.f;
1195}
1196
1197template<typename T>
1205
1206template<typename T>
1208{
1209 check(IsValidIndex(Index));
1211 return XY[Index];
1213}
1214
1215template<typename T>
1217{
1218 return (Index >= 0) && (Index < NumComponents);
1219}
1220
1221template<typename T>
1223{
1224 if constexpr (std::is_same_v<T, float>)
1225 {
1226 return FIntPoint( FMath::RoundToInt32(X), FMath::RoundToInt32(Y) );
1227 }
1228 else
1229 {
1230 // FIntPoint constructor from FInt64Point checks that the int64 fits in int32.
1231 return FIntPoint( FInt64Point(FMath::RoundToInt64(X), FMath::RoundToInt64(Y)) );
1232 }
1233}
1234
1235template<typename T>
1237{
1238 if constexpr (std::is_same_v<T, float>)
1239 {
1240 return TVector2<T>(FMath::RoundToFloat(X), FMath::RoundToFloat(Y));
1241 }
1242 else
1243 {
1244 return TVector2<T>(FMath::RoundToDouble(X), FMath::RoundToDouble(Y));
1245 }
1246}
1247
1248template<typename T>
1253
1254template<typename T>
1256{
1257 T VecSize = Size();
1258 const TVector2<T> VecDir = (VecSize > UE_SMALL_NUMBER) ? (*this / VecSize) : ZeroVector;
1259
1261
1262 return VecSize * VecDir;
1263}
1264
1265template<typename T>
1267{
1269 {
1270 return ZeroVector;
1271 }
1272
1273 const T VSq = SizeSquared();
1274 if (VSq > FMath::Square(MaxSize))
1275 {
1276 const T Scale = MaxSize * FMath::InvSqrt(VSq);
1277 return TVector2<T>(X * Scale, Y * Scale);
1278 }
1279 else
1280 {
1281 return *this;
1282 }
1283}
1284
1285template<typename T>
1287{
1288 return TVector2<T>
1289 (
1290 FMath::FloatSelect(X, (T)1, (T)-1),
1291 FMath::FloatSelect(Y, (T)1, (T)-1)
1292 );
1293}
1294
1295template<typename T>
1297{
1298 return TVector2<T>(FMath::Abs(X), FMath::Abs(Y));
1299}
1300
1301template<typename T>
1303{
1304 return FString::Printf(TEXT("X=%3.3f Y=%3.3f"), X, Y);
1305}
1306
1307template<typename T>
1309{
1310 X = Y = 0;
1311
1312 // The initialization is only successful if the X and Y values can all be parsed from the string
1313 const bool bSuccessful = FParse::Value(*InSourceString, TEXT("X=") , X) && FParse::Value(*InSourceString, TEXT("Y="), Y) ;
1314
1315 return bSuccessful;
1316}
1317
1318} // namespace UE::Math
1319} // UE
1320
1322
1323template <> struct TIsPODType<FVector2f> { enum { Value = true }; };
1324template <> struct TIsUECoreVariant<FVector2f> { enum { Value = true }; };
1325template<> struct TCanBulkSerialize<FVector2f> { enum { Value = true }; };
1326template <> struct TIsPODType<FVector2d> { enum { Value = true }; };
1327template <> struct TIsUECoreVariant<FVector2d> { enum { Value = true }; };
1328template<> struct TCanBulkSerialize<FVector2d> { enum { Value = true }; };
1329
1330
1331#ifdef _MSC_VER
1332#pragma warning (pop)
1333#endif
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
ENoInit
Definition CoreMiscDefines.h:158
EForceInit
Definition CoreMiscDefines.h:154
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define X(Name, Desc)
Definition FormatStringSan.h:47
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#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
UE::Math::TIntPoint< int64 > FInt64Point
Definition MathFwd.h:120
FInt32Point FIntPoint
Definition MathFwd.h:124
#define UE_SMALL_NUMBER
Definition UnrealMathUtility.h:130
#define UE_KINDA_SMALL_NUMBER
Definition UnrealMathUtility.h:131
uint32 Size
Definition VulkanMemory.cpp:4034
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
virtual CORE_API uint32 EngineNetVer() const
Definition Archive.cpp:1497
virtual CORE_API void UsingCustomVersion(const struct FGuid &Guid)
Definition Archive.cpp:590
UE_FORCEINLINE_HINT bool IsLoading() const
Definition Archive.h:236
UE_FORCEINLINE_HINT FPackageFileVersion UEVer() const
Definition Archive.h:204
Definition NameTypes.h:617
Definition StructuredArchiveSlots.h:52
UE_API FStructuredArchiveStream EnterStream()
Definition StructuredArchiveSlots.h:263
Definition StructuredArchiveSlots.h:193
UE_API FStructuredArchiveSlot EnterElement()
Definition StructuredArchiveSlots.h:462
CORE_API FArchive & GetUnderlyingArchive() const
Definition StructuredArchiveSlots.cpp:7
Definition CoreNet.h:191
uint32 GetTypeHash(const TBox< T > &Box)
Definition Box.h:1008
FArchive & operator<<(FArchive &Ar, TBoxSphereBounds< float, float > &Bounds)
Definition BoxSphereBounds.h:396
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
static CORE_API uint32 MemCrc_DEPRECATED(const void *Data, int32 Length, uint32 CRC=0)
Definition Crc.cpp:592
CORE_API static const FGuid Guid
Definition EngineNetworkCustomVersion.h:106
@ SerializeDoubleVectorsAsDoubles
Definition EngineNetworkCustomVersion.h:77
@ Ver21AndViewPitchOnly_DONOTUSE
Definition EngineNetworkCustomVersion.h:81
static constexpr UE_FORCEINLINE_HINT auto DegreesToRadians(T const &DegVal) -> decltype(DegVal *(UE_PI/180.f))
Definition UnrealMathUtility.h:871
static constexpr void SinCos(std::decay_t< T > *ScalarSin, std::decay_t< T > *ScalarCos, T Value)
Definition UnrealMathUtility.h:753
static constexpr UE_FORCEINLINE_HINT T Square(const T A)
Definition UnrealMathUtility.h:578
static constexpr UE_FORCEINLINE_HINT T Clamp(const T X, const T MinValue, const T MaxValue)
Definition UnrealMathUtility.h:592
static CORE_API bool Value(const TCHAR *Stream, const TCHAR *Match, FName &Name)
Definition Parse.cpp:584
Definition Array.h:45
@ Value
Definition Array.h:46
Definition IsPODType.h:12
@ Value
Definition IsPODType.h:13
Definition IsUECoreType.h:19
@ Value
Definition IsUECoreType.h:20
Definition IntPoint.h:25
Definition IntVector.h:670
IntType Y
Definition IntVector.h:682
IntType X
Definition IntVector.h:679
Definition Vector2D.h:38
static UE_FORCEINLINE_HINT TVector2< T > Min(const TVector2< T > &A, const TVector2< T > &B)
Definition Vector2D.h:959
static CORE_API const TVector2< T > Unit45Deg
Definition Vector2D.h:77
bool InitFromString(const FString &InSourceString)
Definition Vector2D.h:1308
T GetMax() const
Definition Vector2D.h:1081
bool SerializeFromMismatchedTag(FName StructTag, FArchive &Ar)
Definition Vector2D.h:661
UE_FORCEINLINE_HINT T Length() const
Definition Vector2D.h:497
bool IsNearlyZero(T Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition Vector2D.h:1185
static CORE_API const TVector2< T > UnitVector
Definition Vector2D.h:70
bool Equals(const TVector2< T > &V, T Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition Vector2D.h:1007
static TVector2< T > UnitX()
Definition Vector2D.h:81
bool NetSerialize(FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
Definition Vector2D.h:701
void Set(T InX, T InY)
Definition Vector2D.h:1074
bool Normalize(T Tolerance=UE_SMALL_NUMBER)
Definition Vector2D.h:1154
TVector2< T > ComponentMin(const TVector2< T > &Other) const
Definition Vector2D.h:1099
static TVector2< T > UnitY()
Definition Vector2D.h:82
T XY[2]
Definition Vector2D.h:56
bool ComponentwiseAllLessThan(const TVector2< T > &Other) const
Definition Vector2D.h:983
TVector2< T > operator+=(const TVector2< T > &V)
Definition Vector2D.h:1019
UE_FORCEINLINE_HINT T operator^(const TVector2< T > &V) const
Definition Vector2D.h:923
UE_FORCEINLINE_HINT T SquaredLength() const
Definition Vector2D.h:516
static UE_FORCEINLINE_HINT T DotProduct(const TVector2< T > &A, const TVector2< T > &B)
Definition Vector2D.h:929
bool ContainsNaN() const
Definition Vector2D.h:691
bool ComponentwiseAllGreaterOrEqual(const TVector2< T > &Other) const
Definition Vector2D.h:1001
UE_FORCEINLINE_HINT TVector2< T > operator+(T A) const
Definition Vector2D.h:893
TVector2< T > RoundToVector() const
Definition Vector2D.h:1236
TVector2< T > GetSafeNormal(T Tolerance=UE_SMALL_NUMBER) const
Definition Vector2D.h:1142
TVector2(const TVector2< FArg > &From)
Definition Vector2D.h:728
static UE_FORCEINLINE_HINT TVector2< T > Clamp(const TVector2< T > &V, const TVector2< T > &MinValue, const TVector2< T > &MaxValue)
Definition Vector2D.h:965
T GetMin() const
Definition Vector2D.h:1093
TVector2< T > operator/(T Scale) const
Definition Vector2D.h:886
T & Component(int32 Index)
Definition Vector2D.h:1198
T GetAbsMax() const
Definition Vector2D.h:1087
bool Serialize(FStructuredArchive::FSlot Slot)
Definition Vector2D.h:655
bool operator!=(const TVector2< T > &V) const
Definition Vector2D.h:977
TVector2< T > GetClampedToSize(T Min, T Max) const
Definition Vector2D.h:1255
static UE_FORCEINLINE_HINT T CrossProduct(const TVector2< T > &A, const TVector2< T > &B)
Definition Vector2D.h:947
static UE_FORCEINLINE_HINT T DistSquared(const TVector2< T > &V1, const TVector2< T > &V2)
Definition Vector2D.h:935
T Size() const
Definition Vector2D.h:1111
T FReal
Definition Vector2D.h:42
FIntPoint IntPoint() const
Definition Vector2D.h:1222
static UE_FORCEINLINE_HINT T Distance(const TVector2< T > &V1, const TVector2< T > &V2)
Definition Vector2D.h:941
UE_FORCEINLINE_HINT TVector2< T > operator+(const TVector2< T > &V) const
Definition Vector2D.h:868
TVector2< T > GetRotated(T AngleDeg) const
Definition Vector2D.h:1129
bool operator==(const TVector2< T > &V) const
Definition Vector2D.h:971
UE_FORCEINLINE_HINT TVector2< T > operator-(T A) const
Definition Vector2D.h:899
static TVector2< T > One()
Definition Vector2D.h:80
UE_FORCEINLINE_HINT T operator|(const TVector2< T > &V) const
Definition Vector2D.h:917
T Y
Definition Vector2D.h:52
TVector2< T > operator/=(T V)
Definition Vector2D.h:1040
TVector2< T > GetClampedToMaxSize(T MaxSize) const
Definition Vector2D.h:1266
static UE_FORCEINLINE_HINT TVector2< T > Max(const TVector2< T > &A, const TVector2< T > &B)
Definition Vector2D.h:953
T Dot(const TVector2< T > &V2) const
Definition Vector2D.h:1123
bool Serialize(FArchive &Ar)
Definition Vector2D.h:649
UE_FORCEINLINE_HINT TVector2< T > operator*(T Scale) const
Definition Vector2D.h:880
TVector2< T > GetSignVector() const
Definition Vector2D.h:1286
TVector< T > SphericalToUnitCartesian() const
Definition Vector.h:2759
FString ToString() const
Definition Vector2D.h:1302
UE_FORCEINLINE_HINT TVector2< T > GetAbs() const
Definition Vector2D.h:1296
bool ComponentwiseAllLessOrEqual(const TVector2< T > &Other) const
Definition Vector2D.h:995
T Component(int32 Index) const
Definition Vector2D.h:1207
TVector2< T > operator-=(const TVector2< T > &V)
Definition Vector2D.h:1026
void ToDirectionAndLength(TVector2< T > &OutDir, T &OutLength) const
Definition Vector2D.h:1170
T & operator[](int32 Index)
Definition Vector2D.h:1062
void ToDirectionAndLength(TVector2< T > &OutDir, FArg &OutLength) const
Definition Vector2D.h:572
TVector2< T > operator*=(T Scale)
Definition Vector2D.h:1033
UE_FORCEINLINE_HINT TVector2< T > operator*(const TVector2< T > &V) const
Definition Vector2D.h:905
TVector2< T > ComponentMax(const TVector2< T > &Other) const
Definition Vector2D.h:1105
T operator[](int32 Index) const
Definition Vector2D.h:1068
TVector2< T > ClampAxes(T MinAxisVal, T MaxAxisVal) const
Definition Vector2D.h:1249
UE_FORCEINLINE_HINT TVector2< T > operator-(const TVector2< T > &V) const
Definition Vector2D.h:874
bool IsZero() const
Definition Vector2D.h:1192
static TVector2< T > Zero()
Definition Vector2D.h:79
TVector2< T > operator*=(const TVector2< T > &V)
Definition Vector2D.h:1048
UE_FORCEINLINE_HINT TVector2< T > operator/(const TVector2< T > &V) const
Definition Vector2D.h:911
bool IsValidIndex(int32 Index) const
Definition Vector2D.h:1216
T X
Definition Vector2D.h:49
UE_FORCEINLINE_HINT TVector2< T > operator-() const
Definition Vector2D.h:1013
UE_FORCEINLINE_HINT void DiagnosticCheckNaN()
Definition Vector2D.h:683
static CORE_API const TVector2< T > ZeroVector
Definition Vector2D.h:63
TVector2< T > operator/=(const TVector2< T > &V)
Definition Vector2D.h:1055
bool ComponentwiseAllGreaterThan(const TVector2< T > &Other) const
Definition Vector2D.h:989
T SizeSquared() const
Definition Vector2D.h:1117
static constexpr int32 NumComponents
Definition Vector2D.h:60
Definition Vector4.h:30
Definition Vector.h:51