 FVector2D

Module 

Header 
/Engine/Source/Runtime/Core/Public/Math/Vector2D.h 
Include 
#include "Math/Vector2D.h" 
struct FVector2D
A vector in 2D space composed of components (X, Y) with floating point precision.
Name  Description  


float 
X 
Vector's X component. 

float 
Y 
Vector's Y component. 
Name  Description  


FVector2D() 
Default constructor (no initialization). 

FVector2D ( 
Constructor initializing both components to a single float value. 

FVector2D ( 
Constructs a vector from an FIntPoint. 

FVector2D ( 
Constructor which initializes all components to zero. 

FVector2D ( 
Constructor that does not initialize. More explicit than the default constructor. 

FVector2D ( 
Constructs a vector from an FVector. 

FVector2D ( 
Constructs a vector from an FVector4. 

FVector2D ( 
Constructor using initial values for each component. 
Name  Description  


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


float 
Component ( 
Gets a specific component of the vector. 

float & 
Component ( 
Gets a specific component of the vector. 

ContainsNaN() 
Utility to check if there are any nonfinite values (NaN or Inf) in this vector. 


float 
CrossProduct 
Calculate the cross product of two vectors. 

DiagnosticCheckNaN() 


float 
Distance 
Distance between two 2D points. 

float 
DistSquared 
Squared distance between two 2D points. 

float 
DotProduct 
Calculates the dot product of two vectors. 

Equals ( 
Checks for equality with errortolerant comparison. 


GetAbs() 
Get a copy of this vector with absolute value of each component. 


float 
GetAbsMax() 
Get the maximum absolute value of the vector's components. 

float 
GetMax() 
Get the maximum value of the vector's components. 

float 
GetMin() 
Get the minimum value of the vector's components. 

GetRotated ( 
Rotates around axis (0,0,1) 


GetSafeNormal ( 
Gets a normalized copy of the vector, checking it is safe to do so based on the length. 


GetSignVector() 
Get a copy of the vector as sign only. 


InitFromString ( 
Initialize this Vector based on an FString. 


IntPoint() 
Get this vector as an Int Point. 


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


IsZero() 
Checks whether all components of the vector are exactly zero. 


Max 
Returns a vector with the maximum component for each dimension from the pair of vectors. 


Min 
Returns a vector with the minimum component for each dimension from the pair of vectors. 


NetSerialize ( 
Network serialization function. 


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


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


Serialize ( 


Serialize ( 


Set ( 
Set the values of the vector directly. 


float 
Size() 
Get the length (magnitude) of this vector. 

float 
SizeSquared() 
Get the squared length of this vector. 

SphericalToUnitCartesian() 
Converts spherical coordinates on the unit sphere into a Cartesian unit length vector. 


ToDirectionAndLength ( 
Util to convert this vector into a unit direction vector and its original length. 


ToString() 
Get a textual representation of the vector. 
Name  Description  


operator ( 
Gets the result of subtracting A from each component of the vector. 


operator() 
Gets a negated copy of the vector. 


operator ( 
Gets the result of subtracting a vector from this one. 


operator!= ( 
Compares this vector against another for inequality. 


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


operator* ( 
Gets the result of componentwise multiplication of this vector by another. 


operator*= ( 
Multiplies this vector with another vector, using componentwise multiplication. 


operator*= ( 
Scales this vector. 


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


operator/ ( 
Gets the result of componentwise division of this vector by another. 


operator/= ( 
Divides this vector. 


operator/= ( 
Divides this vector by another vector, using componentwise division. 


float & 
operator[] ( 
Gets specific component of the vector. 

float 
operator[] ( 
Gets specific component of the vector. 

float 
operator^ ( 
Calculates cross product of this vector and another. 

float 
operator ( 
Calculates dot product of this vector and another. 

operator+ ( 
Gets the result of adding two vectors together. 


operator+ ( 
Gets the result of adding A to each component of the vector. 


operator+= ( 
Adds another vector to this. 


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


operator<= ( 
Checks whether both components of this vector are less than or equal to another. 


operator= ( 
Subtracts another vector from this. 


operator== ( 
Compares this vector against another for equality. 


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


operator>= ( 
Checks whether both components of this vector are greater than or equal to another. 
Name 
Description 

Unit45Deg 
Global 2D unit vector constant along the 45 degree angle or symmetrical positive axes (sqrt(.5),sqrt(.5)) or (.707,.707). 
UnitVector 
Global 2D one vector (poorly named) constant (1,1). 
ZeroVector 
Global 2D zero vector constant (0,0) 