Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
FVector Struct Reference

#include <Vector.h>

+ Inheritance diagram for FVector:
+ Collaboration diagram for FVector:

Public Member Functions

FORCEINLINE FVector ()
 
FORCEINLINE FVector (float InF)
 
FORCEINLINE CONSTEXPR FVector (float InX, float InY, float InZ)
 
FORCEINLINE FVector (const FVector2D V, float InZ)
 
 FVector (const FLinearColor &InColor)
 
 FVector (FIntVector InVector)
 
 FVector (FIntPoint A)
 
FORCEINLINE FVector (EForceInit)
 
FORCEINLINE FVector operator^ (const FVector &V) const
 
FORCEINLINE float operator| (const FVector &V) const
 
FORCEINLINE FVector operator+ (const FVector &V) const
 
FORCEINLINE FVector operator- (const FVector &V) const
 
FORCEINLINE FVector operator- (float Bias) const
 
FORCEINLINE FVector operator+ (float Bias) const
 
FORCEINLINE FVector operator* (float Scale) const
 
FVector operator/ (float Scale) const
 
FORCEINLINE FVector operator* (const FVector &V) const
 
FORCEINLINE FVector operator/ (const FVector &V) const
 
bool operator== (const FVector &V) const
 
bool operator!= (const FVector &V) const
 
bool Equals (const FVector &V, float Tolerance=KINDA_SMALL_NUMBER) const
 
bool AllComponentsEqual (float Tolerance=KINDA_SMALL_NUMBER) const
 
FORCEINLINE FVector operator- () const
 
FORCEINLINE FVector operator+= (const FVector &V)
 
FORCEINLINE FVector operator-= (const FVector &V)
 
FORCEINLINE FVector operator*= (float Scale)
 
FVector operator/= (float V)
 
FVector operator*= (const FVector &V)
 
FVector operator/= (const FVector &V)
 
float & operator[] (int32 Index)
 
float operator[] (int32 Index) const
 
float & Component (int32 Index)
 
float Component (int32 Index) const
 
void Set (float InX, float InY, float InZ)
 
float GetMax () const
 
float GetAbsMax () const
 
float GetMin () const
 
float GetAbsMin () const
 
FVector ComponentMin (const FVector &Other) const
 
FVector ComponentMax (const FVector &Other) const
 
FVector GetAbs () const
 
float Size () const
 
float SizeSquared () const
 
float Size2D () const
 
float SizeSquared2D () const
 
bool IsNearlyZero (float Tolerance=KINDA_SMALL_NUMBER) const
 
bool IsZero () const
 
bool Normalize (float Tolerance=SMALL_NUMBER)
 
bool IsNormalized () const
 
void ToDirectionAndLength (FVector &OutDir, float &OutLength) const
 
FORCEINLINE FVector GetSignVector () const
 
FVector Projection () const
 
FORCEINLINE FVector GetUnsafeNormal () const
 
FVector GridSnap (const float &GridSz) const
 
FVector BoundToCube (float Radius) const
 
FVector GetClampedToSize (float Min, float Max) const
 
FVector GetClampedToSize2D (float Min, float Max) const
 
FVector GetClampedToMaxSize (float MaxSize) const
 
FVector GetClampedToMaxSize2D (float MaxSize) const
 
FVector Reciprocal () const
 
bool IsUniform (float Tolerance=KINDA_SMALL_NUMBER) const
 
FVector MirrorByVector (const FVector &MirrorNormal) const
 
FVector RotateAngleAxis (const float AngleDeg, const FVector &Axis) const
 
FVector GetSafeNormal (float Tolerance=SMALL_NUMBER) const
 
FVector GetSafeNormal2D (float Tolerance=SMALL_NUMBER) const
 
FORCEINLINE float CosineAngle2D (FVector B) const
 
FORCEINLINE FVector ProjectOnTo (const FVector &A) const
 
FORCEINLINE FVector ProjectOnToNormal (const FVector &Normal) const
 
FRotator ToOrientationRotator () const
 
FQuat ToOrientationQuat () const
 
FRotator Rotation () const
 
void FindBestAxisVectors (FVector &Axis1, FVector &Axis2) const
 
void UnwindEuler ()
 
bool ContainsNaN () const
 
FORCEINLINE bool IsUnit (float LengthSquaredTolerance=KINDA_SMALL_NUMBER) const
 
FString ToString () const
 
bool InitFromString (const FString &InSourceString)
 
FVector2D UnitCartesianToSpherical () const
 
float HeadingAngle () const
 

Static Public Member Functions

static FORCEINLINE FVector CrossProduct (const FVector &A, const FVector &B)
 
static FORCEINLINE float DotProduct (const FVector &A, const FVector &B)
 
static void CreateOrthonormalBasis (FVector &XAxis, FVector &YAxis, FVector &ZAxis)
 
static bool PointsAreSame (const FVector &P, const FVector &Q)
 
static bool PointsAreNear (const FVector &Point1, const FVector &Point2, float Dist)
 
static float PointPlaneDist (const FVector &Point, const FVector &PlaneBase, const FVector &PlaneNormal)
 
static FVector PointPlaneProject (const FVector &Point, const FVector &A, const FVector &B, const FVector &C)
 
static FVector PointPlaneProject (const FVector &Point, const FVector &PlaneBase, const FVector &PlaneNormal)
 
static FVector VectorPlaneProject (const FVector &V, const FVector &PlaneNormal)
 
static FORCEINLINE float Dist (const FVector &V1, const FVector &V2)
 
static FORCEINLINE float Distance (const FVector &V1, const FVector &V2)
 
static FORCEINLINE float DistXY (const FVector &V1, const FVector &V2)
 
static FORCEINLINE float Dist2D (const FVector &V1, const FVector &V2)
 
static FORCEINLINE float DistSquared (const FVector &V1, const FVector &V2)
 
static FORCEINLINE float DistSquaredXY (const FVector &V1, const FVector &V2)
 
static FORCEINLINE float DistSquared2D (const FVector &V1, const FVector &V2)
 
static FORCEINLINE float BoxPushOut (const FVector &Normal, const FVector &Size)
 
static bool Parallel (const FVector &Normal1, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
 
static bool Coincident (const FVector &Normal1, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
 
static bool Orthogonal (const FVector &Normal1, const FVector &Normal2, float OrthogonalCosineThreshold=THRESH_NORMALS_ARE_ORTHOGONAL)
 
static bool Coplanar (const FVector &Base1, const FVector &Normal1, const FVector &Base2, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
 
static float Triple (const FVector &X, const FVector &Y, const FVector &Z)
 
static float EvaluateBezier (const FVector *ControlPoints, int32 NumPoints, TArray< FVector > &OutPoints)
 
static FVector RadiansToDegrees (const FVector &RadVector)
 
static FVector DegreesToRadians (const FVector &DegVector)
 

Public Attributes

float X
 
float Y
 
float Z
 

Static Public Attributes

static const FVector ZeroVector
 

Detailed Description

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

Definition at line 22 of file Vector.h.

Constructor & Destructor Documentation

◆ FVector() [1/8]

FORCEINLINE FVector::FVector ( )
inline

Default constructor

Definition at line 41 of file Vector.h.

◆ FVector() [2/8]

FORCEINLINE FVector::FVector ( float InF)
explicit

Constructor initializing all components to a single float value.

Parameters
InFValue to set all components to.

Definition at line 1062 of file Vector.h.

+ Here is the caller graph for this function:

◆ FVector() [3/8]

FORCEINLINE CONSTEXPR FVector::FVector ( float InX,
float InY,
float InZ )

Constructor using initial values for each component.

Parameters
InXX Coordinate.
InYY Coordinate.
InZZ Coordinate.

Definition at line 1067 of file Vector.h.

+ Here is the caller graph for this function:

◆ FVector() [4/8]

FORCEINLINE FVector::FVector ( const FVector2D V,
float InZ )
explicit

Constructs a vector from an FVector2D and Z value.

Parameters
VVector to copy from.
InZZ Coordinate.

Definition at line 931 of file Vector.h.

◆ FVector() [5/8]

FORCEINLINE FVector::FVector ( const FLinearColor & InColor)
explicit

Constructs a vector from an FLinearColor.

Parameters
InColorColor to copy from.

Definition at line 1072 of file Vector.h.

◆ FVector() [6/8]

FORCEINLINE FVector::FVector ( FIntVector InVector)
explicit

Constructs a vector from an FIntVector.

Parameters
InVectorFIntVector to copy from.

Definition at line 1077 of file Vector.h.

◆ FVector() [7/8]

FORCEINLINE FVector::FVector ( FIntPoint A)
explicit

Constructs a vector from an FIntPoint.

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

Definition at line 1082 of file Vector.h.

◆ FVector() [8/8]

FORCEINLINE FVector::FVector ( EForceInit )
explicit

Constructor which initializes all components to zero.

Parameters
EForceInitForce init enum

Definition at line 1087 of file Vector.h.

+ Here is the caller graph for this function:

Member Function Documentation

◆ AllComponentsEqual()

FORCEINLINE bool FVector::AllComponentsEqual ( float Tolerance = 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 1186 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BoundToCube()

FORCEINLINE FVector FVector::BoundToCube ( float 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 1398 of file Vector.h.

+ Here is the call graph for this function:

◆ BoxPushOut()

FORCEINLINE float FVector::BoxPushOut ( const FVector & Normal,
const FVector & 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 1632 of file Vector.h.

+ Here is the call graph for this function:

◆ Coincident()

bool FVector::Coincident ( const FVector & Normal1,
const FVector & Normal2,
float ParallelCosineThreshold = 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 1025 of file Vector.h.

+ Here is the call graph for this function:

◆ Component() [1/2]

FORCEINLINE float & FVector::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 1466 of file Vector.h.

◆ Component() [2/2]

FORCEINLINE float FVector::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 1471 of file Vector.h.

◆ ComponentMax()

FORCEINLINE FVector FVector::ComponentMax ( const FVector & Other) const

Gets the component-wise max of two vectors.

Definition at line 1301 of file Vector.h.

+ Here is the call graph for this function:

◆ ComponentMin()

FORCEINLINE FVector FVector::ComponentMin ( const FVector & Other) const

Gets the component-wise min of two vectors.

Definition at line 1296 of file Vector.h.

+ Here is the call graph for this function:

◆ ContainsNaN()

FORCEINLINE bool FVector::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 1583 of file Vector.h.

+ Here is the call graph for this function:

◆ Coplanar()

bool FVector::Coplanar ( const FVector & Base1,
const FVector & Normal1,
const FVector & Base2,
const FVector & Normal2,
float ParallelCosineThreshold = 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 1037 of file Vector.h.

+ Here is the call graph for this function:

◆ CosineAngle2D()

FORCEINLINE float FVector::CosineAngle2D ( FVector 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 1562 of file Vector.h.

+ Here is the call graph for this function:

◆ CreateOrthonormalBasis()

static void FVector::CreateOrthonormalBasis ( FVector & XAxis,
FVector & YAxis,
FVector & 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.

◆ CrossProduct()

FORCEINLINE FVector FVector::CrossProduct ( const FVector & A,
const FVector & B )
static

Calculate the cross product of two vectors.

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

Definition at line 1115 of file Vector.h.

+ Here is the call graph for this function:

◆ DegreesToRadians()

FVector FVector::DegreesToRadians ( const FVector & 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 1057 of file Vector.h.

+ Here is the call graph for this function:

◆ Dist()

FORCEINLINE float FVector::Dist ( const FVector & V1,
const FVector & V2 )
static

Euclidean distance between two points.

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

Definition at line 1612 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Dist2D()

static FORCEINLINE float FVector::Dist2D ( const FVector & V1,
const FVector & V2 )
inlinestatic

Definition at line 751 of file Vector.h.

+ Here is the call graph for this function:

◆ Distance()

static FORCEINLINE float FVector::Distance ( const FVector & V1,
const FVector & V2 )
inlinestatic

Definition at line 741 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DistSquared()

FORCEINLINE float FVector::DistSquared ( const FVector & V1,
const FVector & V2 )
static

Squared distance between two points.

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

Definition at line 1622 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DistSquared2D()

static FORCEINLINE float FVector::DistSquared2D ( const FVector & V1,
const FVector & V2 )
inlinestatic

Definition at line 770 of file Vector.h.

+ Here is the call graph for this function:

◆ DistSquaredXY()

FORCEINLINE float FVector::DistSquaredXY ( const FVector & V1,
const FVector & 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 1627 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DistXY()

FORCEINLINE float FVector::DistXY ( const FVector & V1,
const FVector & 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 1617 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DotProduct()

FORCEINLINE float FVector::DotProduct ( const FVector & A,
const FVector & B )
static

Calculate the dot product of two vectors.

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

Definition at line 1125 of file Vector.h.

+ Here is the call graph for this function:

◆ Equals()

FORCEINLINE bool FVector::Equals ( const FVector & V,
float Tolerance = 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 1181 of file Vector.h.

+ Here is the call graph for this function:

◆ EvaluateBezier()

static float FVector::EvaluateBezier ( const FVector * ControlPoints,
int32 NumPoints,
TArray< FVector > & OutPoints )
static

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

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

◆ FindBestAxisVectors()

void FVector::FindBestAxisVectors ( FVector & Axis1,
FVector & 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.

◆ GetAbs()

FORCEINLINE FVector FVector::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 1306 of file Vector.h.

+ Here is the call graph for this function:

◆ GetAbsMax()

FORCEINLINE float FVector::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 1281 of file Vector.h.

+ Here is the call graph for this function:

◆ GetAbsMin()

FORCEINLINE float FVector::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 1291 of file Vector.h.

+ Here is the call graph for this function:

◆ GetClampedToMaxSize()

FORCEINLINE FVector FVector::GetClampedToMaxSize ( float MaxSize) const

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

Definition at line 1428 of file Vector.h.

+ Here is the call graph for this function:

◆ GetClampedToMaxSize2D()

FORCEINLINE FVector FVector::GetClampedToMaxSize2D ( float MaxSize) const

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

Definition at line 1447 of file Vector.h.

+ Here is the call graph for this function:

◆ GetClampedToSize()

FORCEINLINE FVector FVector::GetClampedToSize ( float Min,
float Max ) const

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

Definition at line 1408 of file Vector.h.

+ Here is the call graph for this function:

◆ GetClampedToSize2D()

FORCEINLINE FVector FVector::GetClampedToSize2D ( float Min,
float Max ) const

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

Definition at line 1418 of file Vector.h.

+ Here is the call graph for this function:

◆ GetMax()

FORCEINLINE float FVector::GetMax ( ) const

Get the maximum value of the vector's components.

Returns
The maximum value of the vector's components.

Definition at line 1276 of file Vector.h.

+ Here is the call graph for this function:

◆ GetMin()

FORCEINLINE float FVector::GetMin ( ) const

Get the minimum value of the vector's components.

Returns
The minimum value of the vector's components.

Definition at line 1286 of file Vector.h.

+ Here is the call graph for this function:

◆ GetSafeNormal()

FORCEINLINE FVector FVector::GetSafeNormal ( float Tolerance = SMALL_NUMBER) const

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

Parameters
ToleranceMinimum squared vector length.
Returns
A normalized copy if safe, (0,0,0) otherwise.

Definition at line 1520 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSafeNormal2D()

FORCEINLINE FVector FVector::GetSafeNormal2D ( float Tolerance = SMALL_NUMBER) 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 if vector length is too small to normalize.

Parameters
ToleranceMinimum squared vector length.
Returns
Normalized copy if safe, otherwise returns zero vector.

Definition at line 1537 of file Vector.h.

+ Here is the call graph for this function:

◆ GetSignVector()

FORCEINLINE FVector FVector::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 1376 of file Vector.h.

+ Here is the call graph for this function:

◆ GetUnsafeNormal()

FORCEINLINE FVector FVector::GetUnsafeNormal ( ) const

Calculates normalized version of vector without checking for zero length.

Returns
Normalized version of vector.
See also
GetSafeNormal()

Definition at line 1392 of file Vector.h.

+ Here is the call graph for this function:

◆ GridSnap()

FVector FVector::GridSnap ( const float & GridSz) const

Gets a copy of this vector snapped to a grid.

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

◆ HeadingAngle()

FORCEINLINE float FVector::HeadingAngle ( ) const

Convert a direction vector into a 'heading' angle.

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

Definition at line 1595 of file Vector.h.

+ Here is the call graph for this function:

◆ InitFromString()

bool FVector::InitFromString ( const FString & InSourceString)

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

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

◆ IsNearlyZero()

FORCEINLINE bool FVector::IsNearlyZero ( float Tolerance = 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 1331 of file Vector.h.

+ Here is the call graph for this function:

◆ IsNormalized()

FORCEINLINE bool FVector::IsNormalized ( ) const

Checks whether vector is normalized.

Returns
true if Normalized, false otherwise.

Definition at line 1356 of file Vector.h.

+ Here is the call graph for this function:

◆ IsUniform()

FORCEINLINE bool FVector::IsUniform ( float Tolerance = 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 1510 of file Vector.h.

+ Here is the call graph for this function:

◆ IsUnit()

FORCEINLINE bool FVector::IsUnit ( float LengthSquaredTolerance = 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 1590 of file Vector.h.

+ Here is the call graph for this function:

◆ IsZero()

FORCEINLINE bool FVector::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 1339 of file Vector.h.

+ Here is the caller graph for this function:

◆ MirrorByVector()

FORCEINLINE FVector FVector::MirrorByVector ( const FVector & MirrorNormal) const

Mirror a vector about a normal vector.

Parameters
MirrorNormalNormal vector to mirror about.
Returns
Mirrored vector.

Definition at line 1515 of file Vector.h.

+ Here is the call graph for this function:

◆ Normalize()

FORCEINLINE bool FVector::Normalize ( float Tolerance = 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 1344 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator!=()

FORCEINLINE bool FVector::operator!= ( const FVector & 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 1176 of file Vector.h.

◆ operator*() [1/2]

FORCEINLINE FVector FVector::operator* ( const FVector & V) const

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

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

Definition at line 1161 of file Vector.h.

+ Here is the call graph for this function:

◆ operator*() [2/2]

FORCEINLINE FVector FVector::operator* ( float Scale) const

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 1150 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator*=() [1/2]

FORCEINLINE FVector FVector::operator*= ( const FVector & V)

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 1223 of file Vector.h.

◆ operator*=() [2/2]

FORCEINLINE FVector FVector::operator*= ( float Scale)

Scales the vector.

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

Definition at line 1210 of file Vector.h.

◆ operator+() [1/2]

FORCEINLINE FVector FVector::operator+ ( const FVector & V) const

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

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

Definition at line 1130 of file Vector.h.

+ Here is the call graph for this function:

◆ operator+() [2/2]

FORCEINLINE FVector FVector::operator+ ( float Bias) const

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 1145 of file Vector.h.

+ Here is the call graph for this function:

◆ operator+=()

FORCEINLINE FVector FVector::operator+= ( const FVector & V)

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 1198 of file Vector.h.

◆ operator-() [1/3]

FORCEINLINE FVector FVector::operator- ( ) const

Get a negated copy of the vector.

Returns
A negated copy of the vector.

Definition at line 1192 of file Vector.h.

+ Here is the call graph for this function:

◆ operator-() [2/3]

FORCEINLINE FVector FVector::operator- ( const FVector & V) const

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

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

Definition at line 1135 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator-() [3/3]

FORCEINLINE FVector FVector::operator- ( float Bias) const

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 1140 of file Vector.h.

+ Here is the call graph for this function:

◆ operator-=()

FORCEINLINE FVector FVector::operator-= ( const FVector & V)

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 1204 of file Vector.h.

◆ operator/() [1/2]

FORCEINLINE FVector FVector::operator/ ( const FVector & V) const

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

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

Definition at line 1166 of file Vector.h.

+ Here is the call graph for this function:

◆ operator/() [2/2]

FORCEINLINE FVector FVector::operator/ ( float Scale) const

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 1155 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator/=() [1/2]

FORCEINLINE FVector FVector::operator/= ( const FVector & V)

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 1229 of file Vector.h.

◆ operator/=() [2/2]

FORCEINLINE FVector FVector::operator/= ( float V)

Divides the vector by a number.

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

Definition at line 1216 of file Vector.h.

◆ operator==()

FORCEINLINE bool FVector::operator== ( const FVector & V) const

Check against another vector for equality.

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

Definition at line 1171 of file Vector.h.

◆ operator[]() [1/2]

FORCEINLINE float & FVector::operator[] ( int32 Index)

Gets specific component of the vector.

Parameters
Indexthe index of vector component
Returns
reference to component.

Definition at line 1235 of file Vector.h.

◆ operator[]() [2/2]

FORCEINLINE float FVector::operator[] ( int32 Index) const

Gets specific component of the vector.

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

Definition at line 1252 of file Vector.h.

◆ operator^()

FORCEINLINE FVector FVector::operator^ ( const FVector & V) const

Calculate cross product between this and another vector.

Parameters
VThe other vector.
Returns
The cross product.

Definition at line 1105 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator|()

FORCEINLINE float FVector::operator| ( const FVector & V) const

Calculate the dot product between this and another vector.

Parameters
VThe other vector.
Returns
The dot product.

Definition at line 1120 of file Vector.h.

+ Here is the caller graph for this function:

◆ Orthogonal()

bool FVector::Orthogonal ( const FVector & Normal1,
const FVector & Normal2,
float OrthogonalCosineThreshold = 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 1031 of file Vector.h.

+ Here is the call graph for this function:

◆ Parallel()

bool FVector::Parallel ( const FVector & Normal1,
const FVector & Normal2,
float ParallelCosineThreshold = 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 1019 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PointPlaneDist()

float FVector::PointPlaneDist ( const FVector & Point,
const FVector & PlaneBase,
const FVector & 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 996 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PointPlaneProject() [1/2]

static FVector FVector::PointPlaneProject ( const FVector & Point,
const FVector & A,
const FVector & B,
const FVector & C )
static

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

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

◆ PointPlaneProject() [2/2]

FVector FVector::PointPlaneProject ( const FVector & Point,
const FVector & PlaneBase,
const FVector & 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 1007 of file Vector.h.

+ Here is the call graph for this function:

◆ PointsAreNear()

bool FVector::PointsAreNear ( const FVector & Point1,
const FVector & Point2,
float 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 987 of file Vector.h.

+ Here is the call graph for this function:

◆ PointsAreSame()

bool FVector::PointsAreSame ( const FVector & P,
const FVector & 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 968 of file Vector.h.

◆ Projection()

FORCEINLINE FVector FVector::Projection ( ) const

Projects 2D components of vector based on Z.

Returns
Projected version of vector based on Z.

Definition at line 1386 of file Vector.h.

+ Here is the call graph for this function:

◆ ProjectOnTo()

FORCEINLINE FVector FVector::ProjectOnTo ( const FVector & 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 1572 of file Vector.h.

+ Here is the call graph for this function:

◆ ProjectOnToNormal()

FORCEINLINE FVector FVector::ProjectOnToNormal ( const FVector & 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 1577 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RadiansToDegrees()

FVector FVector::RadiansToDegrees ( const FVector & 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 1052 of file Vector.h.

+ Here is the call graph for this function:

◆ Reciprocal()

FORCEINLINE FVector FVector::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 1476 of file Vector.h.

◆ RotateAngleAxis()

FVector FVector::RotateAngleAxis ( const float AngleDeg,
const FVector & Axis ) const
inline

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

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

Definition at line 942 of file Vector.h.

+ Here is the call graph for this function:

◆ Rotation()

FRotator FVector::Rotation ( ) 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.

Note
Identical to 'ToOrientationRotator()' and preserved for legacy reasons.
Returns
FRotator from the Vector's direction.
See also
ToOrientationRotator(), ToOrientationQuat()

◆ Set()

FORCEINLINE void FVector::Set ( float InX,
float InY,
float InZ )

Set the values of the vector directly.

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

Definition at line 1269 of file Vector.h.

◆ Size()

FORCEINLINE float FVector::Size ( ) const

Get the length (magnitude) of this vector.

Returns
The length of this vector.

Definition at line 1311 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Size2D()

FORCEINLINE float FVector::Size2D ( ) const

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

Returns
The 2D length of this vector.

Definition at line 1321 of file Vector.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SizeSquared()

FORCEINLINE float FVector::SizeSquared ( ) const

Get the squared length of this vector.

Returns
The squared length of this vector.

Definition at line 1316 of file Vector.h.

+ Here is the caller graph for this function:

◆ SizeSquared2D()

FORCEINLINE float FVector::SizeSquared2D ( ) const

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

Returns
The squared 2D length of this vector.

Definition at line 1326 of file Vector.h.

+ Here is the caller graph for this function:

◆ ToDirectionAndLength()

FORCEINLINE void FVector::ToDirectionAndLength ( FVector & OutDir,
float & 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 1361 of file Vector.h.

+ Here is the call graph for this function:

◆ ToOrientationQuat()

FQuat FVector::ToOrientationQuat ( ) const

Return the Quaternion orientation corresponding to the direction in which the vector points. Similar to the FRotator 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()

FRotator FVector::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, without any roll.
See also
ToOrientationQuat()

◆ ToString()

FORCEINLINE FString FVector::ToString ( ) const

Get a textual representation of this vector.

Returns
A string describing the vector.

Definition at line 1637 of file Vector.h.

+ Here is the call graph for this function:

◆ Triple()

float FVector::Triple ( const FVector & X,
const FVector & Y,
const FVector & 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 1044 of file Vector.h.

◆ UnitCartesianToSpherical()

FVector2D FVector::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].

◆ UnwindEuler()

void FVector::UnwindEuler ( )

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

◆ VectorPlaneProject()

FVector FVector::VectorPlaneProject ( const FVector & V,
const FVector & 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 1014 of file Vector.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ X

float FVector::X

Vector's X component.

Definition at line 27 of file Vector.h.

◆ Y

float FVector::Y

Vector's Y component.

Definition at line 30 of file Vector.h.

◆ Z

float FVector::Z

Vector's Z component.

Definition at line 33 of file Vector.h.

◆ ZeroVector

const FVector FVector::ZeroVector
static

Definition at line 38 of file Vector.h.


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