Navigation
API > API/Runtime > API/Runtime/Core
| Name | TVector2 |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/Math/MathFwd.h |
| Include Path | #include "Math/MathFwd.h" |
| Source | /Engine/Source/Runtime/Core/Public/Math/Vector2D.h |
Syntax
template<typename T>
struct TVector2
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TVector2
(
EForceInit |
Constructor which initializes all components to zero. | Math/Vector2D.h | |
| Constructs a vector from an FVector. Copies the X and Y components from the FVector. | Math/Vector2D.h | ||
| Constructor that does not initialize. More explicit than the default constructor. | Math/Vector2D.h | ||
| Constructs a vector from an FVector4. | Math/Vector2D.h | ||
TVector2
(
TIntVector2< IntType > V |
Math/Vector2D.h | ||
TVector2
(
T InX, |
Constructor using initial values for each component. | Math/Vector2D.h | |
TVector2
(
T InF |
Constructor initializing both components to a single T value. | Math/Vector2D.h | |
TVector2 () |
Default constructor (no initialization). | Math/Vector2D.h | |
| Conversion from other type. | Math/Vector2D.h | ||
| Constructs a vector from an FIntPoint. | Math/Vector2D.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FReal | T | Math/Vector2D.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| NumComponents | int32 | The number of components this vector type has. | Math/Vector2D.h |
| Unit45Deg | const TVector2< T > | Global 2D unit vector constant along the 45 degree angle or symmetrical positive axes (sqrt(.5),sqrt(.5)) or (.707,.707). | Math/Vector2D.h |
| UnitVector | const TVector2< T > | Global 2D one vector (poorly named) constant (1,1). | Math/Vector2D.h |
| ZeroVector | const TVector2< T > | Global 2D zero vector constant (0,0) | Math/Vector2D.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| TVector2 | union UE::Math::TVector2 | Math/Vector2D.h | ||
| X | T | Vector's X component. | Math/Vector2D.h | |
| XY | T | Math/Vector2D.h | ||
| Y | T | Vector's Y component. | Math/Vector2D.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TVector2< T > ClampAxes
(
T MinAxisVal, |
Creates a copy of this vector with both axes clamped to the given range. | Math/Vector2D.h | |
T Component
(
int32 Index |
Gets a specific component of the vector. | Math/Vector2D.h | |
T & Component
(
int32 Index |
Gets a specific component of the vector. | Math/Vector2D.h | |
| Gets the component-wise max of two vectors. | Math/Vector2D.h | ||
| Gets the component-wise min of two vectors. | Math/Vector2D.h | ||
bool ComponentwiseAllGreaterOrEqual
(
const TVector2< T >& Other |
Checks whether both components of this vector are greater than or equal to another. | Math/Vector2D.h | |
bool ComponentwiseAllGreaterThan
(
const TVector2< T >& Other |
Checks whether both components of this vector are greater than another. | Math/Vector2D.h | |
bool ComponentwiseAllLessOrEqual
(
const TVector2< T >& Other |
Checks whether both components of this vector are less than or equal to another. | Math/Vector2D.h | |
bool ComponentwiseAllLessThan
(
const TVector2< T >& Other |
Checks whether both components of this vector are less than another. | Math/Vector2D.h | |
bool ContainsNaN() |
Utility to check if there are any non-finite values (NaN or Inf) in this vector. | Math/Vector2D.h | |
void DiagnosticCheckNaN() |
Math/Vector2D.h | ||
T Dot
(
const TVector2< T >& V2 |
Get the dot product of this vector against another. | Math/Vector2D.h | |
bool Equals
(
const TVector2< T >& V, |
Checks for equality with error-tolerant comparison. | Math/Vector2D.h | |
TVector2< T > GetAbs() |
Get a copy of this vector with absolute value of each component. | Math/Vector2D.h | |
T GetAbsMax() |
Get the maximum absolute value of the vector's components. | Math/Vector2D.h | |
TVector2< T > GetClampedToMaxSize
(
T MaxSize |
Create a copy of this vector, with its maximum magnitude clamped to MaxSize. | Math/Vector2D.h | |
TVector2< T > GetClampedToSize
(
T Min, |
Create a copy of this vector, with its magnitude clamped between Min and Max. | Math/Vector2D.h | |
T GetMax() |
Get the maximum value of the vector's components. | Math/Vector2D.h | |
T GetMin() |
Get the minimum value of the vector's components. | Math/Vector2D.h | |
TVector2< T > GetRotated
(
T AngleDeg |
Rotates around axis (0,0,1) | Math/Vector2D.h | |
TVector2< T > GetSafeNormal
(
T Tolerance |
Gets a normalized copy of the vector, checking it is safe to do so based on the length. | Math/Vector2D.h | |
TVector2< T > GetSignVector () |
Get a copy of the vector as sign only. | Math/Vector2D.h | |
bool InitFromString
(
const FString& InSourceString |
Initialize this Vector based on an FString. | Math/Vector2D.h | |
FIntPoint IntPoint() |
Get this vector as an Int Point. | Math/Vector2D.h | |
bool IsNearlyZero
(
T Tolerance |
Checks whether vector is near to zero within a specified tolerance. | Math/Vector2D.h | |
bool IsValidIndex
(
int32 Index |
Tests if index is valid, i.e. greater than or equal to zero, and less than the number of components in the vector. | Math/Vector2D.h | |
bool IsZero() |
Checks whether all components of the vector are exactly zero. | Math/Vector2D.h | |
T Length () |
Get the length (magnitude) of this vector. | Math/Vector2D.h | |
bool NetSerialize
(
FArchive& Ar, |
Network serialization function. | Math/Vector2D.h | |
bool Normalize
(
T Tolerance |
Normalize this vector in-place if it is large enough, set it to (0,0) otherwise. | Math/Vector2D.h | |
TVector2< T > RoundToVector() |
Get this vector as a vector where each component has been rounded to the nearest int. | Math/Vector2D.h | |
| Math/Vector2D.h | |||
bool Serialize
(
FStructuredArchive::FSlot Slot |
Math/Vector2D.h | ||
| Math/Vector2D.h | |||
void Set
(
T InX, |
Set the values of the vector directly. | Math/Vector2D.h | |
T Size () |
Get the length (magnitude) of this vector. | Math/Vector2D.h | |
T SizeSquared () |
Get the squared length of this vector. | Math/Vector2D.h | |
TVector< T > SphericalToUnitCartesian() |
Converts spherical coordinates on the unit sphere into a Cartesian unit length vector. | Math/Vector2D.h | |
T SquaredLength () |
Get the squared length of this vector. | Math/Vector2D.h | |
void ToDirectionAndLength
(
TVector2< T >& OutDir, |
Util to convert this vector into a unit direction vector and its original length. | Math/Vector2D.h | |
void ToDirectionAndLength
(
TVector2< T >& OutDir, |
Math/Vector2D.h | ||
FString ToString() |
Get a textual representation of the vector. | Math/Vector2D.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Returns a vector with each component clamped between a minimum and a maximum. | Math/Vector2D.h | ||
| Calculate the cross product of two vectors. | Math/Vector2D.h | ||
| Distance between two 2D points. | Math/Vector2D.h | ||
| Squared distance between two 2D points. | Math/Vector2D.h | ||
| Calculates the dot product of two vectors. | Math/Vector2D.h | ||
| Returns a vector with the maximum component for each dimension from the pair of vectors. | Math/Vector2D.h | ||
| Returns a vector with the minimum component for each dimension from the pair of vectors. | Math/Vector2D.h | ||
static TVector2< T > One() |
Math/Vector2D.h | ||
static TVector2< T > UnitX() |
Math/Vector2D.h | ||
static TVector2< T > UnitY() |
Math/Vector2D.h | ||
static TVector2< T > Zero() |
Math/Vector2D.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Gets the result of subtracting A from each component of the vector. | Math/Vector2D.h | ||
| Gets the result of subtracting a vector from this one. | Math/Vector2D.h | ||
TVector2< T > operator-() |
Gets a negated copy of the vector. | Math/Vector2D.h | |
bool operator!=
(
const TVector2< T >& V |
Compares this vector against another for inequality. | Math/Vector2D.h | |
| Gets the result of scaling the vector (multiplying each component by a value). | Math/Vector2D.h | ||
| Gets the result of component-wise multiplication of this vector by another. | Math/Vector2D.h | ||
TVector2< T > operator*=
(
T Scale |
Scales this vector. | Math/Vector2D.h | |
TVector2< T > operator*=
(
const TVector2< T >& V |
Multiplies this vector with another vector, using component-wise multiplication. | Math/Vector2D.h | |
| Gets the result of dividing each component of the vector by a value. | Math/Vector2D.h | ||
| Gets the result of component-wise division of this vector by another. | Math/Vector2D.h | ||
TVector2< T > operator/=
(
const TVector2< T >& V |
Divides this vector by another vector, using component-wise division. | Math/Vector2D.h | |
TVector2< T > operator/=
(
T V |
Divides this vector. | Math/Vector2D.h | |
T operator[]
(
int32 Index |
Gets specific component of the vector. | Math/Vector2D.h | |
T & operator[]
(
int32 Index |
Gets specific component of the vector. | Math/Vector2D.h | |
T operator^
(
const TVector2< T >& V |
Calculates cross product of this vector and another. | Math/Vector2D.h | |
T operator|
(
const TVector2< T >& V |
Calculates dot product of this vector and another. | Math/Vector2D.h | |
| Gets the result of adding two vectors together. | Math/Vector2D.h | ||
| Gets the result of adding A to each component of the vector. | Math/Vector2D.h | ||
| Adds another vector to this. | Math/Vector2D.h | ||
| Subtracts another vector from this. | Math/Vector2D.h | ||
bool operator==
(
const TVector2< T >& V |
Compares this vector against another for equality. | Math/Vector2D.h |