UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::TConvexHull2< RealType > Class Template Reference

#include <ConvexHull2.h>

Public Member Functions

GEOMETRYCORE_API bool SolveSimplePolygon (int32 NumPolygonPoints, TFunctionRef< TVector2< RealType >(int32)> GetPointFunc, bool bIsKnownCCW=false)
 
GEOMETRYCORE_API bool Solve (int32 NumPoints, TFunctionRef< TVector2< RealType >(int32)> GetPointFunc, TFunctionRef< bool(int32)> FilterFunc=[](int32 Idx) {return true;})
 
bool Solve (TArrayView< const TVector2< RealType > > Points, TFunctionRef< bool(int32)> FilterFunc)
 
bool Solve (TArrayView< const TVector2< RealType > > Points)
 
bool IsSolutionAvailable () const
 
void Empty ()
 
int32 GetDimension () const
 
int32 GetNumUniquePoints () const
 
TArray< int32 > const & GetPolygonIndices () const
 
TLine2< RealType > GetLine (TArrayView< const TVector2< RealType > > Points) const
 

Protected Member Functions

void GetHull (TFunctionRef< TVector2< RealType >(int32)> GetPointFunc, TArray< int32 > &Merged, int32 &IdxFirst, int32 &IdxLast)
 
void Merge (TFunctionRef< TVector2< RealType >(int32)> GetPointFunc, TArray< int32 > &Merged, int32 j0, int32 j1, int32 j2, int32 j3, int32 &i0, int32 &i1)
 
void GetTangent (TFunctionRef< TVector2< RealType >(int32)> GetPointFunc, TArray< int32 > &Merged, int32 j0, int32 j1, int32 j2, int32 j3, int32 &i0, int32 &i1)
 

Protected Attributes

int32 Dimension = 0
 
int32 NumUniquePoints = 0
 
TArray< int32Hull
 

Member Function Documentation

◆ Empty()

template<typename RealType >
void UE::Geometry::TConvexHull2< RealType >::Empty ( )
inline

Empty any previously-computed convex hull data. Frees the hull memory. Note: You do not need to call this before calling Solve() with new data.

◆ GetDimension()

template<typename RealType >
int32 UE::Geometry::TConvexHull2< RealType >::GetDimension ( ) const
inline
Returns
Number of dimensions spanned by the input points.

◆ GetHull()

template<class RealType >
void UE::Geometry::TConvexHull2< RealType >::GetHull ( TFunctionRef< TVector2< RealType >(int32)>  GetPointFunc,
TArray< int32 > &  Merged,
int32 IdxFirst,
int32 IdxLast 
)
protected

◆ GetLine()

template<typename RealType >
TLine2< RealType > UE::Geometry::TConvexHull2< RealType >::GetLine ( TArrayView< const TVector2< RealType > >  Points) const
inline
Returns
the line spanned by a collinear input. Only meaningful if GetDimension() == 1

◆ GetNumUniquePoints()

template<typename RealType >
int32 UE::Geometry::TConvexHull2< RealType >::GetNumUniquePoints ( ) const
inline

Number of unique points considered by convex hull construction (excludes exact duplicate points and filtered-out points)

◆ GetPolygonIndices()

template<typename RealType >
TArray< int32 > const & UE::Geometry::TConvexHull2< RealType >::GetPolygonIndices ( ) const
inline
Returns
the calculated polygon vertices, as indices into the point set passed to Solve()

◆ GetTangent()

template<class RealType >
void UE::Geometry::TConvexHull2< RealType >::GetTangent ( TFunctionRef< TVector2< RealType >(int32)>  GetPointFunc,
TArray< int32 > &  Merged,
int32  j0,
int32  j1,
int32  j2,
int32  j3,
int32 i0,
int32 i1 
)
protected

◆ IsSolutionAvailable()

template<typename RealType >
bool UE::Geometry::TConvexHull2< RealType >::IsSolutionAvailable ( ) const
inline
Returns
true if convex hull is available

◆ Merge()

template<class RealType >
void UE::Geometry::TConvexHull2< RealType >::Merge ( TFunctionRef< TVector2< RealType >(int32)>  GetPointFunc,
TArray< int32 > &  Merged,
int32  j0,
int32  j1,
int32  j2,
int32  j3,
int32 i0,
int32 i1 
)
protected

◆ Solve() [1/3]

template<class RealType >
bool UE::Geometry::TConvexHull2< RealType >::Solve ( int32  NumPoints,
TFunctionRef< TVector2< RealType >(int32)>  GetPointFunc,
TFunctionRef< bool(int32)>  FilterFunc = [](int32 Idx) {return true;} 
)

Generate convex hull as long as input is not degenerate If input is degenerate, this will return false, and caller can call GetDimension() to determine whether the points were collinear, or all the same point

Parameters
NumPointsNumber of points to consider
GetPointFuncFunction providing array-style access into points
FilterFuncOptional filter to include only a subset of the points in the output hull
Returns
true if hull was generated, false if points span < 2 dimensions

◆ Solve() [2/3]

template<typename RealType >
bool UE::Geometry::TConvexHull2< RealType >::Solve ( TArrayView< const TVector2< RealType > >  Points)
inline

Generate convex hull as long as input is not degenerate If input is degenerate, this will return false, and caller can call GetDimension() to determine whether the points were collinear, or all the same point

Parameters
PointsArray of points to consider
Returns
true if hull was generated, false if points span < 2 dimensions

◆ Solve() [3/3]

template<typename RealType >
bool UE::Geometry::TConvexHull2< RealType >::Solve ( TArrayView< const TVector2< RealType > >  Points,
TFunctionRef< bool(int32)>  FilterFunc 
)
inline

Generate convex hull as long as input is not degenerate If input is degenerate, this will return false, and caller can call GetDimension() to determine whether the points were collinear, or all the same point

Parameters
PointsArray of points to consider
FilterOptional filter to include only a subset of the points in the output hull
Returns
true if hull was generated, false if points span < 2 dimensions

◆ SolveSimplePolygon()

template<typename RealType >
bool UE::Geometry::TConvexHull2< RealType >::SolveSimplePolygon ( int32  NumPolygonPoints,
TFunctionRef< TVector2< RealType >(int32)>  GetPointFunc,
bool  bIsKnownCCW = false 
)

Generate convex hull for a simple polygon If input has fewer than 3 points, will return false If input is not a simple polygon (e.g. if it has self-intersections), may not find a correct hull

Parameters
NumPolygonPointsNumber of points in the polygon
GetPointFuncFunction providing array-style access into the polygon points
bIsKnownCCWIf true, will save some processing time by assuming input is wound counter-clockwise
Returns
true if a hull was generated

Member Data Documentation

◆ Dimension

template<typename RealType >
int32 UE::Geometry::TConvexHull2< RealType >::Dimension = 0
protected

◆ Hull

template<typename RealType >
TArray<int32> UE::Geometry::TConvexHull2< RealType >::Hull
protected

◆ NumUniquePoints

template<typename RealType >
int32 UE::Geometry::TConvexHull2< RealType >::NumUniquePoints = 0
protected

The documentation for this class was generated from the following files: