Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
UE::Math::TVector4< T > Struct Template Reference

#include <Vector4.h>

Public Types

using FReal = T
 

Public Member Functions

 TVector4 (const UE::Math::TVector< T > &InVector)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4 (const UE::Math::TVector< T > &InVector, FArg InW)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4 (const UE::Math::TVector4< T > &InVector, FArg OverrideW)
 
FORCEINLINE TVector4 (const FLinearColor &InColor)
 
FORCEINLINE TVector4 (const FLinearColor &InColor, T InOverrideW)
 
 TVector4 (T InX=0.0f, T InY=0.0f, T InZ=0.0f, T InW=1.0f)
 
 TVector4 (TVector2< T > InXY, TVector2< T > InZW)
 
 TVector4 (const FIntVector4 &InVector)
 
 TVector4 (EForceInit)
 
 TVector4 (ENoInit)
 
FORCEINLINE Toperator[] (int32 ComponentIndex)
 
FORCEINLINE T operator[] (int32 ComponentIndex) const
 
FORCEINLINE TVector4< Toperator- () const
 
FORCEINLINE TVector4< Toperator+ (const TVector4< T > &V) const
 
FORCEINLINE TVector4< Toperator+= (const TVector4< T > &V)
 
FORCEINLINE TVector4< Toperator- (const TVector4< T > &V) const
 
FORCEINLINE TVector4< Toperator-= (const TVector4< T > &V)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< Toperator* (FArg Scale) const
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< Toperator/ (FArg Scale) const
 
TVector4< Toperator/ (const TVector4< T > &V) const
 
TVector4< Toperator* (const TVector4< T > &V) const
 
TVector4< Toperator*= (const TVector4< T > &V)
 
TVector4< Toperator/= (const TVector4< T > &V)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< Toperator*= (FArg Scale)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< Toperator/= (FArg Scale)
 
bool operator== (const TVector4< T > &V) const
 
bool operator!= (const TVector4< T > &V) const
 
TVector4< Toperator^ (const TVector4< T > &V) const
 
TComponent (int32 Index)
 
const TComponent (int32 Index) const
 
bool Equals (const TVector4< T > &V, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
bool IsUnit3 (T LengthSquaredTolerance=UE_KINDA_SMALL_NUMBER) const
 
FString ToString () const
 
bool InitFromString (const FString &InSourceString)
 
FORCEINLINE TVector4 GetSafeNormal (T Tolerance=UE_SMALL_NUMBER) const
 
FORCEINLINE TVector4 GetUnsafeNormal3 () const
 
TRotator< TToOrientationRotator () const
 
TQuat< TToOrientationQuat () const
 
FORCEINLINE TRotator< TRotation () const
 
FORCEINLINE void Set (T InX, T InY, T InZ, T InW)
 
T Size3 () const
 
T SizeSquared3 () const
 
T Size () const
 
T SizeSquared () const
 
bool ContainsNaN () const
 
bool IsNearlyZero3 (T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
TVector4< TReflect3 (const TVector4< T > &Normal) const
 
void FindBestAxisVectors3 (TVector4< T > &Axis1, TVector4< T > &Axis2) const
 
FORCEINLINE void DiagnosticCheckNaN ()
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_same_v< FArg, double > &&std::is_same_v< T, float >) >
 TVector4 (const TVector4< FArg > &From)
 
template<typename FArg , TEMPLATE_REQUIRES(std::is_same_v< FArg, float > &&std::is_same_v< T, double >) >
 TVector4 (const TVector4< FArg > &From)
 

Static Public Member Functions

static TVector4< TZero ()
 
static TVector4< TOne ()
 

Public Attributes

union { 
 
   struct { 
 
      T   X 
 
      T   Y 
 
      T   Z 
 
      T   W 
 
   }  
 
   T   XYZW [4] 
 
};  
 

Private Member Functions

bool SerializeFromVector3 (FName StructTag, FArchive &Ar)
 

Friends

FORCEINLINE friend uint32 GetTypeHash (const UE::Math::TVector4< T > &Vector)
 

Detailed Description

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

A 4D homogeneous vector, 4x1 FLOATs, 16-byte aligned.

Definition at line 25 of file Vector4.h.

Member Typedef Documentation

◆ FReal

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

Definition at line 32 of file Vector4.h.

Constructor & Destructor Documentation

◆ TVector4() [1/12]

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

Constructor from 3D TVector. W is set to 1.

Parameters
InVector3D Vector to set first three components.

Definition at line 572 of file Vector4.h.

◆ TVector4() [2/12]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( const UE::Math::TVector< T > & InVector,
FArg InW )
inline

Constructor.

Parameters
InVector3D Vector to set first three components.
InWW Coordinate.

Definition at line 71 of file Vector4.h.

◆ TVector4() [3/12]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( const UE::Math::TVector4< T > & InVector,
FArg OverrideW )
inline

Constructor allowing copying of an TVector4 whilst setting up a new W component.

Parameters
InVector4D Vector to set first three components.
InOverrideWReplaces W Coordinate of InVector.

Definition at line 87 of file Vector4.h.

◆ TVector4() [4/12]

template<typename T >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( const FLinearColor & InColor)
inline

Creates and initializes a new vector from a color value.

Parameters
InColourColor used to set vector.

Definition at line 101 of file Vector4.h.

◆ TVector4() [5/12]

template<typename T >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( const FLinearColor & InColor,
T InOverrideW )
inline

Creates and initializes a new vector from a color RGB and W

Parameters
InColourColor used to set XYZ.
InOverrideW

Definition at line 116 of file Vector4.h.

◆ TVector4() [6/12]

template<typename T >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( T InX = 0.0f,
T InY = 0.0f,
T InZ = 0.0f,
T InW = 1.0f )
explicit

Creates and initializes a new vector from the specified components.

Parameters
InXX Coordinate.
InYY Coordinate.
InZZ Coordinate.
InWW Coordinate.

Definition at line 582 of file Vector4.h.

◆ TVector4() [7/12]

template<typename T >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( TVector2< T > InXY,
TVector2< T > InZW )
explicit

Creates and initializes a new vector from the specified 2D vectors.

Parameters
InXYA 2D vector holding the X- and Y-components.
InZWA 2D vector holding the Z- and W-components.

Definition at line 610 of file Vector4.h.

◆ TVector4() [8/12]

template<typename T >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( const FIntVector4 & InVector)

Creates and initializes a new vector from an int vector value.

Parameters
InVectorIntVector used to set vector.

Definition at line 620 of file Vector4.h.

◆ TVector4() [9/12]

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

Creates and initializes a new vector to zero.

Parameters
EForceInitForce Init Enum.

Definition at line 593 of file Vector4.h.

◆ TVector4() [10/12]

template<typename T >
FORCEINLINE UE::Math::TVector4< T >::TVector4 ( ENoInit )

Creates an uninitialized new vector.

Parameters
ENoInitForce uninitialized enum.

Definition at line 604 of file Vector4.h.

◆ TVector4() [11/12]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_same_v< FArg, double > &&std::is_same_v< T, float >) >
UE::Math::TVector4< T >::TVector4 ( const TVector4< FArg > & From)
inlineexplicit

Definition at line 519 of file Vector4.h.

◆ TVector4() [12/12]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_same_v< FArg, float > &&std::is_same_v< T, double >) >
UE::Math::TVector4< T >::TVector4 ( const TVector4< FArg > & From)
inlineexplicit

Definition at line 523 of file Vector4.h.

Member Function Documentation

◆ Component() [1/2]

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

Gets a specific component of the vector.

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

Definition at line 717 of file Vector4.h.

◆ Component() [2/2]

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

Gets a specific component of the vector.

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

Definition at line 725 of file Vector4.h.

◆ ContainsNaN()

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

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

Definition at line 831 of file Vector4.h.

◆ DiagnosticCheckNaN()

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

Definition at line 502 of file Vector4.h.

◆ Equals()

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

Error tolerant comparison.

Parameters
VVector to compare against.
ToleranceError Tolerance.
Returns
true if the two vectors are equal within specified tolerance, otherwise false.

Definition at line 747 of file Vector4.h.

◆ FindBestAxisVectors3()

template<typename T >
FORCEINLINE void UE::Math::TVector4< T >::FindBestAxisVectors3 ( TVector4< T > & Axis1,
TVector4< T > & Axis2 ) const

Find good arbitrary axis vectors to represent U and V axes of a plane, given just the normal.

Definition at line 1013 of file Vector4.h.

◆ GetSafeNormal()

template<typename T >
FORCEINLINE TVector4< T > UE::Math::TVector4< T >::GetSafeNormal ( T Tolerance = UE_SMALL_NUMBER) const

Returns a normalized copy of the vector if safe to normalize.

Parameters
ToleranceMinimum squared length of vector for normalization.
Returns
A normalized copy of the vector or a zero vector.

Definition at line 777 of file Vector4.h.

◆ GetUnsafeNormal3()

template<typename T >
FORCEINLINE TVector4< T > UE::Math::TVector4< T >::GetUnsafeNormal3 ( ) const

Calculates normalized version of vector without checking if it is non-zero.

Returns
Normalized version of vector.

Definition at line 790 of file Vector4.h.

◆ InitFromString()

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

Initialize this Vector based on an FString. The String is expected to contain X=, Y=, Z=, W=. The TVector4 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 761 of file Vector4.h.

◆ IsNearlyZero3()

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

Utility to check if all of the components of this vector are nearly zero given the tolerance.

Definition at line 841 of file Vector4.h.

◆ IsUnit3()

template<typename T >
FORCEINLINE bool UE::Math::TVector4< T >::IsUnit3 ( 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 824 of file Vector4.h.

◆ One()

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

Definition at line 173 of file Vector4.h.

◆ operator!=()

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

Checks for inequality against another vector.

Parameters
VThe other vector.
Returns
true if the two vectors are different, otherwise false.

Definition at line 740 of file Vector4.h.

◆ operator*() [1/2]

Gets the result of multiplying a vector with this.

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

Definition at line 698 of file Vector4.h.

◆ operator*() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< T > UE::Math::TVector4< T >::operator* ( FArg Scale) const
inline

Gets the result of scaling this vector.

Parameters
ScaleThe scaling factor.
Returns
The result of vector scaling.

Definition at line 242 of file Vector4.h.

◆ operator*=() [1/2]

Gets the result of multiplying a vector with another Vector (component wise).

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

Definition at line 850 of file Vector4.h.

◆ operator*=() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< T > UE::Math::TVector4< T >::operator*= ( FArg Scale)
inline

Gets the result of scaling this vector.

Parameters
ScaleThe scaling factor.
Returns
The result of vector scaling.

Definition at line 299 of file Vector4.h.

◆ operator+()

Gets the result of adding a vector to this.

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

Definition at line 666 of file Vector4.h.

◆ operator+=()

Adds another vector to this one.

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

Definition at line 673 of file Vector4.h.

◆ operator-() [1/2]

Gets a negated copy of the vector.

Returns
A negated copy of the vector.

Definition at line 659 of file Vector4.h.

◆ operator-() [2/2]

Gets the result of subtracting a vector from this.

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

Definition at line 682 of file Vector4.h.

◆ operator-=()

Subtracts another vector to this one.

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

Definition at line 689 of file Vector4.h.

◆ operator/() [1/2]

Gets the result of dividing this vector.

Parameters
VWhat to divide by.
Returns
The result of division.

Definition at line 868 of file Vector4.h.

◆ operator/() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< T > UE::Math::TVector4< T >::operator/ ( FArg Scale) const
inline

Gets the result of dividing this vector.

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

Definition at line 254 of file Vector4.h.

◆ operator/=() [1/2]

Gets the result of dividing a vector with another Vector (component wise).

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

Definition at line 859 of file Vector4.h.

◆ operator/=() [2/2]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(std::is_arithmetic< FArg >::value) >
FORCEINLINE TVector4< T > UE::Math::TVector4< T >::operator/= ( FArg Scale)
inline

Gets the result of scaling this vector by 1/Scale.

Parameters
ScaleThe inverse scaling factor.
Returns
The result of vector scaling by 1/Scale.

Definition at line 313 of file Vector4.h.

◆ operator==()

Checks for equality against another vector.

Parameters
VThe other vector.
Returns
true if the two vectors are the same, otherwise false.

Definition at line 733 of file Vector4.h.

◆ operator[]() [1/2]

template<typename T >
FORCEINLINE T & UE::Math::TVector4< T >::operator[] ( int32 ComponentIndex)

Access a specific component of the vector.

Parameters
ComponentIndexThe index of the component.
Returns
Reference to the desired component.

Definition at line 629 of file Vector4.h.

◆ operator[]() [2/2]

template<typename T >
FORCEINLINE T UE::Math::TVector4< T >::operator[] ( int32 ComponentIndex) const

Access a specific component of the vector.

Parameters
ComponentIndexThe index of the component.
Returns
Copy of the desired component.

Definition at line 638 of file Vector4.h.

◆ operator^()

Calculate Cross product between this and another vector.

Parameters
VThe other vector.
Returns
The Cross product.

Definition at line 705 of file Vector4.h.

◆ Reflect3()

template<typename T >
FORCEINLINE TVector4< T > UE::Math::TVector4< T >::Reflect3 ( const TVector4< T > & Normal) const

Reflect vector.

Definition at line 1006 of file Vector4.h.

◆ Rotation()

template<typename T >
FORCEINLINE TRotator< T > UE::Math::TVector4< T >::Rotation ( ) const
inline

Return the FRotator 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. Identical to 'ToOrientationRotator()'.

Returns
FRotator from the Vector's direction.
See also
ToOrientationRotator()

Definition at line 433 of file Vector4.h.

◆ Serialize()

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

Definition at line 509 of file Vector4.h.

◆ SerializeFromMismatchedTag()

bool FVector4f::SerializeFromMismatchedTag ( FName StructTag,
FArchive & Ar )
inline

Definition at line 917 of file Vector4.h.

◆ SerializeFromVector3()

template<typename T >
bool UE::Math::TVector4< T >::SerializeFromVector3 ( FName StructTag,
FArchive & Ar )
private

Definition at line 875 of file Vector4.h.

◆ Set()

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

Set all of the vectors coordinates.

Parameters
InXNew X Coordinate.
InYNew Y Coordinate.
InZNew Z Coordinate.
InWNew W Coordinate.

Definition at line 647 of file Vector4.h.

◆ Size()

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

Get the length (magnitude) of this vector, taking the W component into account

Returns
The length of this vector

Definition at line 811 of file Vector4.h.

◆ Size3()

template<typename T >
FORCEINLINE T UE::Math::TVector4< T >::Size3 ( ) const

Get the length of this vector not taking W component into account.

Returns
The length of this vector.

Definition at line 798 of file Vector4.h.

◆ SizeSquared()

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

Get the squared length of this vector, taking the W component into account

Returns
The squared length of this vector

Definition at line 817 of file Vector4.h.

◆ SizeSquared3()

template<typename T >
FORCEINLINE T UE::Math::TVector4< T >::SizeSquared3 ( ) const

Get the squared length of this vector not taking W component into account.

Returns
The squared length of this vector.

Definition at line 805 of file Vector4.h.

◆ ToOrientationQuat()

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

Return the Quaternion orientation corresponding to the direction in which the vector points.

Returns
Quaternion from the Vector's direction.

◆ ToOrientationRotator()

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

Return the FRotator 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
FRotator from the Vector's direction.

◆ ToString()

template<typename T >
FORCEINLINE FString UE::Math::TVector4< T >::ToString ( ) const

Get a textual representation of the vector.

Returns
Text describing the vector.

Definition at line 754 of file Vector4.h.

◆ Zero()

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

Definition at line 167 of file Vector4.h.

Friends And Related Symbol Documentation

◆ GetTypeHash

template<typename T >
FORCEINLINE friend uint32 GetTypeHash ( const UE::Math::TVector4< T > & Vector)
friend

Creates a hash value from a TVector4.

Parameters
Vectorthe vector to create a hash value for
Returns
The hash value from the components

Definition at line 532 of file Vector4.h.

Member Data Documentation

◆ [union]

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

◆ W

template<typename T >
T UE::Math::TVector4< T >::W

The vector's W-component.

Definition at line 48 of file Vector4.h.

◆ X

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

The vector's X-component.

Definition at line 39 of file Vector4.h.

◆ XYZW

template<typename T >
T UE::Math::TVector4< T >::XYZW[4]

Definition at line 52 of file Vector4.h.

◆ Y

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

The vector's Y-component.

Definition at line 42 of file Vector4.h.

◆ Z

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

The vector's Z-component.

Definition at line 45 of file Vector4.h.


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