UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Math::TVector2< T > Struct Template Reference

#include <Vector2D.h>

Public Types

using FReal = T
 

Public Member Functions

 TVector2 ()=default
 
UE_FORCEINLINE_HINT TVector2 (T InX, T InY)
 
UE_FORCEINLINE_HINT TVector2 (T InF)
 
template<typename IntType >
UE_FORCEINLINE_HINT TVector2 (TIntPoint< IntType > InPos)
 
template<typename IntType >
 TVector2 (TIntVector2< IntType > V)
 
UE_FORCEINLINE_HINT TVector2 (EForceInit)
 
UE_FORCEINLINE_HINT TVector2 (ENoInit)
 
 TVector2 (const TVector< T > &V)
 
 TVector2 (const TVector4< T > &V)
 
UE_FORCEINLINE_HINT TVector2< T > operator+ (const TVector2< T > &V) const
 
UE_FORCEINLINE_HINT TVector2< T > operator- (const TVector2< T > &V) const
 
UE_FORCEINLINE_HINT TVector2< T > operator* (T Scale) const
 
TVector2< T > operator/ (T Scale) const
 
UE_FORCEINLINE_HINT TVector2< T > operator+ (T A) const
 
UE_FORCEINLINE_HINT TVector2< T > operator- (T A) const
 
UE_FORCEINLINE_HINT TVector2< T > operator* (const TVector2< T > &V) const
 
UE_FORCEINLINE_HINT TVector2< T > operator/ (const TVector2< T > &V) const
 
UE_FORCEINLINE_HINToperator| (const TVector2< T > &V) const
 
UE_FORCEINLINE_HINToperator^ (const TVector2< T > &V) const
 
bool operator== (const TVector2< T > &V) const
 
bool operator!= (const TVector2< T > &V) const
 
bool ComponentwiseAllLessThan (const TVector2< T > &Other) const
 
bool ComponentwiseAllGreaterThan (const TVector2< T > &Other) const
 
bool ComponentwiseAllLessOrEqual (const TVector2< T > &Other) const
 
bool ComponentwiseAllGreaterOrEqual (const TVector2< T > &Other) const
 
UE_FORCEINLINE_HINT TVector2< T > operator- () const
 
TVector2< T > operator+= (const TVector2< T > &V)
 
TVector2< T > operator-= (const TVector2< T > &V)
 
TVector2< T > operator*= (T Scale)
 
TVector2< T > operator/= (T V)
 
TVector2< T > operator*= (const TVector2< T > &V)
 
TVector2< T > operator/= (const TVector2< T > &V)
 
T & operator[] (int32 Index)
 
operator[] (int32 Index) const
 
T & Component (int32 Index)
 
Component (int32 Index) const
 
bool IsValidIndex (int32 Index) const
 
bool Equals (const TVector2< T > &V, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
void Set (T InX, T InY)
 
GetMax () const
 
GetAbsMax () const
 
GetMin () const
 
TVector2< T > ComponentMin (const TVector2< T > &Other) const
 
TVector2< T > ComponentMax (const TVector2< T > &Other) const
 
Size () const
 
UE_FORCEINLINE_HINTLength () const
 
SizeSquared () const
 
UE_FORCEINLINE_HINTSquaredLength () const
 
Dot (const TVector2< T > &V2) const
 
TVector2< T > GetRotated (T AngleDeg) const
 
TVector2< T > GetSafeNormal (T Tolerance=UE_SMALL_NUMBER) const
 
bool Normalize (T Tolerance=UE_SMALL_NUMBER)
 
bool IsNearlyZero (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
void ToDirectionAndLength (TVector2< T > &OutDir, T &OutLength) const
 
template<typename FArg UE_REQUIRES>
void ToDirectionAndLength (TVector2< T > &OutDir, FArg &OutLength) const
 
bool IsZero () const
 
FIntPoint IntPoint () const
 
TVector2< T > RoundToVector () const
 
TVector2< T > ClampAxes (T MinAxisVal, T MaxAxisVal) const
 
TVector2< T > GetClampedToSize (T Min, T Max) const
 
TVector2< T > GetClampedToMaxSize (T MaxSize) const
 
TVector2< T > GetSignVector () const
 
UE_FORCEINLINE_HINT TVector2< T > GetAbs () const
 
FString ToString () const
 
bool InitFromString (const FString &InSourceString)
 
bool Serialize (FArchive &Ar)
 
bool Serialize (FStructuredArchive::FSlot Slot)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
UE_FORCEINLINE_HINT void DiagnosticCheckNaN ()
 
bool ContainsNaN () const
 
bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
TVector< T > SphericalToUnitCartesian () const
 
template<typename FArg UE_REQUIRES>
 TVector2 (const TVector2< FArg > &From)
 
template<typename IntType >
 TVector2 (TIntPoint< IntType > InPos)
 

Static Public Member Functions

static TVector2< T > Zero ()
 
static TVector2< T > One ()
 
static TVector2< T > UnitX ()
 
static TVector2< T > UnitY ()
 
static UE_FORCEINLINE_HINTDotProduct (const TVector2< T > &A, const TVector2< T > &B)
 
static UE_FORCEINLINE_HINTDistSquared (const TVector2< T > &V1, const TVector2< T > &V2)
 
static UE_FORCEINLINE_HINTDistance (const TVector2< T > &V1, const TVector2< T > &V2)
 
static UE_FORCEINLINE_HINTCrossProduct (const TVector2< T > &A, const TVector2< T > &B)
 
static UE_FORCEINLINE_HINT TVector2< T > Max (const TVector2< T > &A, const TVector2< T > &B)
 
static UE_FORCEINLINE_HINT TVector2< T > Min (const TVector2< T > &A, const TVector2< T > &B)
 
static UE_FORCEINLINE_HINT TVector2< T > Clamp (const TVector2< T > &V, const TVector2< T > &MinValue, const TVector2< T > &MaxValue)
 

Public Attributes

union { 
 
   struct { 
 
      T   X 
 
      T   Y 
 
   }  
 
   T   XY [2] 
 
};  
 

Static Public Attributes

static constexpr int32 NumComponents = 2
 
static CORE_API const TVector2< T > ZeroVector
 
static CORE_API const TVector2< T > UnitVector
 
static CORE_API const TVector2< T > Unit45Deg
 

Member Typedef Documentation

◆ FReal

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

Constructor & Destructor Documentation

◆ TVector2() [1/11]

template<typename T >
UE::Math::TVector2< T >::TVector2 ( )
default

Default constructor (no initialization).

◆ TVector2() [2/11]

template<typename T >
UE_FORCEINLINE_HINT UE::Math::TVector2< T >::TVector2 ( InX,
InY 
)

Constructor using initial values for each component.

Parameters
InXX coordinate.
InYY coordinate.

◆ TVector2() [3/11]

template<typename T >
UE_FORCEINLINE_HINT UE::Math::TVector2< T >::TVector2 ( InF)
explicit

Constructor initializing both components to a single T value.

Parameters
InFValue to set both components to.

◆ TVector2() [4/11]

template<typename T >
template<typename IntType >
UE_FORCEINLINE_HINT UE::Math::TVector2< T >::TVector2 ( TIntPoint< IntType >  InPos)

Constructs a vector from an FIntPoint.

Parameters
InPosInteger point used to set this vector.

◆ TVector2() [5/11]

template<typename T >
template<typename IntType >
UE::Math::TVector2< T >::TVector2 ( TIntVector2< IntType >  V)
inlineexplicit

◆ TVector2() [6/11]

template<typename T >
UE_FORCEINLINE_HINT UE::Math::TVector2< T >::TVector2 ( EForceInit  )
explicit

Constructor which initializes all components to zero.

Parameters
EForceInitForce init enum

◆ TVector2() [7/11]

template<typename T >
UE_FORCEINLINE_HINT UE::Math::TVector2< T >::TVector2 ( ENoInit  )
inlineexplicit

Constructor that does not initialize. More explicit than the default constructor.

Parameters
ENoInitDon't init

◆ TVector2() [8/11]

template<typename T >
UE::Math::TVector2< T >::TVector2 ( const TVector< T > &  V)
inlineexplicit

Constructs a vector from an FVector. Copies the X and Y components from the FVector.

Parameters
VVector to copy from.

◆ TVector2() [9/11]

template<typename T >
UE::Math::TVector2< T >::TVector2 ( const TVector4< T > &  V)
inlineexplicit

Constructs a vector from an FVector4. Copies the X and Y components from the FVector4.

Parameters
VVector to copy from.

◆ TVector2() [10/11]

template<typename T >
template<typename FArg UE_REQUIRES>
UE::Math::TVector2< T >::TVector2 ( const TVector2< FArg > &  From)
inlineexplicit

◆ TVector2() [11/11]

template<typename T >
template<typename IntType >
UE::Math::TVector2< T >::TVector2 ( TIntPoint< IntType >  InPos)
inline

Member Function Documentation

◆ Clamp()

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::Clamp ( const TVector2< T > &  V,
const TVector2< T > &  MinValue,
const TVector2< T > &  MaxValue 
)
static

Returns a vector with each component clamped between a minimum and a maximum.

Parameters
VThe vector to clamp.
MinValueThe minimum vector.
MaxValueThe maximum vector.
Returns
The clamped vector.

◆ ClampAxes()

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::ClampAxes ( MinAxisVal,
MaxAxisVal 
) const

Creates a copy of this vector with both axes clamped to the given range.

Returns
New vector with clamped axes.

◆ Component() [1/2]

template<typename T >
T & UE::Math::TVector2< T >::Component ( int32  Index)
inline

Gets a specific component of the vector.

Parameters
IndexThe index of the component required.
Returns
Reference to the specified component.

◆ Component() [2/2]

template<typename T >
T UE::Math::TVector2< T >::Component ( int32  Index) const
inline

Gets a specific component of the vector.

Parameters
IndexThe index of the component required.
Returns
Copy of the specified component.

◆ ComponentMax()

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::ComponentMax ( const TVector2< T > &  Other) const

Gets the component-wise max of two vectors.

◆ ComponentMin()

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::ComponentMin ( const TVector2< T > &  Other) const

Gets the component-wise min of two vectors.

◆ ComponentwiseAllGreaterOrEqual()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector2< T >::ComponentwiseAllGreaterOrEqual ( const TVector2< T > &  Other) const

Checks whether both components of this vector are greater than or equal to another.

Parameters
OtherThe vector to compare against.
Returns
true if both components of this are greater than or equal to Other, otherwise false.

◆ ComponentwiseAllGreaterThan()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector2< T >::ComponentwiseAllGreaterThan ( const TVector2< T > &  Other) const

Checks whether both components of this vector are greater than another.

Parameters
OtherThe vector to compare against.
Returns
true if both components of this are greater than Other, otherwise false.

◆ ComponentwiseAllLessOrEqual()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector2< T >::ComponentwiseAllLessOrEqual ( const TVector2< T > &  Other) const

Checks whether both components of this vector are less than or equal to another.

Parameters
OtherThe vector to compare against.
Returns
true if both components of this are less than or equal to Other, otherwise false.

◆ ComponentwiseAllLessThan()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector2< T >::ComponentwiseAllLessThan ( const TVector2< T > &  Other) const

Checks whether both components of this vector are less than another.

Parameters
OtherThe vector to compare against.
Returns
true if both components of this are less than Other, otherwise false.

◆ ContainsNaN()

template<typename T >
bool UE::Math::TVector2< T >::ContainsNaN ( ) const
inline

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

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

◆ CrossProduct()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::CrossProduct ( const TVector2< T > &  A,
const TVector2< T > &  B 
)
static

Calculate the cross product of two vectors.

Parameters
AThe first vector.
BThe second vector.
Returns
The cross product.

◆ DiagnosticCheckNaN()

template<typename T >
UE_FORCEINLINE_HINT void UE::Math::TVector2< T >::DiagnosticCheckNaN ( )
inline

◆ Distance()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::Distance ( const TVector2< T > &  V1,
const TVector2< T > &  V2 
)
static

Distance between two 2D points.

Parameters
V1The first point.
V2The second point.
Returns
The distance between two 2D points.

◆ DistSquared()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::DistSquared ( const TVector2< T > &  V1,
const TVector2< T > &  V2 
)
static

Squared distance between two 2D points.

Parameters
V1The first point.
V2The second point.
Returns
The squared distance between two 2D points.

◆ Dot()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::Dot ( const TVector2< T > &  V2) const

Get the dot product of this vector against another.

Parameters
V2The vector to measure dot product against.
Returns
The dot product.

◆ DotProduct()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::DotProduct ( const TVector2< T > &  A,
const TVector2< T > &  B 
)
static

Calculates the dot product of two vectors.

Parameters
AThe first vector.
BThe second vector.
Returns
The dot product.

◆ Equals()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector2< T >::Equals ( const TVector2< T > &  V,
Tolerance = UE_KINDA_SMALL_NUMBER 
) const

Checks for equality with error-tolerant comparison.

Parameters
VThe vector to compare.
ToleranceError tolerance.
Returns
true if the vectors are equal within specified tolerance, otherwise false.

◆ GetAbs()

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::GetAbs ( ) const

Get a copy of this vector with absolute value of each component.

Returns
A copy of this vector with absolute value of each component.

◆ GetAbsMax()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::GetAbsMax ( ) const

Get the maximum absolute value of the vector's components.

Returns
The maximum absolute value of the vector's components.

◆ GetClampedToMaxSize()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::GetClampedToMaxSize ( MaxSize) const
inline

Create a copy of this vector, with its maximum magnitude clamped to MaxSize.

Returns
New vector with clamped magnitude.

◆ GetClampedToSize()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::GetClampedToSize ( Min,
Max 
) const
inline

Create a copy of this vector, with its magnitude clamped between Min and Max.

Returns
New vector with clamped magnitude.

◆ GetMax()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::GetMax ( ) const

Get the maximum value of the vector's components.

Returns
The maximum value of the vector's components.

◆ GetMin()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::GetMin ( ) const

Get the minimum value of the vector's components.

Returns
The minimum value of the vector's components.

◆ GetRotated()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::GetRotated ( AngleDeg) const
inline

Rotates around axis (0,0,1)

Parameters
AngleDegAngle to rotate (in degrees)
Returns
Rotated Vector

◆ GetSafeNormal()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::GetSafeNormal ( Tolerance = UE_SMALL_NUMBER) const
inline

Gets a normalized copy of the vector, checking it is safe to do so based on the length. Returns zero vector if vector length is too small to safely normalize.

Parameters
ToleranceMinimum squared length of vector for normalization.
Returns
A normalized copy of the vector if safe, (0,0) otherwise.

◆ GetSignVector()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::GetSignVector ( ) const
inline

Get a copy of the vector as sign only. Each component is set to +1 or -1, with the sign of zero treated as +1.

Parameters
Acopy of the vector with each component set to +1 or -1

◆ InitFromString()

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

Initialize this Vector based on an FString. The String is expected to contain X=, Y=. The TVector2<T> will be bogus when InitFromString returns false.

Parameters
InSourceStringFString containing the vector values.
Returns
true if the X,Y values were read successfully; false otherwise.

◆ IntPoint()

template<typename T >
FIntPoint UE::Math::TVector2< T >::IntPoint ( ) const
inline

Get this vector as an Int Point.

Returns
New Int Point from this vector.

◆ IsNearlyZero()

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

Checks whether vector is near to zero within a specified tolerance.

Parameters
ToleranceError tolerance.
Returns
true if vector is in tolerance to zero, otherwise false.

◆ IsValidIndex()

template<typename T >
bool UE::Math::TVector2< T >::IsValidIndex ( int32  Index) const

Tests if index is valid, i.e. greater than or equal to zero, and less than the number of components in the vector.

Parameters
IndexIndex to test.
Returns
True if index is valid. False otherwise.

◆ IsZero()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector2< T >::IsZero ( ) const

Checks whether all components of the vector are exactly zero.

Returns
true if vector is exactly zero, otherwise false.

◆ Length()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::Length ( ) const
inline

Get the length (magnitude) of this vector.

Returns
The length of this vector.
See also
Size - This function is a synonym for Size()

◆ Max()

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::Max ( const TVector2< T > &  A,
const TVector2< T > &  B 
)
static

Returns a vector with the maximum component for each dimension from the pair of vectors.

Parameters
AThe first vector.
BThe second vector.
Returns
The max vector.

◆ Min()

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::Min ( const TVector2< T > &  A,
const TVector2< T > &  B 
)
static

Returns a vector with the minimum component for each dimension from the pair of vectors.

Parameters
AThe first vector.
BThe second vector.
Returns
The min vector.

◆ NetSerialize()

template<typename T >
bool UE::Math::TVector2< T >::NetSerialize ( FArchive Ar,
class UPackageMap Map,
bool bOutSuccess 
)
inline

Network serialization function. FVectors NetSerialize without quantization (ie exact values are serialized).

◆ Normalize()

template<typename T >
bool UE::Math::TVector2< T >::Normalize ( Tolerance = UE_SMALL_NUMBER)
inline

Normalize this vector in-place if it is large enough, set it to (0,0) otherwise. (Note this is different from TVector<>::Normalize, which leaves the vector unchanged if it is too small to normalize.)

Parameters
ToleranceMinimum squared length of vector for normalization.
See also
GetSafeNormal()
Returns
true if the vector was normalized correctly, false if it was too small and set to zero.

◆ One()

template<typename T >
static TVector2< T > UE::Math::TVector2< T >::One ( )
inlinestatic

◆ operator!=()

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

Compares this vector against another for inequality.

Parameters
VThe vector to compare against.
Returns
true if the two vectors are not equal, otherwise false.

◆ operator*() [1/2]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator* ( const TVector2< T > &  V) const

Gets the result of component-wise multiplication of this vector by another.

Parameters
VThe other vector to multiply this by.
Returns
The result of the multiplication.

◆ operator*() [2/2]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator* ( Scale) const

Gets the result of scaling the vector (multiplying each component by a value).

Parameters
ScaleHow much to scale the vector by.
Returns
The result of scaling this vector.

◆ operator*=() [1/2]

template<typename T >
TVector2< T > UE::Math::TVector2< T >::operator*= ( const TVector2< T > &  V)
inline

Multiplies this vector with another vector, using component-wise multiplication.

Parameters
VThe vector to multiply with.
Returns
Copy of the vector after multiplication.

◆ operator*=() [2/2]

template<typename T >
TVector2< T > UE::Math::TVector2< T >::operator*= ( Scale)
inline

Scales this vector.

Parameters
ScaleThe scale to multiply vector by.
Returns
Copy of the vector after scaling.

◆ operator+() [1/2]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator+ ( const TVector2< T > &  V) const

Gets the result of adding two vectors together.

Parameters
VThe other vector to add to this.
Returns
The result of adding the vectors together.

◆ operator+() [2/2]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator+ ( A) const

Gets the result of adding A to each component of the vector.

Parameters
AT to add to each component.
Returns
The result of adding A to each component.

◆ operator+=()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::operator+= ( const TVector2< T > &  V)
inline

Adds another vector to this.

Parameters
VThe other vector to add.
Returns
Copy of the vector after addition.

◆ operator-() [1/3]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator- ( ) const

Gets a negated copy of the vector.

Returns
A negated copy of the vector.

◆ operator-() [2/3]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator- ( const TVector2< T > &  V) const

Gets the result of subtracting a vector from this one.

Parameters
VThe other vector to subtract from this.
Returns
The result of the subtraction.

◆ operator-() [3/3]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator- ( A) const

Gets the result of subtracting A from each component of the vector.

Parameters
AT to subtract from each component
Returns
The result of subtracting A from each component.

◆ operator-=()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::operator-= ( const TVector2< T > &  V)
inline

Subtracts another vector from this.

Parameters
VThe other vector to subtract.
Returns
Copy of the vector after subtraction.

◆ operator/() [1/2]

template<typename T >
UE_FORCEINLINE_HINT TVector2< T > UE::Math::TVector2< T >::operator/ ( const TVector2< T > &  V) const

Gets the result of component-wise division of this vector by another.

Parameters
VThe other vector to divide this by.
Returns
The result of the division.

◆ operator/() [2/2]

template<typename T >
TVector2< T > UE::Math::TVector2< T >::operator/ ( Scale) const
inline

Gets the result of dividing each component of the vector by a value.

Parameters
ScaleHow much to divide the vector by.
Returns
The result of division on this vector.

◆ operator/=() [1/2]

template<typename T >
TVector2< T > UE::Math::TVector2< T >::operator/= ( const TVector2< T > &  V)
inline

Divides this vector by another vector, using component-wise division.

Parameters
VThe vector to divide by.
Returns
Copy of the vector after division.

◆ operator/=() [2/2]

template<typename T >
TVector2< T > UE::Math::TVector2< T >::operator/= ( V)
inline

Divides this vector.

Parameters
VWhat to divide vector by.
Returns
Copy of the vector after division.

◆ operator==()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector2< T >::operator== ( const TVector2< T > &  V) const

Compares this vector against another for equality.

Parameters
VThe vector to compare against.
Returns
true if the two vectors are equal, otherwise false.

◆ operator[]() [1/2]

template<typename T >
UE_FORCEINLINE_HINT T & UE::Math::TVector2< T >::operator[] ( int32  Index)

Gets specific component of the vector.

Parameters
Indexthe index of vector component
Returns
reference to component.

◆ operator[]() [2/2]

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::operator[] ( int32  Index) const

Gets specific component of the vector.

Parameters
Indexthe index of vector component
Returns
copy of component value.

◆ operator^()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::operator^ ( const TVector2< T > &  V) const

Calculates cross product of this vector and another.

Parameters
VThe other vector.
Returns
The cross product.

◆ operator|()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::operator| ( const TVector2< T > &  V) const

Calculates dot product of this vector and another.

Parameters
VThe other vector.
Returns
The dot product.

◆ RoundToVector()

template<typename T >
TVector2< T > UE::Math::TVector2< T >::RoundToVector ( ) const
inline

Get this vector as a vector where each component has been rounded to the nearest int.

Returns
New TVector2<T> from this vector that is rounded.

◆ Serialize() [1/2]

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

◆ Serialize() [2/2]

template<typename T >
bool UE::Math::TVector2< T >::Serialize ( FStructuredArchive::FSlot  Slot)
inline

◆ SerializeFromMismatchedTag()

template<typename T >
bool UE::Math::TVector2< T >::SerializeFromMismatchedTag ( FName  StructTag,
FArchive Ar 
)
inline

◆ Set()

template<typename T >
void UE::Math::TVector2< T >::Set ( InX,
InY 
)
inline

Set the values of the vector directly.

Parameters
InXNew X coordinate.
InYNew Y coordinate.

◆ Size()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::Size ( ) const

Get the length (magnitude) of this vector.

Returns
The length of this vector.
See also
Length - This function is a synonym for Length()

◆ SizeSquared()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::SizeSquared ( ) const

Get the squared length of this vector.

Returns
The squared length of this vector.
See also
LengthSquared - This function is a synonym for LengthSquared()

◆ SphericalToUnitCartesian()

template<typename T >
TVector< T > UE::Math::TVector2< T >::SphericalToUnitCartesian ( ) const
inline

Converts spherical coordinates on the unit sphere into a Cartesian unit length vector.

◆ SquaredLength()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector2< T >::SquaredLength ( ) const
inline

Get the squared length of this vector.

Returns
The squared length of this vector.
See also
SizeSquared - This function is a synonym for SizeSquared()

◆ ToDirectionAndLength() [1/2]

template<typename T >
template<typename FArg UE_REQUIRES>
void UE::Math::TVector2< T >::ToDirectionAndLength ( TVector2< T > &  OutDir,
FArg OutLength 
) const
inline

◆ ToDirectionAndLength() [2/2]

template<typename T >
void UE::Math::TVector2< T >::ToDirectionAndLength ( TVector2< T > &  OutDir,
T &  OutLength 
) const
inline

Util to convert this vector into a unit direction vector and its original length.

Parameters
OutDirReference passed in to store unit direction vector.
OutLengthReference passed in to store length of the vector.

◆ ToString()

template<typename T >
UE_FORCEINLINE_HINT FString UE::Math::TVector2< T >::ToString ( ) const

Get a textual representation of the vector.

Returns
Text describing the vector.

◆ UnitX()

template<typename T >
static TVector2< T > UE::Math::TVector2< T >::UnitX ( )
inlinestatic

◆ UnitY()

template<typename T >
static TVector2< T > UE::Math::TVector2< T >::UnitY ( )
inlinestatic

◆ Zero()

template<typename T >
static TVector2< T > UE::Math::TVector2< T >::Zero ( )
inlinestatic

Member Data Documentation

◆ [union]

union { ... } UE::Math::TVector2< T >

◆ NumComponents

template<typename T >
constexpr int32 UE::Math::TVector2< T >::NumComponents = 2
staticconstexpr

The number of components this vector type has.

◆ Unit45Deg

template<typename T >
CORE_API const TVector2<T> UE::Math::TVector2< T >::Unit45Deg
static

Global 2D unit vector constant along the 45 degree angle or symmetrical positive axes (sqrt(.5),sqrt(.5)) or (.707,.707). https://en.wikipedia.org/wiki/Unit_vector

Note
The UnitVector above is actually a value with axes of 1 rather than a magnitude of one.

◆ UnitVector

template<typename T >
CORE_API const TVector2<T> UE::Math::TVector2< T >::UnitVector
static

Global 2D one vector (poorly named) constant (1,1).

Note
Incorrectly named "unit" vector though its magnitude/length/size is not one. Would fix, though likely used all over the world. Use Unit45Deg below for an actual unit vector.

◆ X

template<typename T >
T UE::Math::TVector2< T >::X

Vector's X component.

◆ XY

template<typename T >
T UE::Math::TVector2< T >::XY[2]

◆ Y

template<typename T >
T UE::Math::TVector2< T >::Y

Vector's Y component.

◆ ZeroVector

template<typename T >
CORE_API const TVector2<T> UE::Math::TVector2< T >::ZeroVector
static

Global 2D zero vector constant (0,0)


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