Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Math
Inheritance Hierarchy
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Math/MathFwd.h |
| Include | #include "Math/MathFwd.h" |
Syntax
template<typename T>
struct TVector2
Variables
| Type | Name | Description | |
|---|---|---|---|
| union UE::Math::TVector2::@649 | @650 | ||
| T | X | Vector's X component. | |
| T[2] | XY | ||
| T | Y | Vector's Y component. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
TVector2 () |
Default constructor (no initialization). | ||
TVector2
(
T InF |
Constructor initializing both components to a single T value. | ||
| Constructs a vector from an FIntPoint. | |||
TVector2
(
EForceInit |
Constructor which initializes all components to zero. | ||
TVector2
(
ENoInit |
Constructor that does not initialize. More explicit than the default constructor. | ||
| Constructs a vector from an FVector. Copies the X and Y components from the FVector. | |||
| Constructs a vector from an FVector4. | |||
| Conversion from other type. | |||
TVector2
(
T InX, |
Constructor using initial values for each component. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| TVector2< T > | ClampAxes
(
T MinAxisVal, |
Creates a copy of this vector with both axes clamped to the given range. | |
| T | Component
(
int32 Index |
Gets a specific component of the vector. | |
| T & | Component
(
int32 Index |
Gets a specific component of the vector. | |
| bool | ComponentwiseAllGreaterOrEqual
(
const TVector2< T >& Other |
Checks whether both components of this vector are greater than or equal to another. | |
| bool | ComponentwiseAllGreaterThan
(
const TVector2< T >& Other |
Checks whether both components of this vector are greater than another. | |
| bool | ComponentwiseAllLessOrEqual
(
const TVector2< T >& Other |
Checks whether both components of this vector are less than or equal to another. | |
| bool | ComponentwiseAllLessThan
(
const TVector2< T >& Other |
Checks whether both components of this vector are less than another. | |
| bool | ContainsNaN () |
Utility to check if there are any non-finite values (NaN or Inf) in this vector. | |
| T | CrossProduct
(
const TVector2< T >& A, |
Calculate the cross product of two vectors. | |
| void | |||
| T | Distance between two 2D points. | ||
| T | DistSquared
(
const TVector2< T >& V1, |
Squared distance between two 2D points. | |
| T | Get the dot product of this vector against another. | ||
| T | DotProduct
(
const TVector2< T >& A, |
Calculates the dot product of two vectors. | |
| bool | Checks for equality with error-tolerant comparison. | ||
| TVector2< T > | GetAbs () |
Get a copy of this vector with absolute value of each component. | |
| T | GetAbsMax () |
Get the maximum absolute value of the vector's components. | |
| T | GetMax () |
Get the maximum value of the vector's components. | |
| T | GetMin () |
Get the minimum value of the vector's components. | |
| TVector2< T > | GetRotated
(
T AngleDeg |
Rotates around axis (0,0,1) | |
| TVector2< T > | GetSafeNormal
(
T Tolerance |
Gets a normalized copy of the vector, checking it is safe to do so based on the length. | |
| TVector2< T > | Get a copy of the vector as sign only. | ||
| bool | InitFromString
(
const FString& InSourceString |
Initialize this Vector based on an FString. | |
| FIntPoint | IntPoint () |
Get this vector as an Int Point. | |
| bool | IsNearlyZero
(
T Tolerance |
Checks whether vector is near to zero within a specified tolerance. | |
| bool | IsZero () |
Checks whether all components of the vector are exactly zero. | |
| T | Length () |
Get the length (magnitude) of this vector. | |
| TVector2< T > | Returns a vector with the maximum component for each dimension from the pair of vectors. | ||
| TVector2< T > | Returns a vector with the minimum component for each dimension from the pair of vectors. | ||
| bool | NetSerialize
(
FArchive& Ar, |
Network serialization function. | |
| bool | Normalize
(
T Tolerance |
Normalize this vector in-place if it is large enough, set it to (0,0) otherwise. | |
| TVector2< T > | One () |
||
| TVector2< T > | Get this vector as a vector where each component has been rounded to the nearest int. | ||
| bool | Serialize
(
FStructuredArchive::FSlot Slot |
||
| bool | |||
| bool | SerializeFromMismatchedTag
(
FName StructTag, |
||
| void | Set
(
T InX, |
Set the values of the vector directly. | |
| T | Size () |
Get the length (magnitude) of this vector. | |
| T | SizeSquared () |
Get the squared length of this vector. | |
| TVector< T > | Converts spherical coordinates on the unit sphere into a Cartesian unit length vector. | ||
| T | Get the squared length of this vector. | ||
| void | ToDirectionAndLength
(
TVector2< T >& OutDir, |
Util to convert this vector into a unit direction vector and its original length. | |
| void | ToDirectionAndLength
(
TVector2< T >& OutDir, |
Util to convert this vector into a unit direction vector and its original length. | |
| FString | ToString () |
Get a textual representation of the vector. | |
| TVector2< T > | UnitX () |
||
| TVector2< T > | UnitY () |
||
| TVector2< T > | Zero () |
Operators
| Type | Name | Description | |
|---|---|---|---|
| TVector2< T > | operator- () |
Gets a negated copy of the vector. | |
| TVector2< T > | Gets the result of subtracting a vector from this one. | ||
| TVector2< T > | operator-
(
T A |
Gets the result of subtracting A from each component of the vector. | |
| bool | operator!=
(
const TVector2< T >& V |
Compares this vector against another for inequality. | |
| TVector2< T > | operator*
(
T Scale |
Gets the result of scaling the vector (multiplying each component by a value). | |
| TVector2< T > | Gets the result of component-wise multiplication of this vector by another. | ||
| TVector2< T > | operator*=
(
T Scale |
Scales this vector. | |
| TVector2< T > | operator*=
(
const TVector2< T >& V |
Multiplies this vector with another vector, using component-wise multiplication. | |
| TVector2< T > | operator/
(
T Scale |
Gets the result of dividing each component of the vector by a value. | |
| TVector2< T > | Gets the result of component-wise division of this vector by another. | ||
| TVector2< T > | operator/=
(
T V |
Divides this vector. | |
| TVector2< T > | operator/=
(
const TVector2< T >& V |
Divides this vector by another vector, using component-wise division. | |
| T | operator[]
(
int32 Index |
Gets specific component of the vector. | |
| T & | operator[]
(
int32 Index |
Gets specific component of the vector. | |
| T | Calculates cross product of this vector and another. | ||
| T | Calculates dot product of this vector and another. | ||
| TVector2< T > | Gets the result of adding two vectors together. | ||
| TVector2< T > | operator+
(
T A |
Gets the result of adding A to each component of the vector. | |
| TVector2< T > | operator+=
(
const TVector2< T >& V |
Adds another vector to this. | |
| TVector2< T > | operator-=
(
const TVector2< T >& V |
Subtracts another vector from this. | |
| bool | operator==
(
const TVector2< T >& V |
Compares this vector against another for equality. |
Typedefs
| Name | Description |
|---|---|
| FReal |
Constants
| 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) |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | TVector2 comparison operators are deprecated. Use ComponentwiseAllLessThan. For componentwise min/max/abs, use TVector2::{Min,Max,GetAbs}, FMath::{Min,Max,Abs} compute something different. | ||
| bool | operator<=
(
const TVector2< T >& Other |
TVector2 comparison operators are deprecated. Use ComponentwiseAllLessOrEqual. For componentwise min/max/abs, use TVector2::{Min,Max,GetAbs}, FMath::{Min,Max,Abs} compute something different. | |
| bool | TVector2 comparison operators are deprecated. Use ComponentwiseAllGreaterThan. For componentwise min/max/abs, use TVector2::{Min,Max,GetAbs}, FMath::{Min,Max,Abs} compute something different. | ||
| bool | operator>=
(
const TVector2< T >& Other |
TVector2 comparison operators are deprecated. Use ComponentwiseAllGreaterOrEqual. For componentwise min/max/abs, use TVector2::{Min,Max,GetAbs}, FMath::{Min,Max,Abs} compute something different. |