Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
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

FORCEINLINE void DiagnosticCheckNaN () const
 
FORCEINLINE void DiagnosticCheckNaN (const TCHAR *Message) const
 
FORCEINLINE TVector ()
 
FORCEINLINE TVector (T InF)
 
FORCEINLINE constexpr TVector (T InF, TVectorConstInit)
 
FORCEINLINE TVector (T InX, T InY, T InZ)
 
FORCEINLINE TVector (const TVector2< T > V, T InZ)
 
FORCEINLINE 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)
 
FORCEINLINE TVector (EForceInit)
 
FORCEINLINE TVector< Toperator^ (const TVector< T > &V) const
 
FORCEINLINE TVector< TCross (const TVector< T > &V2) const
 
FORCEINLINE T operator| (const TVector< T > &V) const
 
FORCEINLINE T Dot (const TVector< T > &V) const
 
FORCEINLINE TVector< Toperator+ (const TVector< T > &V) const
 
FORCEINLINE TVector< Toperator- (const TVector< T > &V) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector< Toperator- (FArg Bias) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector< Toperator+ (FArg Bias) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector< Toperator* (FArg Scale) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
TVector< Toperator/ (FArg Scale) const
 
FORCEINLINE TVector< Toperator* (const TVector< T > &V) const
 
FORCEINLINE TVector< Toperator/ (const TVector< T > &V) const
 
bool operator== (const TVector< T > &V) const
 
bool operator!= (const TVector< T > &V) const
 
bool Equals (const TVector< T > &V, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
bool AllComponentsEqual (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
FORCEINLINE TVector< Toperator- () const
 
FORCEINLINE TVector< Toperator+= (const TVector< T > &V)
 
FORCEINLINE TVector< Toperator-= (const TVector< T > &V)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector< Toperator*= (FArg Scale)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
TVector< Toperator/= (FArg Scale)
 
TVector< Toperator*= (const TVector< T > &V)
 
TVector< Toperator/= (const TVector< T > &V)
 
Toperator[] (int32 Index)
 
T operator[] (int32 Index) const
 
TComponent (int32 Index)
 
T Component (int32 Index) const
 
T GetComponentForAxis (EAxis::Type Axis) const
 
void SetComponentForAxis (EAxis::Type Axis, T Component)
 
void Set (T InX, T InY, T InZ)
 
T GetMax () const
 
T GetAbsMax () const
 
T GetMin () const
 
T GetAbsMin () const
 
TVector< TComponentMin (const TVector< T > &Other) const
 
TVector< TComponentMax (const TVector< T > &Other) const
 
TVector< TGetAbs () const
 
T Size () const
 
T Length () const
 
T SizeSquared () const
 
T SquaredLength () const
 
T Size2D () const
 
T SizeSquared2D () const
 
bool IsNearlyZero (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
bool IsZero () const
 
FORCEINLINE bool IsUnit (T LengthSquaredTolerance=UE_KINDA_SMALL_NUMBER) const
 
bool IsNormalized () const
 
bool Normalize (T Tolerance=UE_SMALL_NUMBER)
 
FORCEINLINE TVector< TGetUnsafeNormal () const
 
TVector< TGetSafeNormal (T Tolerance=UE_SMALL_NUMBER, const TVector< T > &ResultIfZero=ZeroVector) const
 
TVector< TGetSafeNormal2D (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
 
FORCEINLINE TVector< TGetSignVector () const
 
TVector< TProjection () const
 
FORCEINLINE TVector< TGetUnsafeNormal2D () const
 
TVector< TGridSnap (const T &GridSz) const
 
TVector< TBoundToCube (T Radius) const
 
TVector< TBoundToBox (const TVector< T > &Min, const TVector< T > &Max) const
 
TVector< TGetClampedToSize (T Min, T Max) const
 
TVector< TGetClampedToSize2D (T Min, T Max) const
 
TVector< TGetClampedToMaxSize (T MaxSize) const
 
TVector< TGetClampedToMaxSize2D (T MaxSize) const
 
void AddBounded (const TVector< T > &V, T Radius=MAX_int16)
 
TVector< TReciprocal () const
 
bool IsUniform (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
TVector< TMirrorByVector (const TVector< T > &MirrorNormal) const
 
TVector< TMirrorByPlane (const TPlane< T > &Plane) const
 
TVector< TRotateAngleAxis (const T AngleDeg, const TVector< T > &Axis) const
 
TVector< TRotateAngleAxisRad (const T AngleRad, const TVector< T > &Axis) const
 
FORCEINLINE T CosineAngle2D (TVector< T > B) const
 
FORCEINLINE TVector< TProjectOnTo (const TVector< T > &A) const
 
FORCEINLINE TVector< TProjectOnToNormal (const TVector< T > &Normal) const
 
TRotator< TToOrientationRotator () const
 
TQuat< TToOrientationQuat () const
 
FORCEINLINE UE::Math::TRotator< TRotation () 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< TUnitCartesianToSpherical () const
 
T HeadingAngle () const
 
bool Serialize (FStructuredArchive::FSlot Slot)
 
bool SerializeFromMismatchedTag (FName StructTag, FStructuredArchive::FSlot Slot)
 
bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
 TVector (const TVector< FArg > &From)
 
template<typename IntType >
FORCEINLINE TVector (TIntVector3< IntType > InVector)
 
template<typename IntType >
FORCEINLINE TVector (TIntPoint< IntType > A)
 

Static Public Member Functions

static TVector< TZero ()
 
static TVector< TOne ()
 
static TVector< TUnitX ()
 
static TVector< TUnitY ()
 
static TVector< TUnitZ ()
 
static FORCEINLINE TVector< TCrossProduct (const TVector< T > &A, const TVector< T > &B)
 
static FORCEINLINE T DotProduct (const TVector< T > &A, const TVector< T > &B)
 
static TVector< TSlerpVectorToDirection (TVector< T > &V, TVector< T > &Direction, T Alpha)
 
static TVector< TSlerpNormals (TVector< T > &NormalA, 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)
 
static T PointPlaneDist (const TVector< T > &Point, const TVector< T > &PlaneBase, const TVector< T > &PlaneNormal)
 
static TVector< TPointPlaneProject (const TVector< T > &Point, const TPlane< T > &Plane)
 
static TVector< TPointPlaneProject (const TVector< T > &Point, const TVector< T > &A, const TVector< T > &B, const TVector< T > &C)
 
static TVector< TPointPlaneProject (const TVector< T > &Point, const TVector< T > &PlaneBase, const TVector< T > &PlaneNormal)
 
static TVector< TVectorPlaneProject (const TVector< T > &V, const TVector< T > &PlaneNormal)
 
static FORCEINLINE T Dist (const TVector< T > &V1, const TVector< T > &V2)
 
static FORCEINLINE T Distance (const TVector< T > &V1, const TVector< T > &V2)
 
static FORCEINLINE T DistXY (const TVector< T > &V1, const TVector< T > &V2)
 
static FORCEINLINE T Dist2D (const TVector< T > &V1, const TVector< T > &V2)
 
static FORCEINLINE T DistSquared (const TVector< T > &V1, const TVector< T > &V2)
 
static FORCEINLINE T DistSquaredXY (const TVector< T > &V1, const TVector< T > &V2)
 
static FORCEINLINE T DistSquared2D (const TVector< T > &V1, const TVector< T > &V2)
 
static FORCEINLINE T BoxPushOut (const TVector< T > &Normal, const TVector< T > &Size)
 
static FORCEINLINE TVector< TMin (const TVector< T > &A, const TVector< T > &B)
 
static FORCEINLINE TVector< TMax (const TVector< T > &A, const TVector< T > &B)
 
static FORCEINLINE TVector< TMin3 (const TVector< T > &A, const TVector< T > &B, const TVector< T > &C)
 
static FORCEINLINE TVector< TMax3 (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)
 
static T Triple (const TVector< T > &X, const TVector< T > &Y, const TVector< T > &Z)
 
static T EvaluateBezier (const TVector< T > *ControlPoints, int32 NumPoints, TArray< TVector< T > > &OutPoints)
 
static TVector< TRadiansToDegrees (const TVector< T > &RadVector)
 
static TVector< TDegreesToRadians (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 const TVector< TZeroVector
 
static const TVector< TOneVector
 
static const TVector< TUpVector
 
static const TVector< TDownVector
 
static const TVector< TForwardVector
 
static const TVector< TBackwardVector
 
static const TVector< TRightVector
 
static const TVector< TLeftVector
 
static const TVector< TXAxisVector
 
static const TVector< TYAxisVector
 
static const TVector< TZAxisVector
 

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.

Definition at line 50 of file Vector.h.

Member Typedef Documentation

◆ FReal

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

Definition at line 55 of file Vector.h.

Constructor & Destructor Documentation

◆ TVector() [1/13]

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

Default constructor (no initialization).

Definition at line 1389 of file Vector.h.

◆ TVector() [2/13]

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

Constructor initializing all components to a single T value.

Parameters
InFValue to set all components to.

Definition at line 1393 of file Vector.h.

◆ TVector() [3/13]

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

Definition at line 1400 of file Vector.h.

◆ TVector() [4/13]

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

Constructor using initial values for each component.

Parameters
InXX Coordinate.
InYY Coordinate.
InZZ Coordinate.

Definition at line 1406 of file Vector.h.

◆ TVector() [5/13]

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

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

Parameters
VVector to copy from.
InZZ Coordinate.

Definition at line 1241 of file Vector.h.

◆ TVector() [6/13]

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

Constructor using the XYZ components from a 4D vector.

Parameters
V4D Vector to copy from.

Definition at line 1032 of file Vector4.h.

◆ TVector() [7/13]

template<typename T >
FORCEINLINE UE::Math::TVector< T >::TVector ( const FLinearColor & InColor)
explicit

Constructs a vector from an FLinearColor.

Parameters
InColorColor to copy from.

Definition at line 1413 of file Vector.h.

◆ TVector() [8/13]

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

Constructs a vector from an FIntVector.

Parameters
InVectorFIntVector to copy from.

◆ TVector() [9/13]

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

Constructs a vector from an FIntPoint.

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

◆ TVector() [10/13]

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

Constructor which initializes all components to zero.

Parameters
EForceInitForce init enum

Definition at line 1436 of file Vector.h.

◆ TVector() [11/13]

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

Definition at line 1184 of file Vector.h.

◆ TVector() [12/13]

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

Definition at line 1421 of file Vector.h.

◆ TVector() [13/13]

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

Definition at line 1429 of file Vector.h.

Member Function Documentation

◆ AddBounded()

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

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

Parameters
VVector to add.
RadiusHalf size of the cube.

Definition at line 1871 of file Vector.h.

◆ AllComponentsEqual()

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

Definition at line 1526 of file Vector.h.

◆ BoundToBox()

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

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

Definition at line 1797 of file Vector.h.

◆ BoundToCube()

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

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.

Definition at line 1786 of file Vector.h.

◆ BoxPushOut()

template<typename T >
FORCEINLINE 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.

Definition at line 2405 of file Vector.h.

◆ Coincident()

template<typename T >
bool UE::Math::TVector< T >::Coincident ( const TVector< T > & Normal1,
const TVector< T > & Normal2,
T 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.

Definition at line 1346 of file Vector.h.

◆ Component() [1/2]

template<typename T >
FORCEINLINE T & UE::Math::TVector< T >::Component ( int32 Index)

Gets a specific component of the vector.

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

Definition at line 1877 of file Vector.h.

◆ Component() [2/2]

template<typename T >
FORCEINLINE T UE::Math::TVector< T >::Component ( int32 Index) const

Gets a specific component of the vector.

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

Definition at line 1885 of file Vector.h.

◆ ComponentMax()

template<typename T >
FORCEINLINE TVector< T > UE::Math::TVector< T >::ComponentMax ( const TVector< T > & Other) const

Gets the component-wise max of two vectors.

Definition at line 1629 of file Vector.h.

◆ ComponentMin()

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

Gets the component-wise min of two vectors.

Definition at line 1623 of file Vector.h.

◆ ContainsNaN()

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

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.

Definition at line 2209 of file Vector.h.

◆ 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,
T 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.

Definition at line 1360 of file Vector.h.

◆ CosineAngle2D()

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

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.

Definition at line 2017 of file Vector.h.

◆ 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.

Definition at line 2160 of file Vector.h.

◆ Cross()

template<typename T >
FORCEINLINE 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.

Definition at line 1454 of file Vector.h.

◆ CrossProduct()

template<typename T >
FORCEINLINE 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.

Definition at line 1460 of file Vector.h.

◆ 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

Definition at line 1383 of file Vector.h.

◆ DiagnosticCheckNaN() [1/2]

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

Definition at line 144 of file Vector.h.

◆ DiagnosticCheckNaN() [2/2]

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

Definition at line 145 of file Vector.h.

◆ Dist()

template<typename T >
FORCEINLINE 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.

Definition at line 2381 of file Vector.h.

◆ Dist2D()

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

Definition at line 1018 of file Vector.h.

◆ Distance()

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

Definition at line 1008 of file Vector.h.

◆ DistSquared()

template<typename T >
FORCEINLINE 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.

Definition at line 2393 of file Vector.h.

◆ DistSquared2D()

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

Definition at line 1037 of file Vector.h.

◆ DistSquaredXY()

template<typename T >
FORCEINLINE 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

Definition at line 2399 of file Vector.h.

◆ DistXY()

template<typename T >
FORCEINLINE 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.

Definition at line 2387 of file Vector.h.

◆ Dot()

template<typename T >
FORCEINLINE 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.

Definition at line 1472 of file Vector.h.

◆ DotProduct()

template<typename T >
FORCEINLINE 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.

Definition at line 1478 of file Vector.h.

◆ Equals()

template<typename T >
FORCEINLINE bool UE::Math::TVector< T >::Equals ( const TVector< T > & V,
T 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.

Definition at line 1520 of file Vector.h.

◆ 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.

Definition at line 2108 of file Vector.h.

◆ 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.

Definition at line 2193 of file Vector.h.

◆ 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.

Definition at line 2041 of file Vector.h.

◆ GetAbs()

template<typename T >
FORCEINLINE 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.

Definition at line 1635 of file Vector.h.

◆ GetAbsMax()

template<typename T >
FORCEINLINE 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.

Definition at line 1605 of file Vector.h.

◆ GetAbsMin()

template<typename T >
FORCEINLINE 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.

Definition at line 1617 of file Vector.h.

◆ GetClampedToMaxSize()

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

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

Definition at line 1831 of file Vector.h.

◆ GetClampedToMaxSize2D()

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

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

Definition at line 1851 of file Vector.h.

◆ GetClampedToSize()

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

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

Definition at line 1809 of file Vector.h.

◆ GetClampedToSize2D()

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

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

Definition at line 1820 of file Vector.h.

◆ GetComponentForAxis()

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

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

Definition at line 1893 of file Vector.h.

◆ GetMax()

template<typename T >
FORCEINLINE 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.

Definition at line 1599 of file Vector.h.

◆ GetMin()

template<typename T >
FORCEINLINE 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.

Definition at line 1611 of file Vector.h.

◆ GetSafeNormal()

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

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.
Returns
A normalized copy if safe, ResultIfZero otherwise.

Definition at line 1973 of file Vector.h.

◆ GetSafeNormal2D()

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

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.
Returns
Normalized copy if safe, otherwise returns ResultIfZero.

Definition at line 1991 of file Vector.h.

◆ GetSignVector()

template<typename T >
FORCEINLINE TVector< T > UE::Math::TVector< T >::GetSignVector ( ) const

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

Definition at line 1748 of file Vector.h.

◆ GetUnsafeNormal()

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

Calculates normalized version of vector without checking for zero length.

Returns
Normalized version of vector.
See also
GetSafeNormal()

Definition at line 1766 of file Vector.h.

◆ GetUnsafeNormal2D()

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

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

Returns
Normalized version of vector.
See also
GetSafeNormal2D()

Definition at line 1773 of file Vector.h.

◆ GridSnap()

template<typename T >
FORCEINLINE 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()

Definition at line 1780 of file Vector.h.

◆ HeadingAngle()

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

Convert a direction vector into a 'heading' angle.

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

Definition at line 2361 of file Vector.h.

◆ InitFromCompactString()

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

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.

Definition at line 2324 of file Vector.h.

◆ InitFromString()

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

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.

Definition at line 2341 of file Vector.h.

◆ IsNearlyZero()

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

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.

Definition at line 1677 of file Vector.h.

◆ IsNormalized()

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

Checks whether vector is normalized.

Returns
true if normalized, false otherwise.

Definition at line 1711 of file Vector.h.

◆ IsUniform()

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

Definition at line 1961 of file Vector.h.

◆ IsUnit()

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

Definition at line 1705 of file Vector.h.

◆ IsZero()

template<typename T >
FORCEINLINE 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.

Definition at line 1686 of file Vector.h.

◆ Length()

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

Get the length (magnitude) of this vector.

Returns
The length of this vector.

Definition at line 1647 of file Vector.h.

◆ Max()

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

Definition at line 2421 of file Vector.h.

◆ Max3()

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

Definition at line 2441 of file Vector.h.

◆ Min()

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

Min, Max, Min3, Max3 like FMath

Definition at line 2411 of file Vector.h.

◆ Min3()

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

Definition at line 2431 of file Vector.h.

◆ 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.

Definition at line 599 of file Plane.h.

◆ MirrorByVector()

template<typename T >
FORCEINLINE 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.

Definition at line 1967 of file Vector.h.

◆ 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

Definition at line 1161 of file Vector.h.

◆ Normalize()

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

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.

Definition at line 1692 of file Vector.h.

◆ One()

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

Definition at line 112 of file Vector.h.

◆ operator!=()

template<typename T >
FORCEINLINE 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.

Definition at line 1514 of file Vector.h.

◆ operator*() [1/2]

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

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

Definition at line 1496 of file Vector.h.

◆ operator*() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 311 of file Vector.h.

◆ operator*=() [1/2]

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

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

Definition at line 1556 of file Vector.h.

◆ operator*=() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 412 of file Vector.h.

◆ operator+() [1/2]

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.

Definition at line 1484 of file Vector.h.

◆ operator+() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 299 of file Vector.h.

◆ operator+=()

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

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

Definition at line 1540 of file Vector.h.

◆ operator-() [1/3]

Get a negated copy of the vector.

Returns
A negated copy of the vector.

Definition at line 1533 of file Vector.h.

◆ operator-() [2/3]

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.

Definition at line 1490 of file Vector.h.

◆ operator-() [3/3]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE 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.

Definition at line 287 of file Vector.h.

◆ operator-=()

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

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

Definition at line 1548 of file Vector.h.

◆ operator/() [1/2]

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

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

Definition at line 1502 of file Vector.h.

◆ operator/() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
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.

Definition at line 323 of file Vector.h.

◆ operator/=() [1/2]

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

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

Definition at line 1564 of file Vector.h.

◆ operator/=() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
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.

Definition at line 426 of file Vector.h.

◆ operator==()

Check against another vector for equality.

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

Definition at line 1508 of file Vector.h.

◆ operator[]() [1/2]

Gets specific component of the vector.

Parameters
Indexthe index of vector component
Returns
reference to component.

Definition at line 1572 of file Vector.h.

◆ operator[]() [2/2]

template<typename T >
FORCEINLINE 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.

Definition at line 1581 of file Vector.h.

◆ operator^()

Calculate cross product between this and another vector.

Parameters
VThe other vector.
Returns
The cross product.

Definition at line 1443 of file Vector.h.

◆ operator|()

Calculate the dot product between this and another vector.

Parameters
VThe other vector.
Returns
The dot product.

Definition at line 1466 of file Vector.h.

◆ Orthogonal()

template<typename T >
bool UE::Math::TVector< T >::Orthogonal ( const TVector< T > & Normal1,
const TVector< T > & Normal2,
T 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.

Definition at line 1353 of file Vector.h.

◆ Parallel()

template<typename T >
bool UE::Math::TVector< T >::Parallel ( const TVector< T > & Normal1,
const TVector< T > & Normal2,
T 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.

Definition at line 1339 of file Vector.h.

◆ 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.

Definition at line 1313 of file Vector.h.

◆ 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

Definition at line 605 of file Plane.h.

◆ 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

Definition at line 613 of file Plane.h.

◆ 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

Definition at line 1325 of file Vector.h.

◆ PointsAreNear()

template<typename T >
bool UE::Math::TVector< T >::PointsAreNear ( const TVector< T > & Point1,
const TVector< T > & Point2,
T 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).

Definition at line 1303 of file Vector.h.

◆ 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).

Definition at line 1283 of file Vector.h.

◆ Projection()

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

Projects 2D components of vector based on Z.

Returns
Projected version of vector based on Z.

Definition at line 1759 of file Vector.h.

◆ ProjectOnTo()

template<typename T >
FORCEINLINE 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.

Definition at line 2028 of file Vector.h.

◆ ProjectOnToNormal()

template<typename T >
FORCEINLINE 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.

Definition at line 2034 of file Vector.h.

◆ 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

Definition at line 1377 of file Vector.h.

◆ Reciprocal()

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

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

Returns
Reciprocal of this vector.

Definition at line 1926 of file Vector.h.

◆ 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.

Definition at line 1250 of file Vector.h.

◆ 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.

Definition at line 1256 of file Vector.h.

◆ Rotation()

template<typename T >
FORCEINLINE 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()

Definition at line 824 of file Vector.h.

◆ Serialize()

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

Definition at line 1147 of file Vector.h.

◆ SerializeFromMismatchedTag()

bool FVector3f::SerializeFromMismatchedTag ( FName StructTag,
FStructuredArchive::FSlot Slot )
inline

Definition at line 2640 of file Vector.h.

◆ Set()

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

Set the values of the vector directly.

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

Definition at line 1590 of file Vector.h.

◆ SetComponentForAxis()

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

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

Definition at line 1909 of file Vector.h.

◆ Size()

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

Get the length (magnitude) of this vector.

Returns
The length of this vector.

Definition at line 1641 of file Vector.h.

◆ Size2D()

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

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

Returns
The 2D length of this vector.

Definition at line 1665 of file Vector.h.

◆ SizeSquared()

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

Get the squared length of this vector.

Returns
The squared length of this vector.

Definition at line 1653 of file Vector.h.

◆ SizeSquared2D()

template<typename T >
FORCEINLINE 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.

Definition at line 1671 of file Vector.h.

◆ SlerpNormals()

template<typename T >
static TVector< T > UE::Math::TVector< T >::SlerpNormals ( TVector< T > & NormalA,
TVector< T > & NormalB,
T 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 >
static TVector< T > UE::Math::TVector< T >::SlerpVectorToDirection ( TVector< T > & V,
TVector< T > & Direction,
T 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 >
FORCEINLINE T UE::Math::TVector< T >::SquaredLength ( ) const

Get the squared length of this vector.

Returns
The squared length of this vector.

Definition at line 1659 of file Vector.h.

◆ ToCompactString()

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

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

Definition at line 2287 of file Vector.h.

◆ ToCompactText()

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

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

Definition at line 2234 of file Vector.h.

◆ ToDirectionAndLength() [1/2]

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

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.

Definition at line 1717 of file Vector.h.

◆ ToDirectionAndLength() [2/2]

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

Definition at line 1732 of file Vector.h.

◆ ToOrientationQuat()

template<typename T >
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 >
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 >
FORCEINLINE FString UE::Math::TVector< T >::ToString ( ) const

Get a textual representation of this vector.

Returns
A string describing the vector.

Definition at line 2217 of file Vector.h.

◆ ToText()

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

Get a locale aware textual representation of this vector.

Returns
A string describing the vector.

Definition at line 2223 of file Vector.h.

◆ 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).

Definition at line 1368 of file Vector.h.

◆ UnitCartesianToSpherical()

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

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].

Definition at line 2352 of file Vector.h.

◆ UnitX()

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

Definition at line 115 of file Vector.h.

◆ UnitY()

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

Definition at line 118 of file Vector.h.

◆ UnitZ()

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

Definition at line 121 of file Vector.h.

◆ UnwindEuler()

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

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

Definition at line 2185 of file Vector.h.

◆ 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.

Definition at line 1333 of file Vector.h.

◆ Zero()

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

Definition at line 109 of file Vector.h.

Member Data Documentation

◆ [union]

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

◆ BackwardVector

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

Unreal backward vector (-1,0,0)

Definition at line 91 of file Vector.h.

◆ DownVector

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

Unreal down vector (0,0,-1)

Definition at line 85 of file Vector.h.

◆ ForwardVector

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

Unreal forward vector (1,0,0)

Definition at line 88 of file Vector.h.

◆ LeftVector

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

Unreal left vector (0,-1,0)

Definition at line 97 of file Vector.h.

◆ OneVector

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

One vector (1,1,1)

Definition at line 79 of file Vector.h.

◆ RightVector

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

Unreal right vector (0,1,0)

Definition at line 94 of file Vector.h.

◆ UpVector

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

Unreal up vector (0,0,1)

Definition at line 82 of file Vector.h.

◆ X

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

Vector's X component.

Definition at line 62 of file Vector.h.

◆ XAxisVector

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

Unit X axis vector (1,0,0)

Definition at line 100 of file Vector.h.

◆ XYZ

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

Definition at line 72 of file Vector.h.

◆ Y

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

Vector's Y component.

Definition at line 65 of file Vector.h.

◆ YAxisVector

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

Unit Y axis vector (0,1,0)

Definition at line 103 of file Vector.h.

◆ Z

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

Vector's Z component.

Definition at line 68 of file Vector.h.

◆ ZAxisVector

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

Unit Z axis vector (0,0,1)

Definition at line 106 of file Vector.h.

◆ ZeroVector

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

A zero vector (0,0,0)

Definition at line 76 of file Vector.h.


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