UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::VectorUtil Namespace Reference

Functions

template<typename RealType >
bool IsFinite (const TVector2< RealType > &V)
 
template<typename RealType >
bool IsFinite (const TVector< RealType > &V)
 
template<typename RealType >
RealType Clamp (RealType Value, RealType MinValue, RealType MaxValue)
 
template<typename RealType >
TVector< RealType > Normal (const TVector< RealType > &V0, const TVector< RealType > &V1, const TVector< RealType > &V2)
 
template<typename RealType >
TVector< RealType > NormalDirection (const TVector< RealType > &V0, const TVector< RealType > &V1, const TVector< RealType > &V2)
 
template<typename RealType >
RealType Area (const TVector< RealType > &V0, const TVector< RealType > &V1, const TVector< RealType > &V2)
 
template<typename RealType >
RealType Area (const TVector2< RealType > &V0, const TVector2< RealType > &V1, const TVector2< RealType > &V2)
 
template<typename RealType >
RealType SignedArea (const TVector2< RealType > &V0, const TVector2< RealType > &V1, const TVector2< RealType > &V2)
 
template<typename RealType >
bool IsObtuse (const TVector< RealType > &V1, const TVector< RealType > &V2, const TVector< RealType > &V3)
 
template<typename RealType >
TVector< RealType > NormalArea (const TVector< RealType > &V0, const TVector< RealType > &V1, const TVector< RealType > &V2, RealType &AreaOut)
 
template<typename RealType >
bool EpsilonEqual (RealType A, RealType B, RealType Epsilon)
 
template<typename RealType >
bool EpsilonEqual (const TVector2< RealType > &V0, const TVector2< RealType > &V1, RealType Epsilon)
 
template<typename RealType >
bool EpsilonEqual (const TVector< RealType > &V0, const TVector< RealType > &V1, RealType Epsilon)
 
template<typename RealType >
bool EpsilonEqual (const TVector4< RealType > &V0, const TVector4< RealType > &V1, RealType Epsilon)
 
template<typename ValueVecType >
int Min3Index (const ValueVecType &Vector3)
 
template<typename ValueVecType >
int Max3Index (const ValueVecType &Vector3)
 
template<typename RealType >
void MakePerpVectors (const TVector< RealType > &Normal, TVector< RealType > &OutPerp1, TVector< RealType > &OutPerp2)
 
template<typename RealType >
TVector< RealType > MakePerpVector (const TVector< RealType > &Normal)
 
template<typename RealType >
void MakePerpVector (const TVector< RealType > &Normal, TVector< RealType > &OutPerp1)
 
template<typename RealType >
RealType PlaneAngleSignedD (const TVector< RealType > &VFrom, const TVector< RealType > &VTo, const TVector< RealType > &PlaneN)
 
template<typename RealType >
RealType PlaneAngleSignedR (const TVector< RealType > &VFrom, const TVector< RealType > &VTo, const TVector< RealType > &PlaneN)
 
template<typename RealType >
RealType VectorTanHalfAngle (const TVector< RealType > &A, const TVector< RealType > &B)
 
template<typename RealType >
RealType VectorTanHalfAngle (const TVector2< RealType > &A, const TVector2< RealType > &B)
 
template<typename RealType >
RealType VectorCot (const TVector< RealType > &V1, const TVector< RealType > &V2)
 
template<typename RealType >
TVector< RealType > BarycentricCoords (const TVector< RealType > &Point, const TVector< RealType > &V0, const TVector< RealType > &V1, const TVector< RealType > &V2)
 
template<typename RealType >
TVector< RealType > BarycentricCoords (const TVector2< RealType > &Point, const TVector2< RealType > &V0, const TVector2< RealType > &V1, const TVector2< RealType > &V2)
 
template<typename RealType >
TVector< RealType > UniformSampleTriangleBarycentricCoords (RealType R1, RealType R2)
 
template<typename RealType >
TVector< RealType > UniformSampleTrianglePoint (RealType R1, RealType R2, const TVector< RealType > &A, const TVector< RealType > &B, const TVector< RealType > &C)
 
template<typename RealType >
TVector2< RealType > UniformSampleTrianglePoint (RealType R1, RealType R2, const TVector2< RealType > &A, const TVector2< RealType > &B, const TVector2< RealType > &C)
 
template<typename RealType >
RealType TriSolidAngle (TVector< RealType > A, TVector< RealType > B, TVector< RealType > C, const TVector< RealType > &P)
 
template<typename RealType >
TVector< RealType > TriGradient (TVector< RealType > Vi, TVector< RealType > Vj, TVector< RealType > Vk, RealType fi, RealType fj, RealType fk)
 
template<typename RealType >
RealType OpeningAngleD (TVector< RealType > A, TVector< RealType > B, const TVector< RealType > &P)
 
template<typename RealType >
RealType OrientedDihedralAngle (const TVector< RealType > &Normal0, const TVector< RealType > &Normal1, const TVector< RealType > &Edge)
 
template<typename RealType >
TVector2< RealType > Circumcenter (TVector2< RealType > A, TVector2< RealType > B, const TVector2< RealType > &C, RealType Epsilon=TMathUtilConstants< RealType >::Epsilon)
 
template<typename RealType >
RealType TriangleRegularity (const TVector< RealType > &A, const TVector< RealType > &B, const TVector< RealType > &C)
 
template<typename RealType >
RealType BitangentSign (const TVector< RealType > &NormalIn, const TVector< RealType > &TangentIn, const TVector< RealType > &BitangentIn)
 
template<typename RealType >
TVector< RealType > Bitangent (const TVector< RealType > &NormalIn, const TVector< RealType > &TangentIn, RealType BitangentSign)
 
template<typename RealType >
TVector< RealType > TangentFromBitangent (const TVector< RealType > &NormalIn, const TVector< RealType > &BitangentIn)
 
template<typename RealType >
TVector< RealType > BitangentFromTangent (const TVector< RealType > &NormalIn, const TVector< RealType > &TangentIn)
 
double AspectRatio (const FVector3d &v1, const FVector3d &v2, const FVector3d &v3)
 
template<typename RealType >
TVector< RealType > TransformNormal (const TTransform< RealType > &Transform, const TVector< RealType > &Normal)
 
template<typename RealType >
TVector< RealType > InverseTransformNormal (const TTransform< RealType > &Transform, const TVector< RealType > &Normal)
 

Function Documentation

◆ Area() [1/2]

template<typename RealType >
RealType UE::Geometry::VectorUtil::Area ( const TVector2< RealType > &  V0,
const TVector2< RealType > &  V1,
const TVector2< RealType > &  V2 
)
inline
Returns
area of 2D triangle V0,V1,V2

◆ Area() [2/2]

template<typename RealType >
RealType UE::Geometry::VectorUtil::Area ( const TVector< RealType > &  V0,
const TVector< RealType > &  V1,
const TVector< RealType > &  V2 
)
inline
Returns
area of 3D triangle V0,V1,V2

◆ AspectRatio()

double UE::Geometry::VectorUtil::AspectRatio ( const FVector3d v1,
const FVector3d v2,
const FVector3d v3 
)
inline
Returns
Aspect ratio of triangle

◆ BarycentricCoords() [1/2]

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::BarycentricCoords ( const TVector2< RealType > &  Point,
const TVector2< RealType > &  V0,
const TVector2< RealType > &  V1,
const TVector2< RealType > &  V2 
)

Compute barycentric coordinates/weights of vPoint inside 2D triangle (V0,V1,V2). If point is inside triangle, coords will be positive and sum to 1. ie if result is a, then vPoint = a.x*V0 + a.y*V1 + a.z*V2. TODO: make robust to degenerate triangles?

◆ BarycentricCoords() [2/2]

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::BarycentricCoords ( const TVector< RealType > &  Point,
const TVector< RealType > &  V0,
const TVector< RealType > &  V1,
const TVector< RealType > &  V2 
)

Compute barycentric coordinates/weights of vPoint inside 3D triangle (V0,V1,V2). If point is in triangle plane and inside triangle, coords will be positive and sum to 1. ie if result is a, then vPoint = a.x*V0 + a.y*V1 + a.z*V2. TODO: make robust to degenerate triangles?

◆ Bitangent()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::Bitangent ( const TVector< RealType > &  NormalIn,
const TVector< RealType > &  TangentIn,
RealType  BitangentSign 
)
inline
Returns
Bitangent vector based on given Normal, Tangent, and Sign value (+1/-1)

◆ BitangentFromTangent()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::BitangentFromTangent ( const TVector< RealType > &  NormalIn,
const TVector< RealType > &  TangentIn 
)
inline
Returns
Bitangent vector based on given Normal and Tangent

◆ BitangentSign()

template<typename RealType >
RealType UE::Geometry::VectorUtil::BitangentSign ( const TVector< RealType > &  NormalIn,
const TVector< RealType > &  TangentIn,
const TVector< RealType > &  BitangentIn 
)
inline
Returns
sign of Bitangent relative to Normal and Tangent

◆ Circumcenter()

template<typename RealType >
TVector2< RealType > UE::Geometry::VectorUtil::Circumcenter ( TVector2< RealType >  A,
TVector2< RealType >  B,
const TVector2< RealType > &  C,
RealType  Epsilon = TMathUtilConstants<RealType>::Epsilon 
)
inline
Returns
circumcenter of triangle ABC

◆ Clamp()

template<typename RealType >
RealType UE::Geometry::VectorUtil::Clamp ( RealType  Value,
RealType  MinValue,
RealType  MaxValue 
)
inline
Returns
input Value clamped to range [MinValue, MaxValue]

◆ EpsilonEqual() [1/4]

template<typename RealType >
bool UE::Geometry::VectorUtil::EpsilonEqual ( const TVector2< RealType > &  V0,
const TVector2< RealType > &  V1,
RealType  Epsilon 
)
inline
Returns
true if all coordinates of V0 and V1 are within Epsilon of each other

◆ EpsilonEqual() [2/4]

template<typename RealType >
bool UE::Geometry::VectorUtil::EpsilonEqual ( const TVector4< RealType > &  V0,
const TVector4< RealType > &  V1,
RealType  Epsilon 
)
inline
Returns
true if all coordinates of V0 and V1 are within Epsilon of each other

◆ EpsilonEqual() [3/4]

template<typename RealType >
bool UE::Geometry::VectorUtil::EpsilonEqual ( const TVector< RealType > &  V0,
const TVector< RealType > &  V1,
RealType  Epsilon 
)
inline
Returns
true if all coordinates of V0 and V1 are within Epsilon of each other

◆ EpsilonEqual() [4/4]

template<typename RealType >
bool UE::Geometry::VectorUtil::EpsilonEqual ( RealType  A,
RealType  B,
RealType  Epsilon 
)
inline
Returns
true if Abs(A-B) is less or equal than Epsilon

◆ InverseTransformNormal()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::InverseTransformNormal ( const TTransform< RealType > &  Transform,
const TVector< RealType > &  Normal 
)
inline

◆ IsFinite() [1/2]

template<typename RealType >
bool UE::Geometry::VectorUtil::IsFinite ( const TVector2< RealType > &  V)
inline
Returns
true if all components of V are finite

◆ IsFinite() [2/2]

template<typename RealType >
bool UE::Geometry::VectorUtil::IsFinite ( const TVector< RealType > &  V)
inline
Returns
true if all components of V are finite

◆ IsObtuse()

template<typename RealType >
bool UE::Geometry::VectorUtil::IsObtuse ( const TVector< RealType > &  V1,
const TVector< RealType > &  V2,
const TVector< RealType > &  V3 
)
inline
Returns
true if triangle V1,V2,V3 is obtuse

◆ MakePerpVector() [1/2]

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::MakePerpVector ( const TVector< RealType > &  Normal)
inline

Calculates one vector perpendicular to input Normal, as efficiently as possible.

◆ MakePerpVector() [2/2]

template<typename RealType >
void UE::Geometry::VectorUtil::MakePerpVector ( const TVector< RealType > &  Normal,
TVector< RealType > &  OutPerp1 
)
inline

Calculates one vector perpendicular to input Normal, as efficiently as possible.

◆ MakePerpVectors()

template<typename RealType >
void UE::Geometry::VectorUtil::MakePerpVectors ( const TVector< RealType > &  Normal,
TVector< RealType > &  OutPerp1,
TVector< RealType > &  OutPerp2 
)
inline

Calculates two vectors perpendicular to input Normal, as efficiently as possible.

◆ Max3Index()

template<typename ValueVecType >
int UE::Geometry::VectorUtil::Max3Index ( const ValueVecType Vector3)
inline
Returns
0/1/2 index of largest value in Vector3

◆ Min3Index()

template<typename ValueVecType >
int UE::Geometry::VectorUtil::Min3Index ( const ValueVecType Vector3)
inline
Returns
0/1/2 index of smallest value in Vector3

◆ Normal()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::Normal ( const TVector< RealType > &  V0,
const TVector< RealType > &  V1,
const TVector< RealType > &  V2 
)
inline
Returns
normalized vector that is perpendicular to triangle V0,V1,V2 (triangle normal)

◆ NormalArea()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::NormalArea ( const TVector< RealType > &  V0,
const TVector< RealType > &  V1,
const TVector< RealType > &  V2,
RealType &  AreaOut 
)
inline

Calculate Normal and Area of triangle V0,V1,V2

Returns
triangle normal

◆ NormalDirection()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::NormalDirection ( const TVector< RealType > &  V0,
const TVector< RealType > &  V1,
const TVector< RealType > &  V2 
)
inline
Returns
un-normalized direction that is parallel to normal of triangle V0,V1,V2

◆ OpeningAngleD()

template<typename RealType >
RealType UE::Geometry::VectorUtil::OpeningAngleD ( TVector< RealType >  A,
TVector< RealType >  B,
const TVector< RealType > &  P 
)
inline
Returns
angle between vectors (A-CornerPt) and (B-CornerPt)

◆ OrientedDihedralAngle()

template<typename RealType >
RealType UE::Geometry::VectorUtil::OrientedDihedralAngle ( const TVector< RealType > &  Normal0,
const TVector< RealType > &  Normal1,
const TVector< RealType > &  Edge 
)
inline
Returns
oriented dihedral angle of two triangles sharing an oriented edge
Note
Provided normals and Edge should be unit length, and Edge be perpendicular to both normals (see Keenan Crane, Discrete Differential Geometry: An Applied Introduction, Appendix 1.5)

◆ PlaneAngleSignedD()

template<typename RealType >
RealType UE::Geometry::VectorUtil::PlaneAngleSignedD ( const TVector< RealType > &  VFrom,
const TVector< RealType > &  VTo,
const TVector< RealType > &  PlaneN 
)
inline

Calculates angle between VFrom and VTo after projection onto plane with normal defined by PlaneN

Returns
angle in degrees

◆ PlaneAngleSignedR()

template<typename RealType >
RealType UE::Geometry::VectorUtil::PlaneAngleSignedR ( const TVector< RealType > &  VFrom,
const TVector< RealType > &  VTo,
const TVector< RealType > &  PlaneN 
)
inline

Calculates angle between VFrom and VTo after projection onto plane with normal defined by PlaneN

Returns
angle in radians

◆ SignedArea()

template<typename RealType >
RealType UE::Geometry::VectorUtil::SignedArea ( const TVector2< RealType > &  V0,
const TVector2< RealType > &  V1,
const TVector2< RealType > &  V2 
)
inline
Returns
signed area of 2D triangle V0,V1,V2

◆ TangentFromBitangent()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::TangentFromBitangent ( const TVector< RealType > &  NormalIn,
const TVector< RealType > &  BitangentIn 
)
inline
Returns
Tangent-Space vector based on given Normal and Bitangent

◆ TransformNormal()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::TransformNormal ( const TTransform< RealType > &  Transform,
const TVector< RealType > &  Normal 
)
inline

◆ TriangleRegularity()

template<typename RealType >
RealType UE::Geometry::VectorUtil::TriangleRegularity ( const TVector< RealType > &  A,
const TVector< RealType > &  B,
const TVector< RealType > &  C 
)

◆ TriGradient()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::TriGradient ( TVector< RealType >  Vi,
TVector< RealType >  Vj,
TVector< RealType >  Vk,
RealType  fi,
RealType  fj,
RealType  fk 
)
inline

Calculate gradient of scalar field values fi,fj,fk defined at corners of triangle Vi,Vj,Vk and interpolated across triangle using linear basis functions. This gradient is a 3D vector lying in the plane of the triangle (or zero if field is constant).

Returns
gradient (3D vector) lying in plane of triangle.

◆ TriSolidAngle()

template<typename RealType >
RealType UE::Geometry::VectorUtil::TriSolidAngle ( TVector< RealType >  A,
TVector< RealType >  B,
TVector< RealType >  C,
const TVector< RealType > &  P 
)
inline
Returns
solid angle at point P for triangle A,B,C

◆ UniformSampleTriangleBarycentricCoords()

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::UniformSampleTriangleBarycentricCoords ( RealType  R1,
RealType  R2 
)

Sample uniform random barycentric coordinates on a triangle The inputs should be two random floating point numbers in the [0,1] range (See eq. 1 of 'Shape Distributions' by Osada, Funkhouser, Chazelle and Dobkin) Note the sample positions will not match those of UniformSampleTrianglePoint for the same R1, R2 values

◆ UniformSampleTrianglePoint() [1/2]

template<typename RealType >
TVector2< RealType > UE::Geometry::VectorUtil::UniformSampleTrianglePoint ( RealType  R1,
RealType  R2,
const TVector2< RealType > &  A,
const TVector2< RealType > &  B,
const TVector2< RealType > &  C 
)

Sample a uniform random point on a 2D triangle The inputs should be two random floating point numbers in the [0,1] range, and the triangle coordinates ref: http://mathworld.wolfram.com/TrianglePointPicking.html Note the sample positions will not match those of UniformSampleTriangleBarycentricCoords for the same R1, R2 values

◆ UniformSampleTrianglePoint() [2/2]

template<typename RealType >
TVector< RealType > UE::Geometry::VectorUtil::UniformSampleTrianglePoint ( RealType  R1,
RealType  R2,
const TVector< RealType > &  A,
const TVector< RealType > &  B,
const TVector< RealType > &  C 
)

Sample a uniform random point on a triangle The inputs should be two random floating point numbers in the [0,1] range, and the triangle coordinates ref: http://mathworld.wolfram.com/TrianglePointPicking.html Note the sample positions will not match those of UniformSampleTriangleBarycentricCoords for the same R1, R2 values

◆ VectorCot()

template<typename RealType >
RealType UE::Geometry::VectorUtil::VectorCot ( const TVector< RealType > &  V1,
const TVector< RealType > &  V2 
)

Fast cotangent of angle between two vectors (do not have to be normalized unit vectors). cot = cos/sin, both of which can be computed from vector identities

Returns
cotangent of angle between V1 and V2, or zero if result would be unstable (eg infinity)

◆ VectorTanHalfAngle() [1/2]

template<typename RealType >
RealType UE::Geometry::VectorUtil::VectorTanHalfAngle ( const TVector2< RealType > &  A,
const TVector2< RealType > &  B 
)

tan(theta/2) = +/- sqrt( (1-cos(theta)) / (1+cos(theta)) )

Returns
positive value of tan(theta/2) where theta is angle between normalized vectors A and B

◆ VectorTanHalfAngle() [2/2]

template<typename RealType >
RealType UE::Geometry::VectorUtil::VectorTanHalfAngle ( const TVector< RealType > &  A,
const TVector< RealType > &  B 
)

tan(theta/2) = +/- sqrt( (1-cos(theta)) / (1+cos(theta)) )

Returns
positive value of tan(theta/2) where theta is angle between normalized vectors A and B