A vector in 2-D space composed of components (X, Y) with floating point precision. 更多...
#include <Vector2D.h>
被 Chaos::TVector< float, 2 > 继承.
Public 成员函数 | |
| FVector2D | ClampAxes (float MinAxisVal, float MaxAxisVal) const |
| Creates a copy of this vector with both axes clamped to the given range. 更多... | |
| float & | Component (int32 Index) |
| Gets a specific component of the vector. 更多... | |
| float | Component (int32 Index) const |
| Gets a specific component of the vector. 更多... | |
| FORCEINLINE bool | ContainsNaN () const |
| Utility to check if there are any non-finite values (NaN or Inf) in this vector. 更多... | |
| bool | Equals (const FVector2D &V, float Tolerance=KINDA_SMALL_NUMBER) const |
| Checks for equality with error-tolerant comparison. 更多... | |
| FORCEINLINE | FVector2D () |
| Default constructor (no initialization). | |
| FORCEINLINE | FVector2D (const FVector &V) |
| Constructs a vector from an FVector. 更多... | |
| FORCEINLINE | FVector2D (const FVector4 &V) |
| Constructs a vector from an FVector4. 更多... | |
| FORCEINLINE | FVector2D (EForceInit) |
| Constructor which initializes all components to zero. 更多... | |
| FORCEINLINE | FVector2D (ENoInit) |
| Constructor that does not initialize. 更多... | |
| FORCEINLINE | FVector2D (FIntPoint InPos) |
| Constructs a vector from an FIntPoint. 更多... | |
| FORCEINLINE | FVector2D (float InF) |
| Constructor initializing both components to a single float value. 更多... | |
| FORCEINLINE | FVector2D (float InX, float InY) |
| Constructor using initial values for each component. 更多... | |
| FORCEINLINE FVector2D | GetAbs () const |
| Get a copy of this vector with absolute value of each component. 更多... | |
| float | GetAbsMax () const |
| Get the maximum absolute value of the vector's components. 更多... | |
| float | GetMax () const |
| Get the maximum value of the vector's components. 更多... | |
| float | GetMin () const |
| Get the minimum value of the vector's components. 更多... | |
| FVector2D | GetRotated (float AngleDeg) const |
| Rotates around axis (0,0,1) 更多... | |
| 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. 更多... | |
| FORCEINLINE FVector2D | GetSignVector () const |
| Get a copy of the vector as sign only. 更多... | |
| bool | InitFromString (const FString &InSourceString) |
| Initialize this Vector based on an FString. 更多... | |
| FIntPoint | IntPoint () const |
| Get this vector as an Int Point. 更多... | |
| bool | IsNearlyZero (float Tolerance=KINDA_SMALL_NUMBER) const |
| Checks whether vector is near to zero within a specified tolerance. 更多... | |
| bool | IsZero () const |
| Checks whether all components of the vector are exactly zero. 更多... | |
| CORE_API bool | NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess) |
| Network serialization function. 更多... | |
| void | Normalize (float Tolerance=SMALL_NUMBER) |
| Normalize this vector in-place if it is large enough, set it to (0,0) otherwise. 更多... | |
| bool | operator!= (const FVector2D &V) const |
| Compares this vector against another for inequality. 更多... | |
| FORCEINLINE FVector2D | operator* (const FVector2D &V) const |
| Gets the result of component-wise multiplication of this vector by another. 更多... | |
| FORCEINLINE FVector2D | operator* (float Scale) const |
| Gets the result of scaling the vector (multiplying each component by a value). 更多... | |
| FVector2D | operator*= (const FVector2D &V) |
| Multiplies this vector with another vector, using component-wise multiplication. 更多... | |
| FORCEINLINE FVector2D | operator*= (float Scale) |
| Scales this vector. 更多... | |
| FORCEINLINE FVector2D | operator+ (const FVector2D &V) const |
| Gets the result of adding two vectors together. 更多... | |
| FORCEINLINE FVector2D | operator+ (float A) const |
| Gets the result of adding A to each component of the vector. 更多... | |
| FORCEINLINE FVector2D | operator+= (const FVector2D &V) |
| Adds another vector to this. 更多... | |
| FORCEINLINE FVector2D | operator- () const |
| Gets a negated copy of the vector. 更多... | |
| FORCEINLINE FVector2D | operator- (const FVector2D &V) const |
| Gets the result of subtracting a vector from this one. 更多... | |
| FORCEINLINE FVector2D | operator- (float A) const |
| Gets the result of subtracting A from each component of the vector. 更多... | |
| FORCEINLINE FVector2D | operator-= (const FVector2D &V) |
| Subtracts another vector from this. 更多... | |
| FVector2D | operator/ (const FVector2D &V) const |
| Gets the result of component-wise division of this vector by another. 更多... | |
| FVector2D | operator/ (float Scale) const |
| Gets the result of dividing each component of the vector by a value. 更多... | |
| FVector2D | operator/= (const FVector2D &V) |
| Divides this vector by another vector, using component-wise division. 更多... | |
| FVector2D | operator/= (float V) |
| Divides this vector. 更多... | |
| bool | operator< (const FVector2D &Other) const |
| Checks whether both components of this vector are less than another. 更多... | |
| bool | operator<= (const FVector2D &Other) const |
| Checks whether both components of this vector are less than or equal to another. 更多... | |
| bool | operator== (const FVector2D &V) const |
| Compares this vector against another for equality. 更多... | |
| bool | operator> (const FVector2D &Other) const |
| Checks whether both components of this vector are greater than another. 更多... | |
| bool | operator>= (const FVector2D &Other) const |
| Checks whether both components of this vector are greater than or equal to another. 更多... | |
| float & | operator[] (int32 Index) |
| Gets specific component of the vector. 更多... | |
| float | operator[] (int32 Index) const |
| Gets specific component of the vector. 更多... | |
| FORCEINLINE float | operator^ (const FVector2D &V) const |
| Calculates cross product of this vector and another. 更多... | |
| FORCEINLINE float | operator| (const FVector2D &V) const |
| Calculates dot product of this vector and another. 更多... | |
| FVector2D | RoundToVector () const |
| Get this vector as a vector where each component has been rounded to the nearest int. 更多... | |
| void | Set (float InX, float InY) |
| Set the values of the vector directly. 更多... | |
| float | Size () const |
| Get the length (magnitude) of this vector. 更多... | |
| float | SizeSquared () const |
| Get the squared length of this vector. 更多... | |
| FVector | SphericalToUnitCartesian () const |
| Converts spherical coordinates on the unit sphere into a Cartesian unit length vector. | |
| void | ToDirectionAndLength (FVector2D &OutDir, float &OutLength) const |
| Util to convert this vector into a unit direction vector and its original length. 更多... | |
| FString | ToString () const |
| Get a textual representation of the vector. 更多... | |
静态 Public 成员函数 | |
| static FORCEINLINE float | CrossProduct (const FVector2D &A, const FVector2D &B) |
| Calculate the cross product of two vectors. 更多... | |
| static FORCEINLINE float | Distance (const FVector2D &V1, const FVector2D &V2) |
| Distance between two 2D points. 更多... | |
| static FORCEINLINE float | DistSquared (const FVector2D &V1, const FVector2D &V2) |
| Squared distance between two 2D points. 更多... | |
| static FORCEINLINE float | DotProduct (const FVector2D &A, const FVector2D &B) |
| Calculates the dot product of two vectors. 更多... | |
| static FORCEINLINE FVector2D | Max (const FVector2D &A, const FVector2D &B) |
| Returns a vector with the maximum component for each dimension from the pair of vectors. 更多... | |
| static FORCEINLINE FVector2D | Min (const FVector2D &A, const FVector2D &B) |
| Returns a vector with the minimum component for each dimension from the pair of vectors. 更多... | |
Public 属性 | |
| float | X |
| Vector's X component. | |
| float | Y |
| Vector's Y component. | |
静态 Public 属性 | |
| static CORE_API const FVector2D | Unit45Deg |
| Global 2D unit vector constant along the 45 degree angle or symmetrical positive axes (sqrt(.5),sqrt(.5)) or (.707,.707). 更多... | |
| static CORE_API const FVector2D | UnitVector |
| Global 2D one vector (poorly named) constant (1,1). 更多... | |
| static CORE_API const FVector2D | ZeroVector |
| Global 2D zero vector constant (0,0) | |
友元 | |
| FArchive & | operator<< (FArchive &Ar, FVector2D &V) |
| Serialize a vector. 更多... | |
A vector in 2-D space composed of components (X, Y) with floating point precision.
| FORCEINLINE FVector2D::FVector2D | ( | float | InX, |
| float | InY | ||
| ) |
Constructor using initial values for each component.
| InX | X coordinate. |
| InY | Y coordinate. |
|
explicit |
Constructor initializing both components to a single float value.
| InF | Value to set both components to. |
| FORCEINLINE FVector2D::FVector2D | ( | FIntPoint | InPos | ) |
Constructs a vector from an FIntPoint.
| InPos | Integer point used to set this vector. |
|
explicit |
Constructor which initializes all components to zero.
| EForceInit | Force init enum |
|
inlineexplicit |
Constructor that does not initialize.
More explicit than the default constructor.
| ENoInit | Don't init |
|
explicit |
|
explicit |
Constructs a vector from an FVector4.
Copies the X and Y components from the FVector4.
| V | Vector to copy from. |
| FORCEINLINE FVector2D FVector2D::ClampAxes | ( | float | MinAxisVal, |
| float | MaxAxisVal | ||
| ) | const |
Creates a copy of this vector with both axes clamped to the given range.
| FORCEINLINE float & FVector2D::Component | ( | int32 | Index | ) |
Gets a specific component of the vector.
| Index | The index of the component required. |
| FORCEINLINE float FVector2D::Component | ( | int32 | Index | ) | const |
Gets a specific component of the vector.
| Index | The index of the component required. |
|
inline |
Utility to check if there are any non-finite values (NaN or Inf) in this vector.
Calculate the cross product of two vectors.
| A | The first vector. |
| B | The second vector. |
Distance between two 2D points.
| V1 | The first point. |
| V2 | The second point. |
Squared distance between two 2D points.
| V1 | The first point. |
| V2 | The second point. |
Calculates the dot product of two vectors.
| A | The first vector. |
| B | The second vector. |
| FORCEINLINE bool FVector2D::Equals | ( | const FVector2D & | V, |
| float | Tolerance = KINDA_SMALL_NUMBER |
||
| ) | const |
Checks for equality with error-tolerant comparison.
| V | The vector to compare. |
| Tolerance | Error tolerance. |
| FORCEINLINE FVector2D FVector2D::GetAbs | ( | ) | const |
Get a copy of this vector with absolute value of each component.
| FORCEINLINE float FVector2D::GetAbsMax | ( | ) | const |
Get the maximum absolute value of the vector's components.
| FORCEINLINE float FVector2D::GetMax | ( | ) | const |
Get the maximum value of the vector's components.
| FORCEINLINE float FVector2D::GetMin | ( | ) | const |
Get the minimum value of the vector's components.
| FORCEINLINE FVector2D FVector2D::GetRotated | ( | float | AngleDeg | ) | const |
Rotates around axis (0,0,1)
| AngleDeg | Angle to rotate (in degrees) |
| 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.
| Tolerance | Minimum squared length of vector for normalization. |
| 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.
| A | copy of the vector with each component set to +1 or -1 |
| FORCEINLINE bool FVector2D::InitFromString | ( | const FString & | InSourceString | ) |
| FORCEINLINE FIntPoint FVector2D::IntPoint | ( | ) | const |
Get this vector as an Int Point.
| FORCEINLINE bool FVector2D::IsNearlyZero | ( | float | Tolerance = KINDA_SMALL_NUMBER | ) | const |
Checks whether vector is near to zero within a specified tolerance.
| Tolerance | Error tolerance. |
| FORCEINLINE bool FVector2D::IsZero | ( | ) | const |
Checks whether all components of the vector are exactly zero.
Returns a vector with the maximum component for each dimension from the pair of vectors.
| A | The first vector. |
| B | The second vector. |
Returns a vector with the minimum component for each dimension from the pair of vectors.
| A | The first vector. |
| B | The second vector. |
| CORE_API bool FVector2D::NetSerialize | ( | FArchive & | Ar, |
| class UPackageMap * | Map, | ||
| bool & | bOutSuccess | ||
| ) |
Network serialization function.
FVectors NetSerialize without quantization (ie exact values are serialized).
| FORCEINLINE void FVector2D::Normalize | ( | float | Tolerance = SMALL_NUMBER | ) |
Normalize this vector in-place if it is large enough, set it to (0,0) otherwise.
| Tolerance | Minimum squared length of vector for normalization. |
| FORCEINLINE bool FVector2D::operator!= | ( | const FVector2D & | V | ) | const |
Compares this vector against another for inequality.
| V | The vector to compare against. |
Gets the result of component-wise multiplication of this vector by another.
| V | The other vector to multiply this by. |
| FORCEINLINE FVector2D FVector2D::operator* | ( | float | Scale | ) | const |
Gets the result of scaling the vector (multiplying each component by a value).
| Scale | How much to scale the vector by. |
Multiplies this vector with another vector, using component-wise multiplication.
| V | The vector to multiply with. |
| FORCEINLINE FVector2D FVector2D::operator*= | ( | float | Scale | ) |
Scales this vector.
| Scale | The scale to multiply vector by. |
Gets the result of adding two vectors together.
| V | The other vector to add to this. |
| FORCEINLINE FVector2D FVector2D::operator+ | ( | float | A | ) | const |
Gets the result of adding A to each component of the vector.
| A | Float to add to each component. |
Adds another vector to this.
| V | The other vector to add. |
| FORCEINLINE FVector2D FVector2D::operator- | ( | ) | const |
Gets a negated copy of the vector.
Gets the result of subtracting a vector from this one.
| V | The other vector to subtract from this. |
| FORCEINLINE FVector2D FVector2D::operator- | ( | float | A | ) | const |
Gets the result of subtracting A from each component of the vector.
| A | Float to subtract from each component |
Subtracts another vector from this.
| V | The other vector to subtract. |
Gets the result of component-wise division of this vector by another.
| V | The other vector to divide this by. |
| FORCEINLINE FVector2D FVector2D::operator/ | ( | float | Scale | ) | const |
Gets the result of dividing each component of the vector by a value.
| Scale | How much to divide the vector by. |
Divides this vector by another vector, using component-wise division.
| V | The vector to divide by. |
| FORCEINLINE FVector2D FVector2D::operator/= | ( | float | V | ) |
Divides this vector.
| V | What to divide vector by. |
| FORCEINLINE bool FVector2D::operator< | ( | const FVector2D & | Other | ) | const |
Checks whether both components of this vector are less than another.
| Other | The vector to compare against. |
| FORCEINLINE bool FVector2D::operator<= | ( | const FVector2D & | Other | ) | const |
Checks whether both components of this vector are less than or equal to another.
| Other | The vector to compare against. |
| FORCEINLINE bool FVector2D::operator== | ( | const FVector2D & | V | ) | const |
Compares this vector against another for equality.
| V | The vector to compare against. |
| FORCEINLINE bool FVector2D::operator> | ( | const FVector2D & | Other | ) | const |
Checks whether both components of this vector are greater than another.
| Other | The vector to compare against. |
| FORCEINLINE bool FVector2D::operator>= | ( | const FVector2D & | Other | ) | const |
Checks whether both components of this vector are greater than or equal to another.
| Other | The vector to compare against. |
| FORCEINLINE float & FVector2D::operator[] | ( | int32 | Index | ) |
Gets specific component of the vector.
| Index | the index of vector component |
| FORCEINLINE float FVector2D::operator[] | ( | int32 | Index | ) | const |
Gets specific component of the vector.
| Index | the index of vector component |
| FORCEINLINE float FVector2D::operator^ | ( | const FVector2D & | V | ) | const |
Calculates cross product of this vector and another.
| V | The other vector. |
| FORCEINLINE float FVector2D::operator| | ( | const FVector2D & | V | ) | const |
Calculates dot product of this vector and another.
| V | The other vector. |
| FORCEINLINE FVector2D FVector2D::RoundToVector | ( | ) | const |
Get this vector as a vector where each component has been rounded to the nearest int.
| FORCEINLINE void FVector2D::Set | ( | float | InX, |
| float | InY | ||
| ) |
Set the values of the vector directly.
| InX | New X coordinate. |
| InY | New Y coordinate. |
| FORCEINLINE float FVector2D::Size | ( | ) | const |
Get the length (magnitude) of this vector.
| FORCEINLINE float FVector2D::SizeSquared | ( | ) | const |
Get the squared length of this vector.
| FORCEINLINE void FVector2D::ToDirectionAndLength | ( | FVector2D & | OutDir, |
| float & | 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. |
| FORCEINLINE FString FVector2D::ToString | ( | ) | const |
Get a textual representation of the vector.
Serialize a vector.
| Ar | Serialization archive. |
| V | Vector being serialized. |
|
static |
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.
|
static |
Global 2D one vector (poorly named) constant (1,1).
Unit45Deg below for an actual unit vector.