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

Functions

template<typename RealType , typename VectorType , bool bLoop>
void GetPrevNext (const TArrayView< const VectorType > &Vertices, int32 Idx, VectorType &OutPrev, VectorType &OutNext)
 
template<typename RealType , typename VectorType , bool bLoop>
void GetVectorsToPrevNext (const TArrayView< const VectorType > &Vertices, int32 VertexIndex, VectorType &OutToPrev, VectorType &OutToNext, bool bNormalize)
 
template<typename RealType , typename VectorType >
void GetVectorsToPrevNext (const TArrayView< const VectorType > &Vertices, int32 VertexIndex, VectorType &OutToPrev, VectorType &OutToNext, bool bNormalize, bool bLoop)
 
template<typename RealType , typename VectorType , bool bLoop>
VectorType Tangent (const TArrayView< const VectorType > &Vertices, int32 Idx)
 
template<typename RealType , typename VectorType >
VectorType Tangent (const TArrayView< const VectorType > &Vertices, int32 Idx, bool bLoop=false)
 
template<typename RealType , typename VectorType , bool bLoop>
VectorType GetNormal_FaceAvg2 (const TArrayView< const VectorType > &Vertices, int VertexIndex)
 
template<typename RealType , typename VectorType >
RealType SignedArea2 (const TArrayView< const VectorType > &Vertices)
 
template<typename RealType , typename VectorType >
RealType WindingIntegral2 (const TArrayView< const VectorType > &Vertices, const VectorType &QueryPoint)
 
template<typename RealType , typename VectorType >
bool Contains2 (const TArrayView< const VectorType > &Vertices, const VectorType &QueryPoint)
 
template<typename RealType , typename VectorType >
int FindNearestIndex (const TArrayView< const VectorType > &Vertices, const VectorType &V)
 
template<typename RealType , typename VectorType >
bool IsConvex2 (const TArrayView< const VectorType > Vertices, RealType Tolerance=TMathUtil< RealType >::ZeroTolerance, bool bDegenerateIsConvex=true)
 
template<typename RealType >
bool ProjectPointInsideConvexPolygon (const TArrayView< const TVector2< RealType > > Vertices, TVector2< RealType > &ProjPt, bool bReverseOrientation=false)
 
template<typename RealType , typename VectorType >
void InPlaceSmooth (TArrayView< VectorType > Vertices, int StartIdx, int EndIdx, double Alpha, int NumIterations, bool bClosed)
 
template<typename RealType , typename VectorType >
void IterativeSmooth (TArrayView< VectorType > Vertices, int StartIdx, int EndIdx, double Alpha, int NumIterations, bool bClosed)
 

Function Documentation

◆ Contains2()

template<typename RealType , typename VectorType >
bool UE::Geometry::CurveUtil::Contains2 ( const TArrayView< const VectorType > &  Vertices,
const VectorType &  QueryPoint 
)
Returns
true if the given query point is inside the closed curve (in the XY plane), based on the winding integral Note: Negative and positive windings are both considered 'inside'

◆ FindNearestIndex()

template<typename RealType , typename VectorType >
int UE::Geometry::CurveUtil::FindNearestIndex ( const TArrayView< const VectorType > &  Vertices,
const VectorType &  V 
)

◆ GetNormal_FaceAvg2()

template<typename RealType , typename VectorType , bool bLoop>
VectorType UE::Geometry::CurveUtil::GetNormal_FaceAvg2 ( const TArrayView< const VectorType > &  Vertices,
int  VertexIndex 
)

Construct a normal at a vertex of the Polygon by averaging the adjacent face normals. This vector is independent of the lengths of the adjacent segments. Points "inward" for a Clockwise Polygon, and outward for CounterClockwise Note: Specific to 2D curves; normals computed by rotating tangents in the XY plane

◆ GetPrevNext()

template<typename RealType , typename VectorType , bool bLoop>
void UE::Geometry::CurveUtil::GetPrevNext ( const TArrayView< const VectorType > &  Vertices,
int32  Idx,
VectorType &  OutPrev,
VectorType &  OutNext 
)
inline

Curve utility functions Get (by reference) the vertices surrounding the given vertex index If bLoop is false and the Prev or Next vertex would be out of bounds, the vertex at Idx is used instead.

◆ GetVectorsToPrevNext() [1/2]

template<typename RealType , typename VectorType , bool bLoop>
void UE::Geometry::CurveUtil::GetVectorsToPrevNext ( const TArrayView< const VectorType > &  Vertices,
int32  VertexIndex,
VectorType &  OutToPrev,
VectorType &  OutToNext,
bool  bNormalize 
)
inline

Get (by reference) vectors pointing toward the given vertex index, from its surrounding vertices If bLoop is false and the Prev or Next vertex would be out of bounds, a zero vector is used instead

◆ GetVectorsToPrevNext() [2/2]

template<typename RealType , typename VectorType >
void UE::Geometry::CurveUtil::GetVectorsToPrevNext ( const TArrayView< const VectorType > &  Vertices,
int32  VertexIndex,
VectorType &  OutToPrev,
VectorType &  OutToNext,
bool  bNormalize,
bool  bLoop 
)
inline

Get (by reference) vectors pointing toward the given vertex index, from its surrounding vertices If bLoop is false and the Prev or Next vertex would be out of bounds, a zero vector is used instead

◆ InPlaceSmooth()

template<typename RealType , typename VectorType >
void UE::Geometry::CurveUtil::InPlaceSmooth ( TArrayView< VectorType >  Vertices,
int  StartIdx,
int  EndIdx,
double  Alpha,
int  NumIterations,
bool  bClosed 
)

smooth vertices in-place (will not produce a symmetric result, but does not require extra buffer)

◆ IsConvex2()

template<typename RealType , typename VectorType >
bool UE::Geometry::CurveUtil::IsConvex2 ( const TArrayView< const VectorType >  Vertices,
RealType  Tolerance = TMathUtil<RealType>::ZeroTolerance,
bool  bDegenerateIsConvex = true 
)

Tests closed, 2D curve for convexity, with an optional tolerance allowing for approximately-collinear points Note that tolerance is per vertex angle, so a very-finely-sampled smooth concavity could be reported as convex

Parameters
RadiansToleranceMaximum turn in the 'wrong' direction that will still be considered convex (in radians)
bDegenerateIsConvexWhat to return for degenerate input (less than 3 points or equivalent due to repeated points)
Returns
true if polygon is convex

◆ IterativeSmooth()

template<typename RealType , typename VectorType >
void UE::Geometry::CurveUtil::IterativeSmooth ( TArrayView< VectorType >  Vertices,
int  StartIdx,
int  EndIdx,
double  Alpha,
int  NumIterations,
bool  bClosed 
)

smooth set of vertices using extra buffer

◆ ProjectPointInsideConvexPolygon()

template<typename RealType >
bool UE::Geometry::CurveUtil::ProjectPointInsideConvexPolygon ( const TArrayView< const TVector2< RealType > >  Vertices,
TVector2< RealType > &  ProjPt,
bool  bReverseOrientation = false 
)

Project point inside a convex polygon with known orientation

Parameters
ProjPtPoint to project
bReverseOrientationWhether convex polygon orientation is reversed (i.e., has negative signed area)
Returns
true if the point was projected

◆ SignedArea2()

template<typename RealType , typename VectorType >
RealType UE::Geometry::CurveUtil::SignedArea2 ( const TArrayView< const VectorType > &  Vertices)

Compute the signed area of a closed curve, assuming vertices in the XY plane

◆ Tangent() [1/2]

template<typename RealType , typename VectorType , bool bLoop>
VectorType UE::Geometry::CurveUtil::Tangent ( const TArrayView< const VectorType > &  Vertices,
int32  Idx 
)
inline
Returns
the tangent direction (normalized) of the path at Idx, using the surrounding vertices (as found by GetPrevNext())

◆ Tangent() [2/2]

template<typename RealType , typename VectorType >
VectorType UE::Geometry::CurveUtil::Tangent ( const TArrayView< const VectorType > &  Vertices,
int32  Idx,
bool  bLoop = false 
)
inline
Returns
the tangent direction (normalized) of the path at Idx, using the surrounding vertices (as found by GetPrevNext())

◆ WindingIntegral2()

template<typename RealType , typename VectorType >
RealType UE::Geometry::CurveUtil::WindingIntegral2 ( const TArrayView< const VectorType > &  Vertices,
const VectorType &  QueryPoint 
)

Compute the winding of a point relative to a closed curve, assuming vertices in the XY plane