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

#include <Vector.h>

+ Inheritance diagram for UE::Math::TVector< T >:

Public Types

using FReal = T
 

Public Member Functions

UE_FORCEINLINE_HINT void DiagnosticCheckNaN () const
 
UE_FORCEINLINE_HINT void DiagnosticCheckNaN (const TCHAR *Message) const
 
 TVector ()=default
 
 TVector (T InF)
 
UE_FORCEINLINE_HINT constexpr TVector (T InF, TVectorConstInit)
 
 TVector (T InX, T InY, T InZ)
 
 TVector (const TVector2< T > V, T InZ)
 
 TVector (const UE::Math::TVector4< T > &V)
 
 TVector (const FLinearColor &InColor)
 
template<typename IntType >
 TVector (TIntVector3< IntType > InVector)
 
template<typename IntType >
 TVector (TIntPoint< IntType > A)
 
 TVector (EForceInit)
 
TVector< T > operator^ (const TVector< T > &V) const
 
UE_FORCEINLINE_HINT TVector< T > Cross (const TVector< T > &V2) const
 
UE_FORCEINLINE_HINToperator| (const TVector< T > &V) const
 
UE_FORCEINLINE_HINTDot (const TVector< T > &V) const
 
UE_FORCEINLINE_HINT TVector< T > operator+ (const TVector< T > &V) const
 
UE_FORCEINLINE_HINT TVector< T > operator- (const TVector< T > &V) const
 
template<typename FArg UE_REQUIRES>
UE_FORCEINLINE_HINT TVector< T > operator- (FArg Bias) const
 
template<typename FArg UE_REQUIRES>
UE_FORCEINLINE_HINT TVector< T > operator+ (FArg Bias) const
 
template<typename FArg UE_REQUIRES>
UE_FORCEINLINE_HINT TVector< T > operator* (FArg Scale) const
 
template<typename FArg UE_REQUIRES>
TVector< T > operator/ (FArg Scale) const
 
UE_FORCEINLINE_HINT TVector< T > operator* (const TVector< T > &V) const
 
UE_FORCEINLINE_HINT TVector< T > operator/ (const TVector< T > &V) const
 
UE_FORCEINLINE_HINT bool operator== (const TVector< T > &V) const
 
UE_FORCEINLINE_HINT bool operator!= (const TVector< T > &V) const
 
UE_FORCEINLINE_HINT bool Equals (const TVector< T > &V, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
UE_FORCEINLINE_HINT bool AllComponentsEqual (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
UE_FORCEINLINE_HINT TVector< T > operator- () const
 
TVector< T > operator+= (const TVector< T > &V)
 
TVector< T > operator-= (const TVector< T > &V)
 
template<typename FArg UE_REQUIRES>
TVector< T > operator*= (FArg Scale)
 
template<typename FArg UE_REQUIRES>
TVector< T > operator/= (FArg Scale)
 
TVector< T > operator*= (const TVector< T > &V)
 
TVector< T > operator/= (const TVector< T > &V)
 
T & operator[] (int32 Index)
 
operator[] (int32 Index) const
 
T & Component (int32 Index)
 
Component (int32 Index) const
 
bool IsValidIndex (int32 Index) const
 
GetComponentForAxis (EAxis::Type Axis) const
 
void SetComponentForAxis (EAxis::Type Axis, T Component)
 
void Set (T InX, T InY, T InZ)
 
GetMax () const
 
GetAbsMax () const
 
GetMin () const
 
GetAbsMin () const
 
TVector< T > ComponentMin (const TVector< T > &Other) const
 
TVector< T > ComponentMax (const TVector< T > &Other) const
 
TVector< T > GetAbs () const
 
Size () const
 
Length () const
 
SizeSquared () const
 
SquaredLength () const
 
Size2D () const
 
SizeSquared2D () const
 
bool IsNearlyZero (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
bool IsZero () const
 
UE_FORCEINLINE_HINT bool IsUnit (T LengthSquaredTolerance=UE_KINDA_SMALL_NUMBER) const
 
bool IsNormalized () const
 
bool Normalize (T Tolerance=UE_SMALL_NUMBER)
 
TVector< T > GetUnsafeNormal () const
 
TVector< T > GetSafeNormal (T Tolerance=UE_SMALL_NUMBER, const TVector< T > &ResultIfZero=ZeroVector) const
 
TVector< T > GetSafeNormal2D (T Tolerance=UE_SMALL_NUMBER, const TVector< T > &ResultIfZero=ZeroVector) const
 
void ToDirectionAndLength (TVector< T > &OutDir, double &OutLength) const
 
void ToDirectionAndLength (TVector< T > &OutDir, float &OutLength) const
 
TVector< T > GetSignVector () const
 
TVector< T > Projection () const
 
TVector< T > GetUnsafeNormal2D () const
 
TVector< T > GridSnap (const T &GridSz) const
 
TVector< T > BoundToCube (T Radius) const
 
TVector< T > BoundToBox (const TVector< T > &Min, const TVector< T > &Max) const
 
TVector< T > GetClampedToSize (T Min, T Max) const
 
TVector< T > GetClampedToSize2D (T Min, T Max) const
 
TVector< T > GetClampedToMaxSize (T MaxSize) const
 
TVector< T > GetClampedToMaxSize2D (T MaxSize) const
 
void AddBounded (const TVector< T > &V, T Radius=MAX_int16)
 
TVector< T > Reciprocal () const
 
bool IsUniform (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
TVector< T > MirrorByVector (const TVector< T > &MirrorNormal) const
 
TVector< T > MirrorByPlane (const TPlane< T > &Plane) const
 
TVector< T > RotateAngleAxis (const T AngleDeg, const TVector< T > &Axis) const
 
TVector< T > RotateAngleAxisRad (const T AngleRad, const TVector< T > &Axis) const
 
CosineAngle2D (TVector< T > B) const
 
UE_FORCEINLINE_HINT TVector< T > ProjectOnTo (const TVector< T > &A) const
 
UE_FORCEINLINE_HINT TVector< T > ProjectOnToNormal (const TVector< T > &Normal) const
 
CORE_API TRotator< T > ToOrientationRotator () const
 
CORE_API TQuat< T > ToOrientationQuat () const
 
UE_FORCEINLINE_HINT UE::Math::TRotator< T > Rotation () const
 
void FindBestAxisVectors (TVector< T > &Axis1, TVector< T > &Axis2) const
 
void UnwindEuler ()
 
bool ContainsNaN () const
 
FString ToString () const
 
FText ToText () const
 
FString ToCompactString () const
 
FText ToCompactText () const
 
bool InitFromString (const FString &InSourceString)
 
bool InitFromCompactString (const FString &InSourceString)
 
TVector2< T > UnitCartesianToSpherical () const
 
HeadingAngle () const
 
bool Serialize (FArchive &Ar)
 
bool Serialize (FStructuredArchive::FSlot Slot)
 
bool SerializeFromMismatchedTag (FName StructTag, FStructuredArchive::FSlot Slot)
 
bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
template<typename FArg UE_REQUIRES>
 TVector (const TVector< FArg > &From)
 

Static Public Member Functions

static TVector< T > Zero ()
 
static TVector< T > One ()
 
static TVector< T > UnitX ()
 
static TVector< T > UnitY ()
 
static TVector< T > UnitZ ()
 
static UE_FORCEINLINE_HINT TVector< T > CrossProduct (const TVector< T > &A, const TVector< T > &B)
 
static UE_FORCEINLINE_HINTDotProduct (const TVector< T > &A, const TVector< T > &B)
 
static CORE_API TVector< T > SlerpVectorToDirection (const TVector< T > &V, const TVector< T > &Direction, T Alpha)
 
static CORE_API TVector< T > SlerpNormals (const TVector< T > &NormalA, const TVector< T > &NormalB, T Alpha)
 
static void CreateOrthonormalBasis (TVector< T > &XAxis, TVector< T > &YAxis, TVector< T > &ZAxis)
 
static bool PointsAreSame (const TVector< T > &P, const TVector< T > &Q)
 
static bool PointsAreNear (const TVector< T > &Point1, const TVector< T > &Point2, T Dist)
 
staticPointPlaneDist (const TVector< T > &Point, const TVector< T > &PlaneBase, const TVector< T > &PlaneNormal)
 
static TVector< T > PointPlaneProject (const TVector< T > &Point, const TPlane< T > &Plane)
 
static TVector< T > PointPlaneProject (const TVector< T > &Point, const TVector< T > &A, const TVector< T > &B, const TVector< T > &C)
 
static TVector< T > PointPlaneProject (const TVector< T > &Point, const TVector< T > &PlaneBase, const TVector< T > &PlaneNormal)
 
static TVector< T > VectorPlaneProject (const TVector< T > &V, const TVector< T > &PlaneNormal)
 
static UE_FORCEINLINE_HINTDist (const TVector< T > &V1, const TVector< T > &V2)
 
static UE_FORCEINLINE_HINTDistance (const TVector< T > &V1, const TVector< T > &V2)
 
static UE_FORCEINLINE_HINTDistXY (const TVector< T > &V1, const TVector< T > &V2)
 
static UE_FORCEINLINE_HINTDist2D (const TVector< T > &V1, const TVector< T > &V2)
 
static UE_FORCEINLINE_HINTDistSquared (const TVector< T > &V1, const TVector< T > &V2)
 
static UE_FORCEINLINE_HINTDistSquaredXY (const TVector< T > &V1, const TVector< T > &V2)
 
static UE_FORCEINLINE_HINTDistSquared2D (const TVector< T > &V1, const TVector< T > &V2)
 
static UE_FORCEINLINE_HINTBoxPushOut (const TVector< T > &Normal, const TVector< T > &Size)
 
static TVector< T > Min (const TVector< T > &A, const TVector< T > &B)
 
static TVector< T > Max (const TVector< T > &A, const TVector< T > &B)
 
static TVector< T > Min3 (const TVector< T > &A, const TVector< T > &B, const TVector< T > &C)
 
static TVector< T > Max3 (const TVector< T > &A, const TVector< T > &B, const TVector< T > &C)
 
static bool Parallel (const TVector< T > &Normal1, const TVector< T > &Normal2, T ParallelCosineThreshold=UE_THRESH_NORMALS_ARE_PARALLEL)
 
static bool Coincident (const TVector< T > &Normal1, const TVector< T > &Normal2, T ParallelCosineThreshold=UE_THRESH_NORMALS_ARE_PARALLEL)
 
static bool Orthogonal (const TVector< T > &Normal1, const TVector< T > &Normal2, T OrthogonalCosineThreshold=UE_THRESH_NORMALS_ARE_ORTHOGONAL)
 
static bool Coplanar (const TVector< T > &Base1, const TVector< T > &Normal1, const TVector< T > &Base2, const TVector< T > &Normal2, T ParallelCosineThreshold=UE_THRESH_NORMALS_ARE_PARALLEL)
 
staticTriple (const TVector< T > &X, const TVector< T > &Y, const TVector< T > &Z)
 
staticEvaluateBezier (const TVector< T > *ControlPoints, int32 NumPoints, TArray< TVector< T > > &OutPoints)
 
static TVector< T > RadiansToDegrees (const TVector< T > &RadVector)
 
static TVector< T > DegreesToRadians (const TVector< T > &DegVector)
 
static void GenerateClusterCenters (TArray< TVector< T > > &Clusters, const TArray< TVector< T > > &Points, int32 NumIterations, int32 NumConnectionsToBeValid)
 

Public Attributes

union { 
 
   struct { 
 
      T   X 
 
      T   Y 
 
      T   Z 
 
   }  
 
   T   XYZ [3] 
 
};  
 

Static Public Attributes

static constexpr int32 NumComponents = 3
 
static CORE_API const TVector< T > ZeroVector
 
static CORE_API const TVector< T > OneVector
 
static CORE_API const TVector< T > UpVector
 
static CORE_API const TVector< T > DownVector
 
static CORE_API const TVector< T > ForwardVector
 
static CORE_API const TVector< T > BackwardVector
 
static CORE_API const TVector< T > RightVector
 
static CORE_API const TVector< T > LeftVector
 
static CORE_API const TVector< T > XAxisVector
 
static CORE_API const TVector< T > YAxisVector
 
static CORE_API const TVector< T > ZAxisVector
 

Detailed Description

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

A vector in 3-D space composed of components (X, Y, Z) with floating point precision.

Member Typedef Documentation

◆ FReal

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

Constructor & Destructor Documentation

◆ TVector() [1/11]

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

Default constructor (no initialization).

◆ TVector() [2/11]

template<typename T >
UE::Math::TVector< T >::TVector ( InF)
inlineexplicit

Constructor initializing all components to a single T value.

Parameters
InFValue to set all components to.

◆ TVector() [3/11]

template<typename T >
UE_FORCEINLINE_HINT constexpr UE::Math::TVector< T >::TVector ( InF,
TVectorConstInit   
)
constexpr

◆ TVector() [4/11]

template<typename T >
UE::Math::TVector< T >::TVector ( InX,
InY,
InZ 
)
inline

Constructor using initial values for each component.

Parameters
InXX Coordinate.
InYY Coordinate.
InZZ Coordinate.

◆ TVector() [5/11]

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

Constructs a vector from an TVector2<T> and Z value.

Parameters
VVector to copy from.
InZZ Coordinate.

◆ TVector() [6/11]

template<typename T >
UE::Math::TVector< T >::TVector ( const UE::Math::TVector4< T > &  V)
inline

Constructor using the XYZ components from a 4D vector.

Parameters
V4D Vector to copy from.

◆ TVector() [7/11]

template<typename T >
UE::Math::TVector< T >::TVector ( const FLinearColor InColor)
inlineexplicit

Constructs a vector from an FLinearColor.

Parameters
InColorColor to copy from.

◆ TVector() [8/11]

template<typename T >
template<typename IntType >
UE::Math::TVector< T >::TVector ( TIntVector3< IntType >  InVector)
inlineexplicit

Constructs a vector from an FIntVector.

Parameters
InVectorFIntVector to copy from.

◆ TVector() [9/11]

template<typename T >
template<typename IntType >
UE::Math::TVector< T >::TVector ( TIntPoint< IntType >  A)
inlineexplicit

Constructs a vector from an FIntPoint.

Parameters
AInt Point used to set X and Y coordinates, Z is set to zero.

◆ TVector() [10/11]

template<typename T >
UE::Math::TVector< T >::TVector ( EForceInit  )
inlineexplicit

Constructor which initializes all components to zero.

Parameters
EForceInitForce init enum

◆ TVector() [11/11]

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

Member Function Documentation

◆ AddBounded()

template<typename T >
UE_FORCEINLINE_HINT void UE::Math::TVector< T >::AddBounded ( const TVector< T > &  V,
Radius = MAX_int16 
)

Add a vector to this and clamp the result in a cube.

Parameters
VVector to add.
RadiusHalf size of the cube.

◆ AllComponentsEqual()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector< T >::AllComponentsEqual ( Tolerance = UE_KINDA_SMALL_NUMBER) const

Checks whether all components of this vector are the same, within a tolerance.

Parameters
ToleranceError tolerance.
Returns
true if the vectors are equal within tolerance limits, false otherwise.

◆ BoundToBox()

template<typename T >
TVector< T > UE::Math::TVector< T >::BoundToBox ( const TVector< T > &  Min,
const TVector< T > &  Max 
) const
inline

Get a copy of this vector, clamped inside of a cube.

◆ BoundToCube()

template<typename T >
TVector< T > UE::Math::TVector< T >::BoundToCube ( Radius) const
inline

Get a copy of this vector, clamped inside of a cube.

Parameters
RadiusHalf size of the cube.
Returns
A copy of this vector, bound by cube.

◆ BoxPushOut()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector< T >::BoxPushOut ( const TVector< T > &  Normal,
const TVector< T > &  Size 
)
static

Compute pushout of a box from a plane.

Parameters
NormalThe plane normal.
SizeThe size of the box.
Returns
Pushout required.

◆ Coincident()

template<typename T >
bool UE::Math::TVector< T >::Coincident ( const TVector< T > &  Normal1,
const TVector< T > &  Normal2,
ParallelCosineThreshold = UE_THRESH_NORMALS_ARE_PARALLEL 
)
inlinestatic

See if two normal vectors are coincident (nearly parallel and point in the same direction).

Parameters
Normal1First normalized vector.
Normal2Second normalized vector.
ParallelCosineThresholdNormals are coincident if dot product (cosine of angle between them) is greater than or equal to this. For example: cos(1.0 degrees).
Returns
true if vectors are coincident (nearly parallel and point in the same direction), false otherwise.

◆ Component() [1/2]

template<typename T >
T & UE::Math::TVector< 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::TVector< 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 TVector< T > UE::Math::TVector< T >::ComponentMax ( const TVector< T > &  Other) const

Gets the component-wise max of two vectors.

◆ ComponentMin()

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

Gets the component-wise min of two vectors.

◆ ContainsNaN()

template<typename T >
bool UE::Math::TVector< 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.

◆ Coplanar()

template<typename T >
bool UE::Math::TVector< T >::Coplanar ( const TVector< T > &  Base1,
const TVector< T > &  Normal1,
const TVector< T > &  Base2,
const TVector< T > &  Normal2,
ParallelCosineThreshold = UE_THRESH_NORMALS_ARE_PARALLEL 
)
inlinestatic

See if two planes are coplanar. They are coplanar if the normals are nearly parallel and the planes include the same set of points.

Parameters
Base1The base point in the first plane.
Normal1The normal of the first plane.
Base2The base point in the second plane.
Normal2The normal of the second plane.
ParallelCosineThresholdNormals are parallel if absolute value of dot product is greater than or equal to this.
Returns
true if the planes are coplanar, false otherwise.

◆ CosineAngle2D()

template<typename T >
T UE::Math::TVector< T >::CosineAngle2D ( TVector< T >  B) const
inline

Returns the cosine of the angle between this vector and another projected onto the XY plane (no Z).

Parameters
Bthe other vector to find the 2D cosine of the angle with.
Returns
The cosine.

◆ CreateOrthonormalBasis()

template<typename T >
void UE::Math::TVector< T >::CreateOrthonormalBasis ( TVector< T > &  XAxis,
TVector< T > &  YAxis,
TVector< T > &  ZAxis 
)
static

Create an orthonormal basis from a basis with at least two orthogonal vectors. It may change the directions of the X and Y axes to make the basis orthogonal, but it won'T change the direction of the Z axis. All axes will be normalized.

Parameters
XAxisThe input basis' XAxis, and upon return the orthonormal basis' XAxis.
YAxisThe input basis' YAxis, and upon return the orthonormal basis' YAxis.
ZAxisThe input basis' ZAxis, and upon return the orthonormal basis' ZAxis.

◆ Cross()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::Cross ( const TVector< T > &  V2) const

Calculate cross product between this and another vector.

Parameters
VThe other vector.
Returns
The cross product.

◆ CrossProduct()

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

Calculate the cross product of two vectors.

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

◆ DegreesToRadians()

template<typename T >
TVector< T > UE::Math::TVector< T >::DegreesToRadians ( const TVector< T > &  DegVector)
inlinestatic

Converts a vector containing degree values to a vector containing radian values.

Parameters
DegVectorVector containing degree values
Returns
Vector containing radian values

◆ DiagnosticCheckNaN() [1/2]

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

◆ DiagnosticCheckNaN() [2/2]

template<typename T >
UE_FORCEINLINE_HINT void UE::Math::TVector< T >::DiagnosticCheckNaN ( const TCHAR Message) const
inline

◆ Dist()

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

Euclidean distance between two points.

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

◆ Dist2D()

template<typename T >
static UE_FORCEINLINE_HINT T UE::Math::TVector< T >::Dist2D ( const TVector< T > &  V1,
const TVector< T > &  V2 
)
inlinestatic

◆ Distance()

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

◆ DistSquared()

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

Squared distance between two points.

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

◆ DistSquared2D()

template<typename T >
static UE_FORCEINLINE_HINT T UE::Math::TVector< T >::DistSquared2D ( const TVector< T > &  V1,
const TVector< T > &  V2 
)
inlinestatic

◆ DistSquaredXY()

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

Squared distance between two points in the XY plane only.

Parameters
V1The first point.
V2The second point.
Returns
The squared distance between two points in the XY plane

◆ DistXY()

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

Euclidean distance between two points in the XY plane (ignoring Z).

Parameters
V1The first point.
V2The second point.
Returns
The distance between two points in the XY plane.

◆ Dot()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector< T >::Dot ( const TVector< T > &  V) const

Calculate the dot product between this and another vector.

Parameters
VThe other vector.
Returns
The dot product.

◆ DotProduct()

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

Calculate 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::TVector< T >::Equals ( const TVector< T > &  V,
Tolerance = UE_KINDA_SMALL_NUMBER 
) const

Check against another vector for equality, within specified error limits.

Parameters
VThe vector to check against.
ToleranceError tolerance.
Returns
true if the vectors are equal within tolerance limits, false otherwise.

◆ EvaluateBezier()

template<typename T >
T UE::Math::TVector< T >::EvaluateBezier ( const TVector< T > *  ControlPoints,
int32  NumPoints,
TArray< TVector< T > > &  OutPoints 
)
static

Generates a list of sample points on a Bezier curve defined by 2 points.

Parameters
ControlPointsArray of 4 FVectors (vert1, controlpoint1, controlpoint2, vert2).
NumPointsNumber of samples.
OutPointsReceives the output samples.
Returns
The path length.

◆ FindBestAxisVectors()

template<typename T >
void UE::Math::TVector< T >::FindBestAxisVectors ( TVector< T > &  Axis1,
TVector< T > &  Axis2 
) const

Find good arbitrary axis vectors to represent U and V axes of a plane, using this vector as the normal of the plane.

Parameters
Axis1Reference to first axis.
Axis2Reference to second axis.

◆ GenerateClusterCenters()

template<typename T >
void UE::Math::TVector< T >::GenerateClusterCenters ( TArray< TVector< T > > &  Clusters,
const TArray< TVector< T > > &  Points,
int32  NumIterations,
int32  NumConnectionsToBeValid 
)
static

Given a current set of cluster centers, a set of points, iterate N times to move clusters to be central.

Parameters
ClustersReference to array of Clusters.
PointsSet of points.
NumIterationsNumber of iterations.
NumConnectionsToBeValidSometimes you will have long strings that come off the mass of points which happen to have been chosen as Cluster starting points. You want to be able to disregard those.

◆ GetAbs()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< 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::TVector< T >::GetAbsMax ( ) const

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

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

◆ GetAbsMin()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector< T >::GetAbsMin ( ) const

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

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

◆ GetClampedToMaxSize()

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

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

◆ GetClampedToMaxSize2D()

template<typename T >
TVector< T > UE::Math::TVector< T >::GetClampedToMaxSize2D ( MaxSize) const
inline

Create a copy of this vector, with the maximum 2D magnitude clamped to MaxSize. Z is unchanged.

◆ GetClampedToSize()

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

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

◆ GetClampedToSize2D()

template<typename T >
TVector< T > UE::Math::TVector< T >::GetClampedToSize2D ( Min,
Max 
) const
inline

Create a copy of this vector, with the 2D magnitude clamped between Min and Max. Z is unchanged.

◆ GetComponentForAxis()

template<typename T >
T UE::Math::TVector< T >::GetComponentForAxis ( EAxis::Type  Axis) const
inline

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

◆ GetMax()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector< 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::TVector< T >::GetMin ( ) const

Get the minimum value of the vector's components.

Returns
The minimum value of the vector's components.

◆ GetSafeNormal()

template<typename T >
TVector< T > UE::Math::TVector< T >::GetSafeNormal ( Tolerance = UE_SMALL_NUMBER,
const TVector< T > &  ResultIfZero = ZeroVector 
) const
inline

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

Parameters
ToleranceMinimum squared vector length. Must be positive.
Returns
A normalized copy if safe, ResultIfZero otherwise.

◆ GetSafeNormal2D()

template<typename T >
TVector< T > UE::Math::TVector< T >::GetSafeNormal2D ( Tolerance = UE_SMALL_NUMBER,
const TVector< T > &  ResultIfZero = ZeroVector 
) const
inline

Gets a normalized copy of the 2D components of the vector, checking it is safe to do so. Z is set to zero. Returns zero vector by default if vector length is too small to normalize.

Parameters
ToleranceMinimum squared vector length. Must be positive.
Returns
Normalized copy if safe, otherwise returns ResultIfZero.

◆ GetSignVector()

template<typename T >
TVector< T > UE::Math::TVector< 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

◆ GetUnsafeNormal()

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

Calculates normalized version of vector without checking for zero length.

Returns
Normalized version of vector.
See also
GetSafeNormal()

◆ GetUnsafeNormal2D()

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

Calculates normalized 2D version of vector without checking for zero length.

Returns
Normalized version of vector.
See also
GetSafeNormal2D()

◆ GridSnap()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::GridSnap ( const T &  GridSz) const

Gets a copy of this vector snapped to a grid.

Parameters
GridSzGrid dimension.
Returns
A copy of this vector snapped to a grid.
See also
FMath::GridSnap()

◆ HeadingAngle()

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

Convert a direction vector into a 'heading' angle.

Returns
'Heading' angle between +/-PI. 0 is pointing down +X.

◆ InitFromCompactString()

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

Initialize this Vector based on an FString. The String is expected to contain V(0) or at least one value X=, Y=, Z=, previously produced by ToCompactString() The TVector<T> will be bogus when InitFromString returns false.

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

◆ InitFromString()

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

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

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

◆ IsNearlyZero()

template<typename T >
bool UE::Math::TVector< 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 the vector is near to zero, false otherwise.

◆ IsNormalized()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector< T >::IsNormalized ( ) const

Checks whether vector is normalized.

Returns
true if normalized, false otherwise.

◆ IsUniform()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector< T >::IsUniform ( Tolerance = UE_KINDA_SMALL_NUMBER) const

Check whether X, Y and Z are nearly equal.

Parameters
ToleranceSpecified Tolerance.
Returns
true if X == Y == Z within the specified tolerance.

◆ IsUnit()

template<typename T >
UE_FORCEINLINE_HINT bool UE::Math::TVector< T >::IsUnit ( LengthSquaredTolerance = UE_KINDA_SMALL_NUMBER) const

Check if the vector is of unit length, with specified tolerance.

Parameters
LengthSquaredToleranceTolerance against squared length.
Returns
true if the vector is a unit vector within the specified tolerance.

◆ IsValidIndex()

template<typename T >
bool UE::Math::TVector< 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::TVector< T >::IsZero ( ) const

Checks whether all components of the vector are exactly zero.

Returns
true if the vector is exactly zero, false otherwise.

◆ Length()

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

Get the length (magnitude) of this vector.

Returns
The length of this vector.

◆ Max()

template<typename T >
TVector< T > UE::Math::TVector< T >::Max ( const TVector< T > &  A,
const TVector< T > &  B 
)
inlinestatic

◆ Max3()

template<typename T >
TVector< T > UE::Math::TVector< T >::Max3 ( const TVector< T > &  A,
const TVector< T > &  B,
const TVector< T > &  C 
)
inlinestatic

◆ Min()

template<typename T >
TVector< T > UE::Math::TVector< T >::Min ( const TVector< T > &  A,
const TVector< T > &  B 
)
inlinestatic

Min, Max, Min3, Max3 like FMath

◆ Min3()

template<typename T >
TVector< T > UE::Math::TVector< T >::Min3 ( const TVector< T > &  A,
const TVector< T > &  B,
const TVector< T > &  C 
)
inlinestatic

◆ MirrorByPlane()

template<typename T >
TVector< T > UE::Math::TVector< T >::MirrorByPlane ( const TPlane< T > &  Plane) const
inline

Mirrors a vector about a plane.

Parameters
PlanePlane to mirror about.
Returns
Mirrored vector.

◆ MirrorByVector()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::MirrorByVector ( const TVector< T > &  MirrorNormal) const

Mirror a vector about a normal vector.

Parameters
MirrorNormalNormal vector to mirror about.
Returns
Mirrored vector.

◆ NetSerialize()

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

Network serialization function. FVectors NetSerialize without quantization (ie exact values are serialized). se the FVectors_NetQuantize etc (NetSerialization.h) instead.

See also
FVector_NetQuantize, FVector_NetQuantize10, FVector_NetQuantize100, FVector_NetQuantizeNormal

◆ Normalize()

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

Normalize this vector in-place if it is larger than a given tolerance. Leaves it unchanged if not.

Parameters
ToleranceMinimum squared length of vector for normalization.
Returns
true if the vector was normalized correctly, false otherwise.

◆ One()

template<typename T >
static TVector< T > UE::Math::TVector< T >::One ( )
inlinestatic
Returns
One Vector (1,1,1)

◆ operator!=()

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

Check against another vector for inequality.

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

◆ operator*() [1/2]

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

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

Parameters
VThe vector to multiply with.
Returns
The result of multiplication.

◆ operator*() [2/2]

template<typename T >
template<typename FArg UE_REQUIRES>
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::operator* ( FArg  Scale) const
inline

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

Parameters
ScaleWhat to multiply each component by.
Returns
The result of multiplication.

◆ operator*=() [1/2]

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

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

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

◆ operator*=() [2/2]

template<typename T >
template<typename FArg UE_REQUIRES>
TVector< T > UE::Math::TVector< T >::operator*= ( FArg  Scale)
inline

Scales the vector.

Parameters
ScaleAmount to scale this vector by.
Returns
Copy of the vector after scaling.

◆ operator+() [1/2]

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

Gets the result of component-wise addition of this and another vector.

Parameters
VThe vector to add to this.
Returns
The result of vector addition.

◆ operator+() [2/2]

template<typename T >
template<typename FArg UE_REQUIRES>
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::operator+ ( FArg  Bias) const
inline

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

Parameters
BiasHow much to add to each component.
Returns
The result of addition.

◆ operator+=()

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

Adds another vector to this. Uses component-wise addition.

Parameters
VVector to add to this.
Returns
Copy of the vector after addition.

◆ operator-() [1/3]

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

Get a negated copy of the vector.

Returns
A negated copy of the vector.

◆ operator-() [2/3]

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

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

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

◆ operator-() [3/3]

template<typename T >
template<typename FArg UE_REQUIRES>
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::operator- ( FArg  Bias) const
inline

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

Parameters
BiasHow much to subtract from each component.
Returns
The result of subtraction.

◆ operator-=()

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

Subtracts another vector from this. Uses component-wise subtraction.

Parameters
VVector to subtract from this.
Returns
Copy of the vector after subtraction.

◆ operator/() [1/2]

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

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

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

◆ operator/() [2/2]

template<typename T >
template<typename FArg UE_REQUIRES>
TVector< T > UE::Math::TVector< T >::operator/ ( FArg  Scale) const
inline

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

Parameters
ScaleWhat to divide each component by.
Returns
The result of division.

◆ operator/=() [1/2]

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

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

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

◆ operator/=() [2/2]

template<typename T >
template<typename FArg UE_REQUIRES>
TVector< T > UE::Math::TVector< T >::operator/= ( FArg  Scale)
inline

Divides the vector by a number.

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

◆ operator==()

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

Check against another vector for equality.

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

◆ operator[]() [1/2]

template<typename T >
UE_FORCEINLINE_HINT T & UE::Math::TVector< 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::TVector< T >::operator[] ( int32  Index) const

Gets specific component of the vector.

Parameters
Indexthe index of vector component
Returns
Copy of the component.

◆ operator^()

template<typename T >
TVector< T > UE::Math::TVector< T >::operator^ ( const TVector< T > &  V) const
inline

Calculate cross product between this and another vector.

Parameters
VThe other vector.
Returns
The cross product.

◆ operator|()

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

Calculate the dot product between this and another vector.

Parameters
VThe other vector.
Returns
The dot product.

◆ Orthogonal()

template<typename T >
bool UE::Math::TVector< T >::Orthogonal ( const TVector< T > &  Normal1,
const TVector< T > &  Normal2,
OrthogonalCosineThreshold = UE_THRESH_NORMALS_ARE_ORTHOGONAL 
)
inlinestatic

See if two normal vectors are nearly orthogonal (perpendicular), meaning the angle between them is close to 90 degrees.

Parameters
Normal1First normalized vector.
Normal2Second normalized vector.
OrthogonalCosineThresholdNormals are orthogonal if absolute value of dot product (cosine of angle between them) is less than or equal to this. For example: cos(89.0 degrees).
Returns
true if vectors are orthogonal (perpendicular), false otherwise.

◆ Parallel()

template<typename T >
bool UE::Math::TVector< T >::Parallel ( const TVector< T > &  Normal1,
const TVector< T > &  Normal2,
ParallelCosineThreshold = UE_THRESH_NORMALS_ARE_PARALLEL 
)
inlinestatic

See if two normal vectors are nearly parallel, meaning the angle between them is close to 0 degrees.

Parameters
Normal1First normalized vector.
Normal1Second normalized vector.
ParallelCosineThresholdNormals are parallel if absolute value of dot product (cosine of angle between them) is greater than or equal to this. For example: cos(1.0 degrees).
Returns
true if vectors are nearly parallel, false otherwise.

◆ PointPlaneDist()

template<typename T >
T UE::Math::TVector< T >::PointPlaneDist ( const TVector< T > &  Point,
const TVector< T > &  PlaneBase,
const TVector< T > &  PlaneNormal 
)
inlinestatic

Calculate the signed distance (in the direction of the normal) between a point and a plane.

Parameters
PointThe Point we are checking.
PlaneBaseThe Base Point in the plane.
PlaneNormalThe Normal of the plane (assumed to be unit length).
Returns
Signed distance between point and plane.

◆ PointPlaneProject() [1/3]

template<typename T >
TVector< T > UE::Math::TVector< T >::PointPlaneProject ( const TVector< T > &  Point,
const TPlane< T > &  Plane 
)
inlinestatic

Calculate the projection of a point on the given plane.

Parameters
PointThe point to project onto the plane
PlaneThe plane
Returns
Projection of Point onto Plane

◆ PointPlaneProject() [2/3]

template<typename T >
TVector< T > UE::Math::TVector< T >::PointPlaneProject ( const TVector< T > &  Point,
const TVector< T > &  A,
const TVector< T > &  B,
const TVector< T > &  C 
)
inlinestatic

Calculate the projection of a point on the plane defined by counter-clockwise (CCW) points A,B,C.

Parameters
PointThe point to project onto the plane
A1st of three points in CCW order defining the plane
B2nd of three points in CCW order defining the plane
C3rd of three points in CCW order defining the plane
Returns
Projection of Point onto plane ABC

◆ PointPlaneProject() [3/3]

template<typename T >
TVector< T > UE::Math::TVector< T >::PointPlaneProject ( const TVector< T > &  Point,
const TVector< T > &  PlaneBase,
const TVector< T > &  PlaneNormal 
)
inlinestatic

Calculate the projection of a point on the plane defined by PlaneBase and PlaneNormal.

Parameters
PointThe point to project onto the plane
PlaneBasePoint on the plane
PlaneNormNormal of the plane (assumed to be unit length).
Returns
Projection of Point onto plane

◆ PointsAreNear()

template<typename T >
bool UE::Math::TVector< T >::PointsAreNear ( const TVector< T > &  Point1,
const TVector< T > &  Point2,
Dist 
)
inlinestatic

Compare two points and see if they're within specified distance.

Parameters
Point1First vector.
Point2Second vector.
DistSpecified distance.
Returns
Whether two points are within the specified distance. Uses fast distance approximation (linear per-component distance).

◆ PointsAreSame()

template<typename T >
bool UE::Math::TVector< T >::PointsAreSame ( const TVector< T > &  P,
const TVector< T > &  Q 
)
inlinestatic

Compare two points and see if they're the same, using a threshold.

Parameters
PFirst vector.
QSecond vector.
Returns
Whether points are the same within a threshold. Uses fast distance approximation (linear per-component distance).

◆ Projection()

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

Projects 2D components of vector based on Z.

Returns
Projected version of vector based on Z.

◆ ProjectOnTo()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::ProjectOnTo ( const TVector< T > &  A) const

Gets a copy of this vector projected onto the input vector.

Parameters
AVector to project onto, does not assume it is normalized.
Returns
Projected vector.

◆ ProjectOnToNormal()

template<typename T >
UE_FORCEINLINE_HINT TVector< T > UE::Math::TVector< T >::ProjectOnToNormal ( const TVector< T > &  Normal) const

Gets a copy of this vector projected onto the input vector, which is assumed to be unit length.

Parameters
NormalVector to project onto (assumed to be unit length).
Returns
Projected vector.

◆ RadiansToDegrees()

template<typename T >
TVector< T > UE::Math::TVector< T >::RadiansToDegrees ( const TVector< T > &  RadVector)
inlinestatic

Converts a vector containing radian values to a vector containing degree values.

Parameters
RadVectorVector containing radian values
Returns
Vector containing degree values

◆ Reciprocal()

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

Gets the reciprocal of this vector, avoiding division by zero. Zero components are set to BIG_NUMBER.

Returns
Reciprocal of this vector.

◆ RotateAngleAxis()

template<typename T >
TVector< T > UE::Math::TVector< T >::RotateAngleAxis ( const T  AngleDeg,
const TVector< T > &  Axis 
) const
inline

Rotates around Axis (assumes Axis.Size() == 1).

Parameters
AngleDegAngle to rotate (in degrees).
AxisAxis to rotate around.
Returns
Rotated Vector.

◆ RotateAngleAxisRad()

template<typename T >
TVector< T > UE::Math::TVector< T >::RotateAngleAxisRad ( const T  AngleRad,
const TVector< T > &  Axis 
) const
inline

Rotates around Axis (assumes Axis.Size() == 1).

Parameters
AngleRadAngle to rotate (in radians).
AxisAxis to rotate around.
Returns
Rotated Vector.

◆ Rotation()

template<typename T >
UE_FORCEINLINE_HINT UE::Math::TRotator< T > UE::Math::TVector< T >::Rotation ( ) const
inline

Return the UE::Math::TRotator<T> orientation corresponding to the direction in which the vector points. Sets Yaw and Pitch to the proper numbers, and sets Roll to zero because the roll can't be determined from a vector.

Note
Identical to 'ToOrientationRotator()' and preserved for legacy reasons.
Returns
UE::Math::TRotator<T> from the Vector's direction.
See also
ToOrientationRotator(), ToOrientationQuat()

◆ Serialize() [1/2]

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

◆ Serialize() [2/2]

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

◆ SerializeFromMismatchedTag()

template<typename T >
bool UE::Math::TVector< T >::SerializeFromMismatchedTag ( FName  StructTag,
FStructuredArchive::FSlot  Slot 
)
inline

◆ Set()

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

Set the values of the vector directly.

Parameters
InXNew X coordinate.
InYNew Y coordinate.
InZNew Z coordinate.

◆ SetComponentForAxis()

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

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

◆ Size()

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

Get the length (magnitude) of this vector.

Returns
The length of this vector.

◆ Size2D()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector< T >::Size2D ( ) const

Get the length of the 2D components of this vector.

Returns
The 2D length of this vector.

◆ SizeSquared()

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

Get the squared length of this vector.

Returns
The squared length of this vector.

◆ SizeSquared2D()

template<typename T >
UE_FORCEINLINE_HINT T UE::Math::TVector< T >::SizeSquared2D ( ) const

Get the squared length of the 2D components of this vector.

Returns
The squared 2D length of this vector.

◆ SlerpNormals()

template<typename T >
UE::Math::TVector< T > UE::Math::TVector< T >::SlerpNormals ( const TVector< T > &  NormalA,
const TVector< T > &  NormalB,
Alpha 
)
static

Interpolate from normalized vector A to normalized vector B along a spherical path.

Parameters
NormalAStart direction of interpolation, must be normalized.
NormalBEnd target direction of interpolation, must be normalized.
Alphainterpolation amount, usually between 0-1
Returns
Normalized vector after interpolating between NormalA and NormalB along a spherical path.

◆ SlerpVectorToDirection()

template<typename T >
UE::Math::TVector< T > UE::Math::TVector< T >::SlerpVectorToDirection ( const TVector< T > &  V,
const TVector< T > &  Direction,
Alpha 
)
static

Interpolate from a vector to the direction of another vector along a spherical path.

Parameters
VVector we interpolate from
DirectionTarget direction we interpolate to
Alphainterpolation amount, usually between 0-1
Returns
Vector after interpolating between Vector and Direction along a spherical path. The magnitude will remain the length of the starting vector.

◆ SquaredLength()

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

Get the squared length of this vector.

Returns
The squared length of this vector.

◆ ToCompactString()

template<typename T >
FString UE::Math::TVector< T >::ToCompactString ( ) const
inline

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

◆ ToCompactText()

template<typename T >
FText UE::Math::TVector< T >::ToCompactText ( ) const
inline

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

◆ ToDirectionAndLength() [1/2]

template<typename T >
void UE::Math::TVector< T >::ToDirectionAndLength ( TVector< T > &  OutDir,
double 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.

◆ ToDirectionAndLength() [2/2]

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

◆ ToOrientationQuat()

template<typename T >
UE::Math::TQuat< T > UE::Math::TVector< T >::ToOrientationQuat ( ) const

Return the Quaternion orientation corresponding to the direction in which the vector points. Similar to the UE::Math::TRotator<T> version, returns a result without roll such that it preserves the up vector.

Note
If you don'T care about preserving the up vector and just want the most direct rotation, you can use the faster 'FQuat::FindBetweenVectors(FVector::ForwardVector, YourVector)' or 'FQuat::FindBetweenNormals(...)' if you know the vector is of unit length.
Returns
Quaternion from the Vector's direction, without any roll.
See also
ToOrientationRotator(), FQuat::FindBetweenVectors()

◆ ToOrientationRotator()

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

Return the TRotator orientation corresponding to the direction in which the vector points. Sets Yaw and Pitch to the proper numbers, and sets Roll to zero because the roll can'T be determined from a vector.

Returns
TRotator from the Vector's direction, without any roll.
See also
ToOrientationQuat()

◆ ToString()

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

Get a textual representation of this vector.

Returns
A string describing the vector.

◆ ToText()

template<typename T >
FText UE::Math::TVector< T >::ToText ( ) const
inline

Get a locale aware textual representation of this vector.

Returns
A string describing the vector.

◆ Triple()

template<typename T >
T UE::Math::TVector< T >::Triple ( const TVector< T > &  X,
const TVector< T > &  Y,
const TVector< T > &  Z 
)
inlinestatic

Triple product of three vectors: X dot (Y cross Z).

Parameters
XThe first vector.
YThe second vector.
ZThe third vector.
Returns
The triple product: X dot (Y cross Z).

◆ UnitCartesianToSpherical()

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

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

Returns
Output Theta will be in the range [0, PI], and output Phi will be in the range [-PI, PI].

◆ UnitX()

template<typename T >
static TVector< T > UE::Math::TVector< T >::UnitX ( )
inlinestatic
Returns
Unit X Vector (1,0,0)

◆ UnitY()

template<typename T >
static TVector< T > UE::Math::TVector< T >::UnitY ( )
inlinestatic
Returns
Unit Y Vector (0,1,0)

◆ UnitZ()

template<typename T >
static TVector< T > UE::Math::TVector< T >::UnitZ ( )
inlinestatic
Returns
Unit Z Vector (0,0,1)

◆ UnwindEuler()

template<typename T >
void UE::Math::TVector< T >::UnwindEuler ( )

When this vector contains Euler angles (degrees), ensure that angles are between +/-180

◆ VectorPlaneProject()

template<typename T >
TVector< T > UE::Math::TVector< T >::VectorPlaneProject ( const TVector< T > &  V,
const TVector< T > &  PlaneNormal 
)
inlinestatic

Calculate the projection of a vector on the plane defined by PlaneNormal.

Parameters
VThe vector to project onto the plane.
PlaneNormalNormal of the plane (assumed to be unit length).
Returns
Projection of V onto plane.

◆ Zero()

template<typename T >
static TVector< T > UE::Math::TVector< T >::Zero ( )
inlinestatic
Returns
Zero Vector (0,0,0)

Member Data Documentation

◆ [union]

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

◆ BackwardVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::BackwardVector
static

Unreal backward vector (-1,0,0)

◆ DownVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::DownVector
static

Unreal down vector (0,0,-1)

◆ ForwardVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::ForwardVector
static

Unreal forward vector (1,0,0)

◆ LeftVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::LeftVector
static

Unreal left vector (0,-1,0)

◆ NumComponents

template<typename T >
constexpr int32 UE::Math::TVector< T >::NumComponents = 3
staticconstexpr

The number of components this vector type has.

◆ OneVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::OneVector
static

One vector (1,1,1)

◆ RightVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::RightVector
static

Unreal right vector (0,1,0)

◆ UpVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::UpVector
static

Unreal up vector (0,0,1)

◆ X

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

Vector's X component.

◆ XAxisVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::XAxisVector
static

Unit X axis vector (1,0,0)

◆ XYZ

template<typename T >
T UE::Math::TVector< T >::XYZ[3]

◆ Y

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

Vector's Y component.

◆ YAxisVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::YAxisVector
static

Unit Y axis vector (0,1,0)

◆ Z

template<typename T >
T UE::Math::TVector< T >::Z

Vector's Z component.

◆ ZAxisVector

template<typename T >
CORE_API const TVector<T> UE::Math::TVector< T >::ZAxisVector
static

Unit Z axis vector (0,0,1)

◆ ZeroVector

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

A zero vector (0,0,0)


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