Ark Server API (ASA) - Wiki
|
#include <Vector2D.h>
Public Types | |
using | FReal = T |
Static Public Member Functions | |
static TVector2< T > | Zero () |
static TVector2< T > | One () |
static TVector2< T > | UnitX () |
static TVector2< T > | UnitY () |
static FORCEINLINE T | DotProduct (const TVector2< T > &A, const TVector2< T > &B) |
static FORCEINLINE T | DistSquared (const TVector2< T > &V1, const TVector2< T > &V2) |
static FORCEINLINE T | Distance (const TVector2< T > &V1, const TVector2< T > &V2) |
static FORCEINLINE T | CrossProduct (const TVector2< T > &A, const TVector2< T > &B) |
static FORCEINLINE TVector2< T > | Max (const TVector2< T > &A, const TVector2< T > &B) |
static FORCEINLINE TVector2< T > | Min (const TVector2< T > &A, const TVector2< T > &B) |
Public Attributes | ||
union { | ||
struct { | ||
T X | ||
T Y | ||
} | ||
T XY [2] | ||
}; | ||
Static Public Attributes | |
static const TVector2< T > | ZeroVector |
static const TVector2< T > | UnitVector |
static const TVector2< T > | Unit45Deg |
Definition at line 31 of file Vector2D.h.
Definition at line 36 of file Vector2D.h.
|
inline |
Default constructor (no initialization).
Definition at line 78 of file Vector2D.h.
FORCEINLINE UE::Math::TVector2< T >::TVector2 | ( | T | InX, |
T | InY ) |
Constructor using initial values for each component.
InX | X coordinate. |
InY | Y coordinate. |
Definition at line 811 of file Vector2D.h.
|
explicit |
Constructor initializing both components to a single T value.
InF | Value to set both components to. |
Definition at line 816 of file Vector2D.h.
FORCEINLINE UE::Math::TVector2< T >::TVector2 | ( | TIntPoint< IntType > | InPos | ) |
Constructs a vector from an FIntPoint.
InPos | Integer point used to set this vector. |
Definition at line 822 of file Vector2D.h.
|
explicit |
Constructor which initializes all components to zero.
EForceInit | Force init enum |
Definition at line 829 of file Vector2D.h.
|
inlineexplicit |
Constructor that does not initialize. More explicit than the default constructor.
ENoInit | Don't init |
Definition at line 115 of file Vector2D.h.
|
explicit |
|
explicit |
|
inlineexplicit |
Definition at line 706 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::ClampAxes | ( | T | MinAxisVal, |
T | MaxAxisVal ) const |
Creates a copy of this vector with both axes clamped to the given range.
Definition at line 1209 of file Vector2D.h.
FORCEINLINE T & UE::Math::TVector2< T >::Component | ( | int32 | Index | ) |
Gets a specific component of the vector.
Index | The index of the component required. |
Definition at line 1166 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::Component | ( | int32 | Index | ) | const |
Gets a specific component of the vector.
Index | The index of the component required. |
Definition at line 1174 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::ComponentwiseAllGreaterOrEqual | ( | const TVector2< T > & | Other | ) | const |
Checks whether both components of this vector are greater than or equal to another.
Other | The vector to compare against. |
Definition at line 962 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::ComponentwiseAllGreaterThan | ( | const TVector2< T > & | Other | ) | const |
Checks whether both components of this vector are greater than another.
Other | The vector to compare against. |
Definition at line 950 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::ComponentwiseAllLessOrEqual | ( | const TVector2< T > & | Other | ) | const |
Checks whether both components of this vector are less than or equal to another.
Other | The vector to compare against. |
Definition at line 956 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::ComponentwiseAllLessThan | ( | const TVector2< T > & | Other | ) | const |
Checks whether both components of this vector are less than another.
Other | The vector to compare against. |
Definition at line 944 of file Vector2D.h.
|
inline |
Utility to check if there are any non-finite values (NaN or Inf) in this vector.
Definition at line 669 of file Vector2D.h.
|
static |
Calculate the cross product of two vectors.
A | The first vector. |
B | The second vector. |
Definition at line 914 of file Vector2D.h.
|
inline |
Definition at line 661 of file Vector2D.h.
|
static |
Distance between two 2D points.
V1 | The first point. |
V2 | The second point. |
Definition at line 908 of file Vector2D.h.
|
static |
Squared distance between two 2D points.
V1 | The first point. |
V2 | The second point. |
Definition at line 902 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::Dot | ( | const TVector2< T > & | V2 | ) | const |
Get the dot product of this vector against another.
V2 | The vector to measure dot product against. |
Definition at line 1074 of file Vector2D.h.
|
static |
Calculates the dot product of two vectors.
A | The first vector. |
B | The second vector. |
Definition at line 896 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::Equals | ( | const TVector2< T > & | V, |
T | Tolerance = UE_KINDA_SMALL_NUMBER ) const |
Checks for equality with error-tolerant comparison.
V | The vector to compare. |
Tolerance | Error tolerance. |
Definition at line 968 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::GetAbs | ( | ) | const |
Get a copy of this vector with absolute value of each component.
Definition at line 1225 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::GetAbsMax | ( | ) | const |
Get the maximum absolute value of the vector's components.
Definition at line 1050 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::GetMax | ( | ) | const |
Get the maximum value of the vector's components.
Definition at line 1044 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::GetMin | ( | ) | const |
Get the minimum value of the vector's components.
Definition at line 1056 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::GetRotated | ( | T | AngleDeg | ) | const |
Rotates around axis (0,0,1)
AngleDeg | Angle to rotate (in degrees) |
Definition at line 1080 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::GetSafeNormal | ( | T | Tolerance = UE_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.
Tolerance | Minimum squared length of vector for normalization. |
Definition at line 1095 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::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.
A | copy of the vector with each component set to +1 or -1 |
Definition at line 1215 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::InitFromString | ( | const FString & | InSourceString | ) |
Initialize this Vector based on an FString. The String is expected to contain X=, Y=. The TVector2<T> will be bogus when InitFromString returns false.
InSourceString | FString containing the vector values. |
Definition at line 1237 of file Vector2D.h.
FORCEINLINE FIntPoint UE::Math::TVector2< T >::IntPoint | ( | ) | const |
Get this vector as an Int Point.
Definition at line 1182 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::IsNearlyZero | ( | T | Tolerance = UE_KINDA_SMALL_NUMBER | ) | const |
Checks whether vector is near to zero within a specified tolerance.
Tolerance | Error tolerance. |
Definition at line 1153 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::IsZero | ( | ) | const |
Checks whether all components of the vector are exactly zero.
Definition at line 1160 of file Vector2D.h.
|
inline |
Get the length (magnitude) of this vector.
Definition at line 509 of file Vector2D.h.
|
static |
Returns a vector with the maximum component for each dimension from the pair of vectors.
A | The first vector. |
B | The second vector. |
Definition at line 920 of file Vector2D.h.
|
static |
Returns a vector with the minimum component for each dimension from the pair of vectors.
A | The first vector. |
B | The second vector. |
Definition at line 926 of file Vector2D.h.
|
inline |
Network serialization function. FVectors NetSerialize without quantization (ie exact values are serialized).
Definition at line 679 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::Normalize | ( | T | Tolerance = UE_SMALL_NUMBER | ) |
Normalize this vector in-place if it is large enough, set it to (0,0) otherwise. (Note this is different from TVector<>::Normalize, which leaves the vector unchanged if it is too small to normalize.)
Tolerance | Minimum squared length of vector for normalization. |
Definition at line 1107 of file Vector2D.h.
Definition at line 71 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::operator!= | ( | const TVector2< T > & | V | ) | const |
Compares this vector against another for inequality.
V | The vector to compare against. |
Definition at line 938 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator* | ( | const TVector2< T > & | V | ) | const |
Gets the result of component-wise multiplication of this vector by another.
V | The other vector to multiply this by. |
Definition at line 872 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator* | ( | T | Scale | ) | const |
Gets the result of scaling the vector (multiplying each component by a value).
Scale | How much to scale the vector by. |
Definition at line 847 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator*= | ( | const TVector2< T > & | V | ) |
Multiplies this vector with another vector, using component-wise multiplication.
V | The vector to multiply with. |
Definition at line 1009 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator*= | ( | T | Scale | ) |
Scales this vector.
Scale | The scale to multiply vector by. |
Definition at line 994 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator+ | ( | const TVector2< T > & | V | ) | const |
Gets the result of adding two vectors together.
V | The other vector to add to this. |
Definition at line 835 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator+ | ( | T | A | ) | const |
Gets the result of adding A to each component of the vector.
A | T to add to each component. |
Definition at line 860 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator+= | ( | const TVector2< T > & | V | ) |
Adds another vector to this.
V | The other vector to add. |
Definition at line 980 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator- | ( | ) | const |
Gets a negated copy of the vector.
Definition at line 974 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator- | ( | const TVector2< T > & | V | ) | const |
Gets the result of subtracting a vector from this one.
V | The other vector to subtract from this. |
Definition at line 841 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator- | ( | T | A | ) | const |
Gets the result of subtracting A from each component of the vector.
A | T to subtract from each component |
Definition at line 866 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator-= | ( | const TVector2< T > & | V | ) |
Subtracts another vector from this.
V | The other vector to subtract. |
Definition at line 987 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator/ | ( | const TVector2< T > & | V | ) | const |
Gets the result of component-wise division of this vector by another.
V | The other vector to divide this by. |
Definition at line 878 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator/ | ( | T | Scale | ) | const |
Gets the result of dividing each component of the vector by a value.
Scale | How much to divide the vector by. |
Definition at line 853 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator/= | ( | const TVector2< T > & | V | ) |
Divides this vector by another vector, using component-wise division.
V | The vector to divide by. |
Definition at line 1016 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::operator/= | ( | T | V | ) |
Divides this vector.
V | What to divide vector by. |
Definition at line 1001 of file Vector2D.h.
|
inline |
Deprecated comparison operator. Use ComponentwiseAllLessThan.
Other | The vector to compare against. |
Definition at line 240 of file Vector2D.h.
|
inline |
Deprecated comparison operator. Use ComponentwiseAllLessOrEqual.
Other | The vector to compare against. |
Definition at line 264 of file Vector2D.h.
FORCEINLINE bool UE::Math::TVector2< T >::operator== | ( | const TVector2< T > & | V | ) | const |
Compares this vector against another for equality.
V | The vector to compare against. |
Definition at line 932 of file Vector2D.h.
|
inline |
Deprecated comparison operator. Use ComponentwiseAllGreaterThan.
Other | The vector to compare against. |
Definition at line 252 of file Vector2D.h.
|
inline |
Deprecated comparison operator. Use ComponentwiseAllGreaterOrEqual.
Other | The vector to compare against. |
Definition at line 276 of file Vector2D.h.
FORCEINLINE T & UE::Math::TVector2< T >::operator[] | ( | int32 | Index | ) |
Gets specific component of the vector.
Index | the index of vector component |
Definition at line 1023 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::operator[] | ( | int32 | Index | ) | const |
Gets specific component of the vector.
Index | the index of vector component |
Definition at line 1030 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::operator^ | ( | const TVector2< T > & | V | ) | const |
Calculates cross product of this vector and another.
V | The other vector. |
Definition at line 890 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::operator| | ( | const TVector2< T > & | V | ) | const |
Calculates dot product of this vector and another.
V | The other vector. |
Definition at line 884 of file Vector2D.h.
FORCEINLINE TVector2< T > UE::Math::TVector2< T >::RoundToVector | ( | ) | const |
Get this vector as a vector where each component has been rounded to the nearest int.
Definition at line 1196 of file Vector2D.h.
Definition at line 637 of file Vector2D.h.
|
inline |
Definition at line 643 of file Vector2D.h.
Definition at line 1260 of file Vector2D.h.
FORCEINLINE void UE::Math::TVector2< T >::Set | ( | T | InX, |
T | InY ) |
Set the values of the vector directly.
InX | New X coordinate. |
InY | New Y coordinate. |
Definition at line 1037 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::Size | ( | ) | const |
Get the length (magnitude) of this vector.
Definition at line 1062 of file Vector2D.h.
FORCEINLINE T UE::Math::TVector2< T >::SizeSquared | ( | ) | const |
Get the squared length of this vector.
Definition at line 1068 of file Vector2D.h.
|
inline |
|
inline |
Get the squared length of this vector.
Definition at line 525 of file Vector2D.h.
FORCEINLINE void UE::Math::TVector2< T >::ToDirectionAndLength | ( | TVector2< T > & | OutDir, |
double & | OutLength ) const |
Util to convert this vector into a unit direction vector and its original length.
OutDir | Reference passed in to store unit direction vector. |
OutLength | Reference passed in to store length of the vector. |
Definition at line 1123 of file Vector2D.h.
FORCEINLINE void UE::Math::TVector2< T >::ToDirectionAndLength | ( | TVector2< T > & | OutDir, |
float & | OutLength ) const |
Definition at line 1138 of file Vector2D.h.
FORCEINLINE FString UE::Math::TVector2< T >::ToString | ( | ) | const |
Get a textual representation of the vector.
Definition at line 1231 of file Vector2D.h.
Definition at line 72 of file Vector2D.h.
Definition at line 73 of file Vector2D.h.
Definition at line 70 of file Vector2D.h.
union { ... } UE::Math::TVector2< T > |
Global 2D unit vector constant along the 45 degree angle or symmetrical positive axes (sqrt(.5),sqrt(.5)) or (.707,.707). https://en.wikipedia.org/wiki/Unit_vector
UnitVector
above is actually a value with axes of 1 rather than a magnitude of one. Definition at line 68 of file Vector2D.h.
Global 2D one vector (poorly named) constant (1,1).
Unit45Deg
below for an actual unit vector. Definition at line 61 of file Vector2D.h.
T UE::Math::TVector2< T >::X |
Vector's X component.
Definition at line 43 of file Vector2D.h.
T UE::Math::TVector2< T >::XY[2] |
Definition at line 50 of file Vector2D.h.
T UE::Math::TVector2< T >::Y |
Vector's Y component.
Definition at line 46 of file Vector2D.h.
Global 2D zero vector constant (0,0)
Definition at line 54 of file Vector2D.h.