engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | 静态 Public 属性 | 友元 | 所有成员列表
FVector2D结构体 参考

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.

示例
/github/workspace/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

构造及析构函数说明

◆ FVector2D() [1/7]

FORCEINLINE FVector2D::FVector2D ( float  InX,
float  InY 
)

Constructor using initial values for each component.

参数
InXX coordinate.
InYY coordinate.

◆ FVector2D() [2/7]

FORCEINLINE FVector2D::FVector2D ( float  InF)
explicit

Constructor initializing both components to a single float value.

参数
InFValue to set both components to.

◆ FVector2D() [3/7]

FORCEINLINE FVector2D::FVector2D ( FIntPoint  InPos)

Constructs a vector from an FIntPoint.

参数
InPosInteger point used to set this vector.

◆ FVector2D() [4/7]

FORCEINLINE FVector2D::FVector2D ( EForceInit  )
explicit

Constructor which initializes all components to zero.

参数
EForceInitForce init enum

◆ FVector2D() [5/7]

FORCEINLINE FVector2D::FVector2D ( ENoInit  )
inlineexplicit

Constructor that does not initialize.

More explicit than the default constructor.

参数
ENoInitDon't init

◆ FVector2D() [6/7]

FORCEINLINE FVector2D::FVector2D ( const FVector &  V)
explicit

Constructs a vector from an FVector.

Copies the X and Y components from the FVector.

参数
VVector to copy from.

◆ FVector2D() [7/7]

FORCEINLINE FVector2D::FVector2D ( const FVector4 &  V)
explicit

Constructs a vector from an FVector4.

Copies the X and Y components from the FVector4.

参数
VVector to copy from.

成员函数说明

◆ ClampAxes()

FORCEINLINE FVector2D FVector2D::ClampAxes ( float  MinAxisVal,
float  MaxAxisVal 
) const

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

返回
New vector with clamped axes.

◆ Component() [1/2]

FORCEINLINE float & FVector2D::Component ( int32  Index)

Gets a specific component of the vector.

参数
IndexThe index of the component required.
返回
Reference to the specified component.

◆ Component() [2/2]

FORCEINLINE float FVector2D::Component ( int32  Index) const

Gets a specific component of the vector.

参数
IndexThe index of the component required.
返回
Copy of the specified component.

◆ ContainsNaN()

FORCEINLINE bool FVector2D::ContainsNaN ( ) const
inline

Utility to check if there are any non-finite values (NaN or Inf) in this vector.

返回
true if there are any non-finite values in this vector, false otherwise.

◆ CrossProduct()

FORCEINLINE float FVector2D::CrossProduct ( const FVector2D &  A,
const FVector2D &  B 
)
static

Calculate the cross product of two vectors.

参数
AThe first vector.
BThe second vector.
返回
The cross product.

◆ Distance()

FORCEINLINE float FVector2D::Distance ( const FVector2D &  V1,
const FVector2D &  V2 
)
static

Distance between two 2D points.

参数
V1The first point.
V2The second point.
返回
The distance between two 2D points.

◆ DistSquared()

FORCEINLINE float FVector2D::DistSquared ( const FVector2D &  V1,
const FVector2D &  V2 
)
static

Squared distance between two 2D points.

参数
V1The first point.
V2The second point.
返回
The squared distance between two 2D points.

◆ DotProduct()

FORCEINLINE float FVector2D::DotProduct ( const FVector2D &  A,
const FVector2D &  B 
)
static

Calculates the dot product of two vectors.

参数
AThe first vector.
BThe second vector.
返回
The dot product.

◆ Equals()

FORCEINLINE bool FVector2D::Equals ( const FVector2D &  V,
float  Tolerance = KINDA_SMALL_NUMBER 
) const

Checks for equality with error-tolerant comparison.

参数
VThe vector to compare.
ToleranceError tolerance.
返回
true if the vectors are equal within specified tolerance, otherwise false.

◆ GetAbs()

FORCEINLINE FVector2D FVector2D::GetAbs ( ) const

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

返回
A copy of this vector with absolute value of each component.

◆ GetAbsMax()

FORCEINLINE float FVector2D::GetAbsMax ( ) const

Get the maximum absolute value of the vector's components.

返回
The maximum absolute value of the vector's components.

◆ GetMax()

FORCEINLINE float FVector2D::GetMax ( ) const

Get the maximum value of the vector's components.

返回
The maximum value of the vector's components.

◆ GetMin()

FORCEINLINE float FVector2D::GetMin ( ) const

Get the minimum value of the vector's components.

返回
The minimum value of the vector's components.

◆ GetRotated()

FORCEINLINE FVector2D FVector2D::GetRotated ( float  AngleDeg) const

Rotates around axis (0,0,1)

参数
AngleDegAngle to rotate (in degrees)
返回
Rotated Vector

◆ GetSafeNormal()

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.

参数
ToleranceMinimum squared length of vector for normalization.
返回
A normalized copy of the vector if safe, (0,0) otherwise.

◆ GetSignVector()

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.

参数
Acopy of the vector with each component set to +1 or -1

◆ InitFromString()

FORCEINLINE bool FVector2D::InitFromString ( const FString &  InSourceString)

Initialize this Vector based on an FString.

The String is expected to contain X=, Y=. The FVector2D will be bogus when InitFromString returns false.

参数
InSourceStringFString containing the vector values.
返回
true if the X,Y values were read successfully; false otherwise.

◆ IntPoint()

FORCEINLINE FIntPoint FVector2D::IntPoint ( ) const

Get this vector as an Int Point.

返回
New Int Point from this vector.

◆ IsNearlyZero()

FORCEINLINE bool FVector2D::IsNearlyZero ( float  Tolerance = KINDA_SMALL_NUMBER) const

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

参数
ToleranceError tolerance.
返回
true if vector is in tolerance to zero, otherwise false.

◆ IsZero()

FORCEINLINE bool FVector2D::IsZero ( ) const

Checks whether all components of the vector are exactly zero.

返回
true if vector is exactly zero, otherwise false.

◆ Max()

FORCEINLINE FVector2D FVector2D::Max ( const FVector2D &  A,
const FVector2D &  B 
)
static

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

参数
AThe first vector.
BThe second vector.
返回
The max vector.

◆ Min()

FORCEINLINE FVector2D FVector2D::Min ( const FVector2D &  A,
const FVector2D &  B 
)
static

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

参数
AThe first vector.
BThe second vector.
返回
The min vector.

◆ NetSerialize()

CORE_API bool FVector2D::NetSerialize ( FArchive &  Ar,
class UPackageMap *  Map,
bool &  bOutSuccess 
)

Network serialization function.

FVectors NetSerialize without quantization (ie exact values are serialized).

◆ Normalize()

FORCEINLINE void FVector2D::Normalize ( float  Tolerance = SMALL_NUMBER)

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

参数
ToleranceMinimum squared length of vector for normalization.
参见
GetSafeNormal()

◆ operator!=()

FORCEINLINE bool FVector2D::operator!= ( const FVector2D &  V) const

Compares this vector against another for inequality.

参数
VThe vector to compare against.
返回
true if the two vectors are not equal, otherwise false.

◆ operator*() [1/2]

FORCEINLINE FVector2D FVector2D::operator* ( const FVector2D &  V) const

Gets the result of component-wise multiplication of this vector by another.

参数
VThe other vector to multiply this by.
返回
The result of the multiplication.

◆ operator*() [2/2]

FORCEINLINE FVector2D FVector2D::operator* ( float  Scale) const

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

参数
ScaleHow much to scale the vector by.
返回
The result of scaling this vector.

◆ operator*=() [1/2]

FORCEINLINE FVector2D FVector2D::operator*= ( const FVector2D &  V)

Multiplies this vector with another vector, using component-wise multiplication.

参数
VThe vector to multiply with.
返回
Copy of the vector after multiplication.

◆ operator*=() [2/2]

FORCEINLINE FVector2D FVector2D::operator*= ( float  Scale)

Scales this vector.

参数
ScaleThe scale to multiply vector by.
返回
Copy of the vector after scaling.

◆ operator+() [1/2]

FORCEINLINE FVector2D FVector2D::operator+ ( const FVector2D &  V) const

Gets the result of adding two vectors together.

参数
VThe other vector to add to this.
返回
The result of adding the vectors together.

◆ operator+() [2/2]

FORCEINLINE FVector2D FVector2D::operator+ ( float  A) const

Gets the result of adding A to each component of the vector.

参数
AFloat to add to each component.
返回
The result of adding A to each component.

◆ operator+=()

FORCEINLINE FVector2D FVector2D::operator+= ( const FVector2D &  V)

Adds another vector to this.

参数
VThe other vector to add.
返回
Copy of the vector after addition.

◆ operator-() [1/3]

FORCEINLINE FVector2D FVector2D::operator- ( ) const

Gets a negated copy of the vector.

返回
A negated copy of the vector.

◆ operator-() [2/3]

FORCEINLINE FVector2D FVector2D::operator- ( const FVector2D &  V) const

Gets the result of subtracting a vector from this one.

参数
VThe other vector to subtract from this.
返回
The result of the subtraction.

◆ operator-() [3/3]

FORCEINLINE FVector2D FVector2D::operator- ( float  A) const

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

参数
AFloat to subtract from each component
返回
The result of subtracting A from each component.

◆ operator-=()

FORCEINLINE FVector2D FVector2D::operator-= ( const FVector2D &  V)

Subtracts another vector from this.

参数
VThe other vector to subtract.
返回
Copy of the vector after subtraction.

◆ operator/() [1/2]

FORCEINLINE FVector2D FVector2D::operator/ ( const FVector2D &  V) const

Gets the result of component-wise division of this vector by another.

参数
VThe other vector to divide this by.
返回
The result of the division.

◆ operator/() [2/2]

FORCEINLINE FVector2D FVector2D::operator/ ( float  Scale) const

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

参数
ScaleHow much to divide the vector by.
返回
The result of division on this vector.

◆ operator/=() [1/2]

FORCEINLINE FVector2D FVector2D::operator/= ( const FVector2D &  V)

Divides this vector by another vector, using component-wise division.

参数
VThe vector to divide by.
返回
Copy of the vector after division.

◆ operator/=() [2/2]

FORCEINLINE FVector2D FVector2D::operator/= ( float  V)

Divides this vector.

参数
VWhat to divide vector by.
返回
Copy of the vector after division.

◆ operator<()

FORCEINLINE bool FVector2D::operator< ( const FVector2D &  Other) const

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

参数
OtherThe vector to compare against.
返回
true if this is the smaller vector, otherwise false.

◆ operator<=()

FORCEINLINE bool FVector2D::operator<= ( const FVector2D &  Other) const

Checks whether both components of this vector are less than or equal to another.

参数
OtherThe vector to compare against.
返回
true if this vector is less than or equal to the other vector, otherwise false.

◆ operator==()

FORCEINLINE bool FVector2D::operator== ( const FVector2D &  V) const

Compares this vector against another for equality.

参数
VThe vector to compare against.
返回
true if the two vectors are equal, otherwise false.

◆ operator>()

FORCEINLINE bool FVector2D::operator> ( const FVector2D &  Other) const

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

参数
OtherThe vector to compare against.
返回
true if this is the larger vector, otherwise false.

◆ operator>=()

FORCEINLINE bool FVector2D::operator>= ( const FVector2D &  Other) const

Checks whether both components of this vector are greater than or equal to another.

参数
OtherThe vector to compare against.
返回
true if this vector is greater than or equal to the other vector, otherwise false.

◆ operator[]() [1/2]

FORCEINLINE float & FVector2D::operator[] ( int32  Index)

Gets specific component of the vector.

参数
Indexthe index of vector component
返回
reference to component.

◆ operator[]() [2/2]

FORCEINLINE float FVector2D::operator[] ( int32  Index) const

Gets specific component of the vector.

参数
Indexthe index of vector component
返回
copy of component value.

◆ operator^()

FORCEINLINE float FVector2D::operator^ ( const FVector2D &  V) const

Calculates cross product of this vector and another.

参数
VThe other vector.
返回
The cross product.

◆ operator|()

FORCEINLINE float FVector2D::operator| ( const FVector2D &  V) const

Calculates dot product of this vector and another.

参数
VThe other vector.
返回
The dot product.

◆ RoundToVector()

FORCEINLINE FVector2D FVector2D::RoundToVector ( ) const

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

返回
New FVector2D from this vector that is rounded.

◆ Set()

FORCEINLINE void FVector2D::Set ( float  InX,
float  InY 
)

Set the values of the vector directly.

参数
InXNew X coordinate.
InYNew Y coordinate.

◆ Size()

FORCEINLINE float FVector2D::Size ( ) const

Get the length (magnitude) of this vector.

返回
The length of this vector.

◆ SizeSquared()

FORCEINLINE float FVector2D::SizeSquared ( ) const

Get the squared length of this vector.

返回
The squared length of this vector.

◆ ToDirectionAndLength()

FORCEINLINE void FVector2D::ToDirectionAndLength ( FVector2D &  OutDir,
float &  OutLength 
) const

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

参数
OutDirReference passed in to store unit direction vector.
OutLengthReference passed in to store length of the vector.

◆ ToString()

FORCEINLINE FString FVector2D::ToString ( ) const

Get a textual representation of the vector.

返回
Text describing the vector.

友元及相关函数文档

◆ operator<<

FArchive & operator<< ( FArchive &  Ar,
FVector2D &  V 
)
friend

Serialize a vector.

参数
ArSerialization archive.
VVector being serialized.
返回
Reference to Archive after serialization.

类成员变量说明

◆ Unit45Deg

CORE_API const FVector2D FVector2D::Unit45Deg
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

注解
The UnitVector above is actually a value with axes of 1 rather than a magnitude of one.

◆ UnitVector

CORE_API const FVector2D FVector2D::UnitVector
static

Global 2D one vector (poorly named) constant (1,1).

注解
Incorrectly named "unit" vector though its magnitude/length/size is not one. Would fix, though likely used all over the world. Use Unit45Deg below for an actual unit vector.

该结构体的文档由以下文件生成: