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

#include <Vector2D.h>

+ Collaboration diagram for FVector2D:

Public Member Functions

FORCEINLINE FVector2D ()
 
FORCEINLINE FVector2D (float InX, float InY)
 
FORCEINLINE FVector2D (FIntPoint InPos)
 
FORCEINLINE FVector2D (EForceInit)
 
FORCEINLINE FVector2D operator+ (const FVector2D &V) const
 
FORCEINLINE FVector2D operator- (const FVector2D &V) const
 
FORCEINLINE FVector2D operator* (float Scale) const
 
FVector2D operator/ (float Scale) const
 
FORCEINLINE FVector2D operator+ (float A) const
 
FORCEINLINE FVector2D operator- (float A) const
 
FORCEINLINE FVector2D operator* (const FVector2D &V) const
 
FVector2D operator/ (const FVector2D &V) const
 
FORCEINLINE float operator| (const FVector2D &V) const
 
FORCEINLINE float operator^ (const FVector2D &V) const
 
bool operator== (const FVector2D &V) const
 
bool operator!= (const FVector2D &V) const
 
bool operator< (const FVector2D &Other) const
 
bool operator> (const FVector2D &Other) const
 
bool operator<= (const FVector2D &Other) const
 
bool operator>= (const FVector2D &Other) const
 
FORCEINLINE FVector2D operator- () const
 
FORCEINLINE FVector2D operator+= (const FVector2D &V)
 
FORCEINLINE FVector2D operator-= (const FVector2D &V)
 
FORCEINLINE FVector2D operator*= (float Scale)
 
FVector2D operator/= (float V)
 
FVector2D operator*= (const FVector2D &V)
 
FVector2D operator/= (const FVector2D &V)
 
float & operator[] (int32 Index)
 
float operator[] (int32 Index) const
 
float & Component (int32 Index)
 
float Component (int32 Index) const
 
bool Equals (const FVector2D &V, float Tolerance=KINDA_SMALL_NUMBER) const
 
void Set (float InX, float InY)
 
float GetMax () const
 
float GetAbsMax () const
 
float GetMin () const
 
float Size () const
 
float SizeSquared () const
 
FVector2D GetRotated (float AngleDeg) const
 
FVector2D GetSafeNormal (float Tolerance=SMALL_NUMBER) const
 
void Normalize (float Tolerance=SMALL_NUMBER)
 
bool IsNearlyZero (float Tolerance=KINDA_SMALL_NUMBER) const
 
void ToDirectionAndLength (FVector2D &OutDir, float &OutLength) const
 
bool IsZero () const
 
FIntPoint IntPoint () const
 
FVector2D RoundToVector () const
 
FVector2D ClampAxes (float MinAxisVal, float MaxAxisVal) const
 
FORCEINLINE FVector2D GetSignVector () const
 
FORCEINLINE FVector2D GetAbs () const
 
FORCEINLINE bool ContainsNaN () const
 

Static Public Member Functions

static FORCEINLINE float DotProduct (const FVector2D &A, const FVector2D &B)
 
static FORCEINLINE float DistSquared (const FVector2D &V1, const FVector2D &V2)
 
static FORCEINLINE float Distance (const FVector2D &V1, const FVector2D &V2)
 
static FORCEINLINE float CrossProduct (const FVector2D &A, const FVector2D &B)
 

Public Attributes

float X
 
float Y
 

Static Public Attributes

static const FVector2D ZeroVector
 
static const FVector2D UnitVector
 

Detailed Description

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

Definition at line 16 of file Vector2D.h.

Constructor & Destructor Documentation

◆ FVector2D() [1/4]

FORCEINLINE FVector2D::FVector2D ( )
inline

Default constructor (no initialization).

Definition at line 35 of file Vector2D.h.

◆ FVector2D() [2/4]

FORCEINLINE FVector2D::FVector2D ( float InX,
float InY )

Constructor using initial values for each component.

Parameters
InXX coordinate.
InYY coordinate.

Definition at line 475 of file Vector2D.h.

+ Here is the caller graph for this function:

◆ FVector2D() [3/4]

FORCEINLINE FVector2D::FVector2D ( FIntPoint InPos)

Constructs a vector from an FIntPoint.

Parameters
InPosInteger point used to set this vector.

Definition at line 480 of file Vector2D.h.

◆ FVector2D() [4/4]

FORCEINLINE FVector2D::FVector2D ( EForceInit )
explicit

Constructor which initializes all components to zero.

Parameters
EForceInitForce init enum

Definition at line 487 of file Vector2D.h.

Member Function Documentation

◆ ClampAxes()

FORCEINLINE FVector2D FVector2D::ClampAxes ( float MinAxisVal,
float MaxAxisVal ) const

Creates a copy of this vector with both axes clamped to the given range.

Returns
New vector with clamped axes.

Definition at line 811 of file Vector2D.h.

+ Here is the call graph for this function:

◆ Component() [1/2]

FORCEINLINE float & FVector2D::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 789 of file Vector2D.h.

◆ Component() [2/2]

FORCEINLINE float FVector2D::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 795 of file Vector2D.h.

◆ ContainsNaN()

FORCEINLINE bool FVector2D::ContainsNaN ( ) const
inline

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 457 of file Vector2D.h.

+ Here is the call graph for this function:

◆ CrossProduct()

FORCEINLINE float FVector2D::CrossProduct ( const FVector2D & A,
const FVector2D & B )
static

Calculate the cross product of two vectors.

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

Definition at line 571 of file Vector2D.h.

+ Here is the call graph for this function:

◆ Distance()

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

Distance between two 2D points.

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

Definition at line 565 of file Vector2D.h.

+ Here is the call graph for this function:

◆ DistSquared()

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

Squared distance between two 2D points.

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

Definition at line 559 of file Vector2D.h.

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

◆ DotProduct()

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

Calculates the dot product of two vectors.

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

Definition at line 553 of file Vector2D.h.

+ Here is the call graph for this function:

◆ Equals()

FORCEINLINE bool FVector2D::Equals ( const FVector2D & V,
float Tolerance = KINDA_SMALL_NUMBER ) const

Checks for equality with error-tolerant comparison.

Parameters
VThe vector to compare.
ToleranceError tolerance.
Returns
true if the vectors are equal within specified tolerance, otherwise false.

Definition at line 613 of file Vector2D.h.

+ Here is the call graph for this function:

◆ GetAbs()

FORCEINLINE FVector2D FVector2D::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 826 of file Vector2D.h.

+ Here is the call graph for this function:

◆ GetAbsMax()

FORCEINLINE float FVector2D::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 695 of file Vector2D.h.

+ Here is the call graph for this function:

◆ GetMax()

FORCEINLINE float FVector2D::GetMax ( ) const

Get the maximum value of the vector's components.

Returns
The maximum value of the vector's components.

Definition at line 689 of file Vector2D.h.

+ Here is the call graph for this function:

◆ GetMin()

FORCEINLINE float FVector2D::GetMin ( ) const

Get the minimum value of the vector's components.

Returns
The minimum value of the vector's components.

Definition at line 701 of file Vector2D.h.

+ Here is the call graph for this function:

◆ GetRotated()

FORCEINLINE FVector2D FVector2D::GetRotated ( float AngleDeg) const

Rotates around axis (0,0,1)

Parameters
AngleDegAngle to rotate (in degrees)
Returns
Rotated Vector

Definition at line 719 of file Vector2D.h.

+ Here is the call graph for this function:

◆ GetSafeNormal()

FORCEINLINE FVector2D FVector2D::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 length of vector for normalization.
Returns
A normalized copy of the vector if safe, (0,0) otherwise.

Definition at line 734 of file Vector2D.h.

+ Here is the call graph for this function:

◆ GetSignVector()

FORCEINLINE FVector2D FVector2D::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 817 of file Vector2D.h.

+ Here is the call graph for this function:

◆ IntPoint()

FORCEINLINE FIntPoint FVector2D::IntPoint ( ) const

Get this vector as an Int Point.

Returns
New Int Point from this vector.

Definition at line 801 of file Vector2D.h.

+ Here is the call graph for this function:

◆ IsNearlyZero()

FORCEINLINE bool FVector2D::IsNearlyZero ( float Tolerance = KINDA_SMALL_NUMBER) const

Checks whether vector is near to zero within a specified tolerance.

Parameters
ToleranceError tolerance.
Returns
true if vector is in tolerance to zero, otherwise false.

Definition at line 776 of file Vector2D.h.

+ Here is the call graph for this function:

◆ IsZero()

FORCEINLINE bool FVector2D::IsZero ( ) const

Checks whether all components of the vector are exactly zero.

Returns
true if vector is exactly zero, otherwise false.

Definition at line 783 of file Vector2D.h.

◆ Normalize()

FORCEINLINE void FVector2D::Normalize ( float Tolerance = SMALL_NUMBER)

Normalize this vector in-place if it is large enough, set it to (0,0) otherwise.

Parameters
ToleranceMinimum squared length of vector for normalization.
See also
GetSafeNormal()

Definition at line 746 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator!=()

FORCEINLINE bool FVector2D::operator!= ( const FVector2D & V) const

Compares this vector against another for inequality.

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

Definition at line 583 of file Vector2D.h.

◆ operator*() [1/2]

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

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

Parameters
VThe other vector to multiply this by.
Returns
The result of the multiplication.

Definition at line 529 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator*() [2/2]

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

Gets the result of scaling the vector (multiplying each component by a value).

Parameters
ScaleHow much to scale the vector by.
Returns
The result of scaling this vector.

Definition at line 504 of file Vector2D.h.

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

◆ operator*=() [1/2]

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

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

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

Definition at line 654 of file Vector2D.h.

◆ operator*=() [2/2]

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

Scales this vector.

Parameters
ScaleThe scale to multiply vector by.
Returns
Copy of the vector after scaling.

Definition at line 639 of file Vector2D.h.

◆ operator+() [1/2]

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

Gets the result of adding two vectors together.

Parameters
VThe other vector to add to this.
Returns
The result of adding the vectors together.

Definition at line 492 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator+() [2/2]

FORCEINLINE FVector2D FVector2D::operator+ ( float A) const

Gets the result of this vector + float A.

Parameters
AFloat to add to each component.
Returns
The result of this vector + float A.

Definition at line 517 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator+=()

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

Adds another vector to this.

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

Definition at line 625 of file Vector2D.h.

◆ operator-() [1/3]

FORCEINLINE FVector2D FVector2D::operator- ( ) const

Gets a negated copy of the vector.

Returns
A negated copy of the vector.

Definition at line 619 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator-() [2/3]

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

Gets the result of subtracting a vector from this one.

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

Definition at line 498 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator-() [3/3]

FORCEINLINE FVector2D FVector2D::operator- ( float A) const

Gets the result of subtracting from each component of the vector.

Parameters
AFloat to subtract from each component
Returns
The result of this vector - float A.

Definition at line 523 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator-=()

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

Subtracts another vector from this.

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

Definition at line 632 of file Vector2D.h.

◆ operator/() [1/2]

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

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

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

Definition at line 535 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator/() [2/2]

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

Gets the result of dividing each component of the vector by a value.

Parameters
ScaleHow much to divide the vector by.
Returns
The result of division on this vector.

Definition at line 510 of file Vector2D.h.

+ Here is the call graph for this function:

◆ operator/=() [1/2]

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

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

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

Definition at line 661 of file Vector2D.h.

◆ operator/=() [2/2]

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

Divides this vector.

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

Definition at line 646 of file Vector2D.h.

◆ operator<()

FORCEINLINE bool FVector2D::operator< ( const FVector2D & Other) const

Checks whether both components of this vector are less than another.

Parameters
OtherThe vector to compare against.
Returns
true if this is the smaller vector, otherwise false.

Definition at line 589 of file Vector2D.h.

◆ operator<=()

FORCEINLINE bool FVector2D::operator<= ( const FVector2D & Other) const

Checks whether both components of this vector are less than or equal to another.

Parameters
OtherThe vector to compare against.
Returns
true if this vector is less than or equal to the other vector, otherwise false.

Definition at line 601 of file Vector2D.h.

◆ operator==()

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

Compares this vector against another for equality.

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

Definition at line 577 of file Vector2D.h.

◆ operator>()

FORCEINLINE bool FVector2D::operator> ( const FVector2D & Other) const

Checks whether both components of this vector are greater than another.

Parameters
OtherThe vector to compare against.
Returns
true if this is the larger vector, otherwise false.

Definition at line 595 of file Vector2D.h.

◆ operator>=()

FORCEINLINE bool FVector2D::operator>= ( const FVector2D & Other) const

Checks whether both components of this vector are greater than or equal to another.

Parameters
OtherThe vector to compare against.
Returns
true if this vector is greater than or equal to the other vector, otherwise false.

Definition at line 607 of file Vector2D.h.

◆ operator[]() [1/2]

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

Gets specific component of the vector.

Parameters
Indexthe index of vector component
Returns
reference to component.

Definition at line 668 of file Vector2D.h.

◆ operator[]() [2/2]

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

Gets specific component of the vector.

Parameters
Indexthe index of vector component
Returns
copy of component value.

Definition at line 675 of file Vector2D.h.

◆ operator^()

FORCEINLINE float FVector2D::operator^ ( const FVector2D & V) const

Calculates cross product of this vector and another.

Parameters
VThe other vector.
Returns
The cross product.

Definition at line 547 of file Vector2D.h.

+ Here is the caller graph for this function:

◆ operator|()

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

Calculates dot product of this vector and another.

Parameters
VThe other vector.
Returns
The dot product.

Definition at line 541 of file Vector2D.h.

+ Here is the caller graph for this function:

◆ RoundToVector()

FORCEINLINE FVector2D FVector2D::RoundToVector ( ) const

Get this vector as a vector where each component has been rounded to the nearest int.

Returns
New FVector2D from this vector that is rounded.

Definition at line 806 of file Vector2D.h.

+ Here is the call graph for this function:

◆ Set()

FORCEINLINE void FVector2D::Set ( float InX,
float InY )

Set the values of the vector directly.

Parameters
InXNew X coordinate.
InYNew Y coordinate.

Definition at line 682 of file Vector2D.h.

◆ Size()

FORCEINLINE float FVector2D::Size ( ) const

Get the length (magnitude) of this vector.

Returns
The length of this vector.

Definition at line 707 of file Vector2D.h.

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

◆ SizeSquared()

FORCEINLINE float FVector2D::SizeSquared ( ) const

Get the squared length of this vector.

Returns
The squared length of this vector.

Definition at line 713 of file Vector2D.h.

◆ ToDirectionAndLength()

FORCEINLINE void FVector2D::ToDirectionAndLength ( FVector2D & 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 761 of file Vector2D.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ UnitVector

const FVector2D FVector2D::UnitVector
static

Global 2D unit vector constant (1,1)

Definition at line 30 of file Vector2D.h.

◆ X

float FVector2D::X

Vector's X component.

Definition at line 19 of file Vector2D.h.

◆ Y

float FVector2D::Y

Vector's Y component.

Definition at line 22 of file Vector2D.h.

◆ ZeroVector

const FVector2D FVector2D::ZeroVector
static

Global 2D zero vector constant (0,0)

Definition at line 27 of file Vector2D.h.


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