Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Math
Inheritance Hierarchy
- TVector
- FGeomVertex
- FMetaPathWayPoint
- FNiagaraPosition
- TPlane
- TVector< FRealDouble, 3 >
- TVector< FRealSingle, 3 >
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Math/MathFwd.h |
| Include | #include "Math/MathFwd.h" |
Syntax
template<typename T>
struct TVector
Remarks
A vector in 3-D space composed of components (X, Y, Z) with floating point precision.
Specializations
TVector< FReal, 4 >
TVector< FRealDouble, 2 >
TVector< FRealDouble, 3 >
TVector< FRealSingle, 2 >
TVector< FRealSingle, 3 >
TVector< int32, 2 >
TVector< T, 3 >
Variables
| Type | Name | Description | |
|---|---|---|---|
| union UE::Math::TVector::@639 | @640 | ||
| T | X | Vector's X component. | |
| T[3] | XYZ | ||
| T | Y | Vector's Y component. | |
| T | Z | Vector's Z component. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
TVector () |
Default constructor (no initialization). | ||
| Constructs a vector from an TVector2 |
|||
TVector
(
T InX, |
Constructor using initial values for each component. | ||
TVector
(
T InF |
Constructor initializing all components to a single T value. | ||
TVector
(
const UE::Math::TVector4< T >& V |
Constructor using the XYZ components from a 4D vector.FVector inline functions | ||
TVector
(
const FLinearColor& InColor |
Constructs a vector from an FLinearColor. | ||
TVector
(
TIntVector3< IntType > InVector |
Constructs a vector from an FIntVector. | ||
| Constructs a vector from an FIntPoint. | |||
TVector
(
EForceInit |
Constructor which initializes all components to zero. | ||
| Conversion from other type. | |||
| constexpr | TVector
(
T InF, |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddBounded
(
const TVector< T >& V, |
Add a vector to this and clamp the result in a cube. | |
| bool | AllComponentsEqual
(
T Tolerance |
Checks whether all components of this vector are the same, within a tolerance. | |
| TVector< T > | BoundToBox
(
const TVector< T >& Min, |
Get a copy of this vector, clamped inside of a cube. | |
| TVector< T > | BoundToCube
(
T Radius |
Get a copy of this vector, clamped inside of a cube. | |
| T | BoxPushOut
(
const TVector< T >& Normal, |
Compute pushout of a box from a plane. | |
| bool | Coincident
(
const TVector< T >& Normal1, |
See if two normal vectors are coincident (nearly parallel and point in the same direction). | |
| T | Component
(
int32 Index |
Gets a specific component of the vector. | |
| T & | Component
(
int32 Index |
Gets a specific component of the vector. | |
| TVector< T > | ComponentMax
(
const TVector< T >& Other |
Gets the component-wise max of two vectors. | |
| TVector< T > | ComponentMin
(
const TVector< T >& Other |
Gets the component-wise min of two vectors. | |
| bool | ContainsNaN () |
Utility to check if there are any non-finite values (NaN or Inf) in this vector. | |
| bool | See if two planes are coplanar. | ||
| T | CosineAngle2D
(
TVector< T > B |
Returns the cosine of the angle between this vector and another projected onto the XY plane (no Z). | |
| void | CreateOrthonormalBasis
(
TVector< T >& XAxis, |
Create an orthonormal basis from a basis with at least two orthogonal vectors. | |
| TVector< T > | Calculate cross product between this and another vector. | ||
| TVector< T > | CrossProduct
(
const TVector< T >& A, |
Calculate the cross product of two vectors. | |
| TVector< T > | DegreesToRadians
(
const TVector< T >& DegVector |
Converts a vector containing degree values to a vector containing radian values. | |
| void | |||
| void | DiagnosticCheckNaN
(
const TCHAR* Message |
||
| T | Euclidean distance between two points. | ||
| T | |||
| T | |||
| T | DistSquared
(
const TVector< T >& V1, |
Squared distance between two points. | |
| T | DistSquared2D
(
const TVector< T >& V1, |
||
| T | DistSquaredXY
(
const TVector< T >& V1, |
Squared distance between two points in the XY plane only. | |
| T | Euclidean distance between two points in the XY plane (ignoring Z). | ||
| T | Calculate the dot product between this and another vector. | ||
| T | DotProduct
(
const TVector< T >& A, |
Calculate the dot product of two vectors. | |
| bool | Check against another vector for equality, within specified error limits. | ||
| T | EvaluateBezier
(
const TVector< T >* ControlPoints, |
Generates a list of sample points on a Bezier curve defined by 2 points. | |
| void | FindBestAxisVectors
(
TVector< T >& Axis1, |
Find good arbitrary axis vectors to represent U and V axes of a plane, using this vector as the normal of the plane. | |
| void | GenerateClusterCenters
(
TArray< TVector< T >>& Clusters, |
Given a current set of cluster centers, a set of points, iterate N times to move clusters to be central. | |
| TVector< 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 | GetAbsMin () |
Get the minimum absolute value of the vector's components. | |
| TVector< T > | GetClampedToMaxSize
(
T MaxSize |
Create a copy of this vector, with its maximum magnitude clamped to MaxSize. | |
| TVector< T > | GetClampedToMaxSize2D
(
T MaxSize |
Create a copy of this vector, with the maximum 2D magnitude clamped to MaxSize. Z is unchanged. | |
| TVector< T > | GetClampedToSize
(
T Min, |
Create a copy of this vector, with its magnitude clamped between Min and Max. | |
| TVector< T > | GetClampedToSize2D
(
T Min, |
Create a copy of this vector, with the 2D magnitude clamped between Min and Max. Z is unchanged. | |
| T | GetComponentForAxis
(
EAxis::Type Axis |
Get a specific component of the vector, given a specific axis by enum | |
| T | GetMax () |
Get the maximum value of the vector's components. | |
| T | GetMin () |
Get the minimum value of the vector's components. | |
| TVector< T > | GetSafeNormal
(
T Tolerance, |
Gets a normalized copy of the vector, checking it is safe to do so based on the length. | |
| TVector< T > | GetSafeNormal2D
(
T Tolerance, |
Gets a normalized copy of the 2D components of the vector, checking it is safe to do so. | |
| TVector< T > | Get a copy of the vector as sign only. | ||
| TVector< T > | Calculates normalized version of vector without checking for zero length. | ||
| TVector< T > | Calculates normalized 2D version of vector without checking for zero length. | ||
| TVector< T > | GridSnap
(
const T& GridSz |
Gets a copy of this vector snapped to a grid. | |
| T | HeadingAngle () |
Convert a direction vector into a 'heading' angle. | |
| bool | InitFromCompactString
(
const FString& InSourceString |
Initialize this Vector based on an FString. | |
| bool | InitFromString
(
const FString& InSourceString |
Initialize this Vector based on an FString. | |
| bool | IsNearlyZero
(
T Tolerance |
Checks whether vector is near to zero within a specified tolerance. | |
| bool | IsNormalized () |
Checks whether vector is normalized. | |
| bool | IsUniform
(
T Tolerance |
Check whether X, Y and Z are nearly equal. | |
| bool | IsUnit
(
T LengthSquaredTolerance |
Check if the vector is of unit length, with specified tolerance. | |
| bool | IsZero () |
Checks whether all components of the vector are exactly zero. | |
| T | Length () |
Get the length (magnitude) of this vector. | |
| TVector< T > | |||
| TVector< T > | |||
| TVector< T > | Min, Max, Min3, Max3 like FMath | ||
| TVector< T > | |||
| TVector< T > | MirrorByPlane
(
const TPlane< T >& Plane |
Mirrors a vector about a plane.TVector inline functions | |
| TVector< T > | MirrorByVector
(
const TVector< T >& MirrorNormal |
Mirror a vector about a normal vector. | |
| bool | NetSerialize
(
FArchive& Ar, |
Network serialization function. | |
| bool | Normalize
(
T Tolerance |
Normalize this vector in-place if it is larger than a given tolerance. Leaves it unchanged if not. | |
| TVector< T > | One () |
||
| bool | Orthogonal
(
const TVector< T >& Normal1, |
See if two normal vectors are nearly orthogonal (perpendicular), meaning the angle between them is close to 90 degrees. | |
| bool | See if two normal vectors are nearly parallel, meaning the angle between them is close to 0 degrees. | ||
| T | PointPlaneDist
(
const TVector< T >& Point, |
Calculate the signed distance (in the direction of the normal) between a point and a plane. | |
| TVector< T > | PointPlaneProject
(
const TVector< T >& Point, |
Calculate the projection of a point on the plane defined by counter-clockwise (CCW) points A,B,C. | |
| TVector< T > | PointPlaneProject
(
const TVector< T >& Point, |
Calculate the projection of a point on the plane defined by PlaneBase and PlaneNormal. | |
| TVector< T > | PointPlaneProject
(
const TVector< T >& Point, |
Calculate the projection of a point on the given plane. | |
| bool | PointsAreNear
(
const TVector< T >& Point1, |
Compare two points and see if they're within specified distance. | |
| bool | PointsAreSame
(
const TVector< T >& P, |
Compare two points and see if they're the same, using a threshold. | |
| TVector< T > | Projection () |
Projects 2D components of vector based on Z. | |
| TVector< T > | ProjectOnTo
(
const TVector< T >& A |
Gets a copy of this vector projected onto the input vector. | |
| TVector< T > | ProjectOnToNormal
(
const TVector< T >& Normal |
Gets a copy of this vector projected onto the input vector, which is assumed to be unit length. | |
| TVector< T > | RadiansToDegrees
(
const TVector< T >& RadVector |
Converts a vector containing radian values to a vector containing degree values. | |
| TVector< T > | Reciprocal () |
Gets the reciprocal of this vector, avoiding division by zero. | |
| TVector< T > | RotateAngleAxis
(
const T AngleDeg, |
Rotates around Axis (assumes Axis.Size() == 1). | |
| TVector< T > | RotateAngleAxisRad
(
const T AngleRad, |
Rotates around Axis (assumes Axis.Size() == 1). | |
| UE::Math::TRotator< T > | Rotation () |
Return the UE::Math::TRotator |
|
| bool | Serialize
(
FStructuredArchive::FSlot Slot |
||
| bool | SerializeFromMismatchedTag
(
FName StructTag, |
||
| void | Set
(
T InX, |
Set the values of the vector directly. | |
| void | SetComponentForAxis
(
EAxis::Type Axis, |
Set a specified componet of the vector, given a specific axis by enum | |
| T | Size () |
Get the length (magnitude) of this vector. | |
| T | Size2D () |
Get the length of the 2D components of this vector. | |
| T | SizeSquared () |
Get the squared length of this vector. | |
| T | Get the squared length of the 2D components of this vector. | ||
| TVector< T > | SlerpNormals
(
TVector< T >& NormalA, |
Interpolate from normalized vector A to normalized vector B along a spherical path. | |
| TVector< T > | SlerpVectorToDirection
(
TVector< T >& V, |
Interpolate from a vector to the direction of another vector along a spherical path. | |
| T | Get the squared length of this vector. | ||
| FString | Get a short textural representation of this vector, for compact readable logging. | ||
| FText | Get a short locale aware textural representation of this vector, for compact readable logging. | ||
| void | ToDirectionAndLength
(
TVector< T >& OutDir, |
Util to convert this vector into a unit direction vector and its original length. | |
| void | ToDirectionAndLength
(
TVector< T >& OutDir, |
Util to convert this vector into a unit direction vector and its original length. | |
| TQuat< T > | Return the Quaternion orientation corresponding to the direction in which the vector points. | ||
| TRotator< T > | Return the TRotator orientation corresponding to the direction in which the vector points. | ||
| FString | ToString () |
Get a textual representation of this vector. | |
| FText | ToText () |
Get a locale aware textual representation of this vector. | |
| T | Triple product of three vectors: X dot (Y cross Z). | ||
| TVector2< T > | Converts a Cartesian unit vector into spherical coordinates on the unit sphere. | ||
| TVector< T > | UnitX () |
||
| TVector< T > | UnitY () |
||
| TVector< T > | UnitZ () |
||
| void | UnwindEuler () |
When this vector contains Euler angles (degrees), ensure that angles are between +/-180 | |
| TVector< T > | VectorPlaneProject
(
const TVector< T >& V, |
Calculate the projection of a vector on the plane defined by PlaneNormal. | |
| TVector< T > | Zero () |
Operators
| Type | Name | Description | |
|---|---|---|---|
| TVector< T > | operator-
(
FArg Bias |
Gets the result of subtracting from each component of the vector. | |
| TVector< T > | Gets the result of component-wise subtraction of this by another vector. | ||
| TVector< T > | operator- () |
Get a negated copy of the vector. | |
| bool | operator!=
(
const TVector< T >& V |
Check against another vector for inequality. | |
| TVector< T > | Gets the result of component-wise multiplication of this vector by another. | ||
| TVector< T > | operator*
(
FArg Scale |
Gets the result of scaling the vector (multiplying each component by a value). | |
| TVector< T > | operator*=
(
const TVector< T >& V |
Multiplies the vector with another vector, using component-wise multiplication. | |
| TVector< T > | operator*=
(
FArg Scale |
Scales the vector. | |
| TVector< T > | Gets the result of component-wise division of this vector by another. | ||
| TVector< T > | operator/
(
FArg Scale |
Gets the result of dividing each component of the vector by a value. | |
| TVector< T > | operator/=
(
const TVector< T >& V |
Divides the vector by another vector, using component-wise division. | |
| TVector< T > | operator/=
(
FArg Scale |
Divides the vector by a number. | |
| T | operator[]
(
int32 Index |
Gets specific component of the vector. | |
| T & | operator[]
(
int32 Index |
Gets specific component of the vector. | |
| TVector< T > | Calculate cross product between this and another vector. | ||
| T | Calculate the dot product between this and another vector. | ||
| TVector< T > | operator+
(
FArg Bias |
Gets the result of adding to each component of the vector. | |
| TVector< T > | Gets the result of component-wise addition of this and another vector. | ||
| TVector< T > | operator+=
(
const TVector< T >& V |
Adds another vector to this. Uses component-wise addition. | |
| TVector< T > | operator-=
(
const TVector< T >& V |
Subtracts another vector from this. Uses component-wise subtraction. | |
| bool | operator==
(
const TVector< T >& V |
Check against another vector for equality. |
Typedefs
| Name | Description |
|---|---|
| FReal |
Constants
| Name | Description |
|---|---|
| BackwardVector | Unreal backward vector (-1,0,0) |
| DownVector | Unreal down vector (0,0,-1) |
| ForwardVector | Unreal forward vector (1,0,0) |
| LeftVector | Unreal left vector (0,-1,0) |
| OneVector | One vector (1,1,1) |
| RightVector | Unreal right vector (0,1,0) |
| UpVector | Unreal up vector (0,0,1) |
| XAxisVector | Unit X axis vector (1,0,0) |
| YAxisVector | Unit Y axis vector (0,1,0) |
| ZAxisVector | Unit Z axis vector (0,0,1) |
| ZeroVector | A zero vector (0,0,0) |