TVector4

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

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/CoreFwd.h

Include

#include "CoreFwd.h"

Syntax

template<typename T>
struct TVector4

Remarks

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

Variables

Name Description

Public variable

T

 

W

The vector's W-component.

Public variable

T

 

X

The vector's X-component.

Public variable

T

 

Y

The vector's Y-component.

Public variable

T

 

Z

The vector's Z-component.

Constructors

Name Description

Public function

TVector4

(
    const UE::Math::TVector< float >& ...
)

Constructor.

TVector4 inline functions

Public function

TVector4

(
    const UE::Math::TVector4< float >&...,
    FArg OverrideW
)

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

Public function

TVector4

(
    const UE::Math::TVector4< double > ...,
    FArg OverrideW
)

LWC_TODO: precision loss when this is 4f type.

Public function

TVector4

(
    TVector2< T > InXY,
    TVector2< T > InZW
)

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

Public function

TVector4

(
    T InX,
    T InY,
    T InZ,
    T InW
)

Creates and initializes a new vector from the specified components.

Public function

TVector4

(
    const UE::Math::TVector< double >&...
)

Public function

TVector4

(
    const FLinearColor& InColor
)

Creates and initializes a new vector from a color value.

Public function

TVector4

(
    const FIntVector4& InVector
)

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

Public function

TVector4

(
    EForceInit
)

Creates and initializes a new vector to zero.

Public function

TVector4

(
    ENoInit
)

Creates an uninitialized new vector.

Public function

TVector4

(
    const TVector4< FArg >& From
)

Conversion from other type. TODO: explicit!

Public function

TVector4

(
    const UE::Math::TVector< float >& ...,
    FArg InW
)

Public function

TVector4

(
    const UE::Math::TVector< double >&...,
    FArg InW
)

LWC_TODO: precision loss when this is 4f type.

Functions

Name Description

Public function

T &

 

Component

(
    int32 Index
)

Gets a specific component of the vector.

Public function Const

const T &

 

Component

(
    int32 Index
)

Gets a specific component of the vector.

Public function Const

bool

 

ContainsNaN()

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

Public function

void

 

DiagnosticCheckNaN()

Public function Const

bool

 

Equals

(
    const TVector4< T >& V,
    T Tolerance
)

Error tolerant comparison.

Public function Const

void

 

FindBestAxisVectors3

(
    TVector4< T >& Axis1,
    TVector4< T >& Axis2
)

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

Public function Const

TVector4

 

GetSafeNormal

(
    T Tolerance
)

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

Public function Const

TVector4

 

GetUnsafeNormal3()

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

Public function

bool

 

InitFromString

(
    const FString& InSourceString
)

Initialize this Vector based on an FString.

Public function Const

bool

 

IsNearlyZero3

(
    T Tolerance
)

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

Public function Const

bool

 

IsUnit3

(
    T LengthSquaredTolerance
)

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

Public function Static

TVector4< T ...

 

One()

To satisfy UE::Geometry type.

Public function Const

TVector4< T ...

 

Reflect3

(
    const TVector4< T >& Normal
)

Reflect vector.

Public function Const

TRotator< T ...

 

Rotation()

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

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Public function

bool

 

SerializeFromMismatchedTag

(
    FName StructTag,
    FArchive& Ar
)

Public function

void

 

Set

(
    T InX,
    T InY,
    T InZ,
    T InW
)

Set all of the vectors coordinates.

Public function Const

T

 

Size()

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

Public function Const

T

 

Size3()

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

Public function Const

T

 

SizeSquared()

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

Public function Const

T

 

SizeSquared3()

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

Public function Const

TQuat< T >

 

ToOrientationQuat()

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

Public function Const

TRotator< T ...

 

ToOrientationRotator()

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

Public function Const

FString

 

ToString()

Get a textual representation of the vector.

Public function Static

TVector4< T ...

 

Zero()

To satisfy UE::Geometry type.

Operators

Name Description

Public function Const

TVector4< T ...

 

operator-

(
    const TVector4< T >& V
)

Gets the result of subtracting a vector from this.

Public function Const

TVector4< T ...

 

operator-()

Gets a negated copy of the vector.

Public function Const

bool

 

operator!=

(
    const TVector4< T >& V
)

Checks for inequality against another vector.

Public function Const

TVector4< T ...

 

operator*

(
    const TVector4< T >& V
)

Gets the result of multiplying a vector with this.

Public function Const

TVector4< T ...

 

operator*

(
    FArg Scale
)

Gets the result of scaling this vector.

Public function

TVector4< T ...

 

operator*=

(
    FArg Scale
)

Gets the result of scaling this vector.

Public function

TVector4< T ...

 

operator*=

(
    const TVector4< T >& V
)

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

Public function Const

TVector4< T ...

 

operator/

(
    const TVector4< T >& V
)

Gets the result of dividing this vector.

Public function Const

TVector4< T ...

 

operator/

(
    FArg Scale
)

Gets the result of dividing this vector.

Public function

TVector4< T ...

 

operator/=

(
    FArg Scale
)

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

Public function

TVector4< T ...

 

operator/=

(
    const TVector4< T >& V
)

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

Public function Const

T

 

operator[]

(
    int32 ComponentIndex
)

Access a specific component of the vector.

Public function

T &

 

operator[]

(
    int32 ComponentIndex
)

Access a specific component of the vector.

Public function Const

TVector4< T ...

 

operator^

(
    const TVector4< T >& V
)

Calculate Cross product between this and another vector.

Public function Const

TVector4< T ...

 

operator+

(
    const TVector4< T >& V
)

Gets the result of adding a vector to this.

Public function

TVector4< T ...

 

operator+=

(
    const TVector4< T >& V
)

Adds another vector to this one.

Public function

TVector4< T ...

 

operator-=

(
    const TVector4< T >& V
)

Subtracts another vector to this one.

Public function Const

bool

 

operator==

(
    const TVector4< T >& V
)

Checks for equality against another vector.

Typedefs

Name

Description

FReal

Can't have a TEMPLATE_REQUIRES in the declaration because of the forward declarations, so check for allowed types here.