FVector4

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

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/Vector4.h

Include

#include "Math/Vector4.h"

Syntax

struct FVector4

Remarks

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

Variables

Name Description

Public variable

float

 

W

The vector's W-component.

Public variable

float

 

X

The vector's X-component.

Public variable

float

 

Y

The vector's Y-component.

Public variable

float

 

Z

The vector's Z-component.

Constructors

Name Description

Public function

FVector4

(
    const FLinearColor& InColor
)

Creates and initializes a new vector from a color value.

Public function

FVector4

(
    const FIntVector4& InVector
)

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

Public function

FVector4

(
    EForceInit
)

Creates and initializes a new vector to zero.

Public function

FVector4

(
    const FVector& InVector,
    float InW
)

Constructor.

FVector4 inline functions

Public function

FVector4

(
    FVector2D InXY,
    FVector2D InZW
)

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

Public function

FVector4

(
    float InX,
    float InY,
    float InZ,
    float InW
)

Creates and initializes a new vector from the specified components.

Functions

Name Description

Public function

float &

 

Component

(
    int32 Index
)

Gets a specific component of the vector.

Public function Const

const float &

 

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 FVector4& V,
    float Tolerance
)

Error tolerant comparison.

Public function Const

void

 

FindBestAxisVectors3

(
    FVector4& Axis1,
    FVector4& Axis2
)

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

Public function Const

FVector4

 

GetSafeNormal

(
    float Tolerance
)

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

Public function Const

FVector4

 

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

(
    float Tolerance
)

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

Public function Const

bool

 

IsUnit3

(
    float LengthSquaredTolerance
)

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

Public function Const

FVector4

 

Reflect3

(
    const FVector4& Normal
)

Reflect vector.

Public function Const

FRotator

 

Rotation()

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

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Public function

void

 

Set

(
    float InX,
    float InY,
    float InZ,
    float InW
)

Set all of the vectors coordinates.

Public function Const

float

 

Size()

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

Public function Const

float

 

Size3()

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

Public function Const

float

 

SizeSquared()

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

Public function Const

float

 

SizeSquared3()

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

Public function Const

FQuat

 

ToOrientationQuat()

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

Public function Const

FRotator

 

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.

Operators

Name Description

Public function Const

FVector4

 

operator-

(
    const FVector4& V
)

Gets the result of subtracting a vector from this.

Public function Const

FVector4

 

operator-()

Gets a negated copy of the vector.

Public function Const

bool

 

operator!=

(
    const FVector4& V
)

Checks for inequality against another vector.

Public function Const

FVector4

 

operator*

(
    const FVector4& V
)

Gets the result of multiplying a vector with this.

Public function Const

FVector4

 

operator*

(
    float Scale
)

Gets the result of scaling this vector.

Public function

FVector4

 

operator*=

(
    float S
)

Gets the result of scaling this vector.

Public function

FVector4

 

operator*=

(
    const FVector4& V
)

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

Public function Const

FVector4

 

operator/

(
    float Scale
)

Gets the result of dividing this vector.

Public function Const

FVector4

 

operator/

(
    const FVector4& V
)

Gets the result of dividing this vector.

Public function

FVector4

 

operator/=

(
    const FVector4& V
)

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

Public function Const

float

 

operator[]

(
    int32 ComponentIndex
)

Access a specific component of the vector.

Public function

float &

 

operator[]

(
    int32 ComponentIndex
)

Access a specific component of the vector.

Public function Const

FVector4

 

operator^

(
    const FVector4& V
)

Calculate Cross product between this and another vector.

Public function Const

FVector4

 

operator+

(
    const FVector4& V
)

Gets the result of adding a vector to this.

Public function

FVector4

 

operator+=

(
    const FVector4& V
)

Adds another vector to this one.

Public function

FVector4

 

operator-=

(
    const FVector4& V
)

Subtracts another vector to this one.

Public function Const

bool

 

operator==

(
    const FVector4& V
)

Checks for equality against another vector.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback