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

#include <ConvexHull3.h>

Public Types

using FPolygonFace = TArray< int32, TInlineAllocator< 8 > >
 

Public Member Functions

GEOMETRYCORE_API bool Solve (int32 NumPoints, TFunctionRef< TVector< RealType >(int32)> GetPointFunc, TFunctionRef< bool(int32)> FilterFunc)
 
bool Solve (int32 NumPoints, TFunctionRef< TVector< RealType >(int32)> GetPointFunc)
 
template<typename VectorType >
bool Solve (TArrayView< const VectorType > Points, TFunctionRef< bool(int32)> FilterFunc)
 
template<typename VectorType >
bool Solve (TArrayView< const VectorType > Points)
 
bool IsSolutionAvailable () const
 
void GetTriangles (TFunctionRef< void(FIndex3i)> TriangleFunc)
 
TArray< FIndex3i > const & GetTriangles () const
 
GEOMETRYCORE_API void GetFaces (TFunctionRef< void(TArray< int32 > &, TVector< RealType >)> PolygonFunc, TFunctionRef< TVector< RealType >(int32)> GetPointFunc) const
 
GEOMETRYCORE_API void GetSimplifiedFaces (TFunctionRef< void(TArray< int32 > &, TVector< RealType >)> PolygonFunc, TFunctionRef< TVector< RealType >(int32)> GetPointFunc, RealType FaceAngleToleranceInDegrees=(RealType) 1.0, RealType PlaneDistanceTolerance=(RealType) 1.0) const
 
GEOMETRYCORE_API void GetSimplifiedFaces (TArray< FPolygonFace > &OutPolygons, TFunctionRef< TVector< RealType >(int32)> GetPointFunc, RealType FaceAngleToleranceInDegrees=(RealType) 1.0, RealType PlaneDistanceTolerance=(RealType) 1.0, TArray< TVector< RealType > > *OutPolygonNormals=nullptr) const
 
TArray< FIndex3i > const & GetTriangleNeighbors () const
 
TArray< FIndex3i > && MoveTriangles ()
 
template<typename VectorType >
TArray< THalfspace3< RealType > > GetAsHalfspaces (TArrayView< const VectorType > Points) const
 
template<typename VectorType >
TArray< THalfspace3< RealType > > GetAsHalfspaces (TFunctionRef< VectorType(int32)> GetPointFunc) const
 
void Empty ()
 
int GetDimension () const
 
TLine3< RealType > const & GetLine () const
 
TPlane3< RealType > const & GetPlane () const
 
int GetNumHullPoints () const
 

Static Public Member Functions

static GEOMETRYCORE_API double ComputeVolume (const TArrayView< const TVector< RealType > > Vertices)
 
static void WalkBorder (const TArray< FIndex3i > &Triangles, const TArray< FIndex3i > &TriangleNeighbors, TFunctionRef< bool(int32)> InGroupFunc, int32 StartIdx, TArray< int32 > &OutBorderVertexIndices)
 

Public Attributes

bool bSaveTriangleNeighbors = false
 
TConvexHullSimplificationSettings< RealType > SimplificationSettings
 
FProgressCancelProgress = nullptr
 

Protected Attributes

int32 Dimension
 
TLine3< RealType > Line
 
TPlane3< RealType > Plane
 
int NumHullPoints = 0
 
TArray< FIndex3iHull
 
TArray< FIndex3iHullNeighbors
 

Detailed Description

template<typename RealType>
class UE::Geometry::TConvexHull3< RealType >

Calculate the Convex Hull of a 3D point set as a Triangle Mesh

Member Typedef Documentation

◆ FPolygonFace

template<typename RealType >
using UE::Geometry::TConvexHull3< RealType >::FPolygonFace = TArray<int32, TInlineAllocator<8> >

Member Function Documentation

◆ ComputeVolume()

template<class RealType >
double UE::Geometry::TConvexHull3< RealType >::ComputeVolume ( const TArrayView< const TVector< RealType > >  Vertices)
static

◆ Empty()

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

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

◆ GetAsHalfspaces() [1/2]

template<typename RealType >
template<typename VectorType >
TArray< THalfspace3< RealType > > UE::Geometry::TConvexHull3< RealType >::GetAsHalfspaces ( TArrayView< const VectorType >  Points) const
inline

Convert an already-computed convex hull into a halfspace representation Following the logic of ContainmentQueries3.h, all halfspaces are oriented "outwards," so a point is inside the convex hull if it is outside of all halfspaces in the array

Parameters
PointsArray of points to consider
Returns
Array of halfspaces

◆ GetAsHalfspaces() [2/2]

template<typename RealType >
template<typename VectorType >
TArray< THalfspace3< RealType > > UE::Geometry::TConvexHull3< RealType >::GetAsHalfspaces ( TFunctionRef< VectorType(int32)>  GetPointFunc) const
inline

Convert an already-computed convex hull into a halfspace representation Following the logic of ContainmentQueries3.h, all halfspaces are oriented "outwards," so a point is inside the convex hull if it is outside of all halfspaces in the array

Parameters
GetPointFuncFunction providing array-style access into points
Returns
Array of halfspaces

◆ GetDimension()

template<typename RealType >
int UE::Geometry::TConvexHull3< RealType >::GetDimension ( ) const
inline

Number of dimensions spanned by the input points.

◆ GetFaces()

template<class RealType >
void UE::Geometry::TConvexHull3< RealType >::GetFaces ( TFunctionRef< void(TArray< int32 > &, TVector< RealType >)>  PolygonFunc,
TFunctionRef< TVector< RealType >(int32)>  GetPointFunc 
) const

Get faces of the convex hull as convex polygons, merging faces that are exactly coplanar

Parameters
PolygonFuncCallback to be called for each polygon, with the array of vertex indices and the face normal
GetPointFuncFunction providing array-style access into points

◆ GetLine()

template<typename RealType >
TLine3< RealType > const & UE::Geometry::TConvexHull3< RealType >::GetLine ( ) const
inline
Returns
If GetDimension() returns 1, this returns the line the data was on. Otherwise result is not meaningful.

◆ GetNumHullPoints()

template<typename RealType >
int UE::Geometry::TConvexHull3< RealType >::GetNumHullPoints ( ) const
inline
Returns
Number of points on the output hull

◆ GetPlane()

template<typename RealType >
TPlane3< RealType > const & UE::Geometry::TConvexHull3< RealType >::GetPlane ( ) const
inline
Returns
If GetDimension() returns 2, this returns the plane the data was on. Otherwise result is not meaningful.

◆ GetSimplifiedFaces() [1/2]

template<class RealType >
void UE::Geometry::TConvexHull3< RealType >::GetSimplifiedFaces ( TArray< FPolygonFace > &  OutPolygons,
TFunctionRef< TVector< RealType >(int32)>  GetPointFunc,
RealType  FaceAngleToleranceInDegrees = (RealType)1.0,
RealType  PlaneDistanceTolerance = (RealType)1.0,
TArray< TVector< RealType > > *  OutPolygonNormals = nullptr 
) const

Get faces of the convex hull as convex polygons, simplifying the hull by merging near-coplanar faces and only keeping vertices that are on the corner of at least three merged faces

Parameters
OutPolygonsPolygons of the convex hull faces, as arrays of indices into the original points
GetPointFuncFunction providing array-style access into points
FaceAngleToleranceInDegreesThe hull will be simplified by merging faces with less than this dihedral angle between them
PlaneDistanceToleranceFaces will not merge unless all points on the face are within this distance of the combined (average) face plane
OutPolygonNormalsOptional array of normals for each polygon

◆ GetSimplifiedFaces() [2/2]

template<class RealType >
void UE::Geometry::TConvexHull3< RealType >::GetSimplifiedFaces ( TFunctionRef< void(TArray< int32 > &, TVector< RealType >)>  PolygonFunc,
TFunctionRef< TVector< RealType >(int32)>  GetPointFunc,
RealType  FaceAngleToleranceInDegrees = (RealType)1.0,
RealType  PlaneDistanceTolerance = (RealType)1.0 
) const

Get faces of the convex hull as convex polygons, simplifying the hull by merging near-coplanar faces and only keeping vertices that are on the corner of at least three merged faces

Parameters
PolygonFuncCallback to be called for each polygon, with the array of vertex indices and the face normal
GetPointFuncFunction providing array-style access into points
FaceAngleToleranceInDegreesThe hull will be simplified by merging faces with less than this dihedral angle between them
PlaneDistanceToleranceFaces will not merge unless all points on the face are within this distance of the combined (average) face plane

◆ GetTriangleNeighbors()

template<typename RealType >
TArray< FIndex3i > const & UE::Geometry::TConvexHull3< RealType >::GetTriangleNeighbors ( ) const
inline

Only valid if bSaveTriangleNeighbors was true when Solve() was called

Returns
Neighbors of each hull triangle, in edge order – i.e., Nbr.A is the triangle across edge(Tri.A, Tri.B)

◆ GetTriangles() [1/2]

template<typename RealType >
TArray< FIndex3i > const & UE::Geometry::TConvexHull3< RealType >::GetTriangles ( ) const
inline
Returns
convex hull triangles

◆ GetTriangles() [2/2]

template<typename RealType >
void UE::Geometry::TConvexHull3< RealType >::GetTriangles ( TFunctionRef< void(FIndex3i)>  TriangleFunc)
inline

Call TriangleFunc for each triangle of the Convex Hull. The triangles index into the point set passed to Solve()

◆ IsSolutionAvailable()

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

◆ MoveTriangles()

template<typename RealType >
TArray< FIndex3i > && UE::Geometry::TConvexHull3< RealType >::MoveTriangles ( )
inline
Returns
convex hull triangles by a move

◆ Solve() [1/4]

template<typename RealType >
bool UE::Geometry::TConvexHull3< RealType >::Solve ( int32  NumPoints,
TFunctionRef< TVector< RealType >(int32)>  GetPointFunc 
)
inline

◆ Solve() [2/4]

template<class RealType >
bool UE::Geometry::TConvexHull3< RealType >::Solve ( int32  NumPoints,
TFunctionRef< TVector< RealType >(int32)>  GetPointFunc,
TFunctionRef< bool(int32)>  FilterFunc 
)

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 coplanar, 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() [3/4]

template<typename RealType >
template<typename VectorType >
bool UE::Geometry::TConvexHull3< RealType >::Solve ( TArrayView< const VectorType >  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() [4/4]

template<typename RealType >
template<typename VectorType >
bool UE::Geometry::TConvexHull3< RealType >::Solve ( TArrayView< const VectorType >  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
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

◆ WalkBorder()

template<typename RealType >
void UE::Geometry::TConvexHull3< RealType >::WalkBorder ( const TArray< FIndex3i > &  Triangles,
const TArray< FIndex3i > &  TriangleNeighbors,
TFunctionRef< bool(int32)>  InGroupFunc,
int32  StartIdx,
TArray< int32 > &  OutBorderVertexIndices 
)
static

Member Data Documentation

◆ bSaveTriangleNeighbors

template<typename RealType >
bool UE::Geometry::TConvexHull3< RealType >::bSaveTriangleNeighbors = false

Whether neighbors for the hull triangles should be computed/saved. If true, can call GetTriangleNeighbors() after Solve().

◆ Dimension

template<typename RealType >
int32 UE::Geometry::TConvexHull3< RealType >::Dimension
protected

◆ Hull

template<typename RealType >
TArray<FIndex3i> UE::Geometry::TConvexHull3< RealType >::Hull
protected

◆ HullNeighbors

template<typename RealType >
TArray<FIndex3i> UE::Geometry::TConvexHull3< RealType >::HullNeighbors
protected

◆ Line

template<typename RealType >
TLine3<RealType> UE::Geometry::TConvexHull3< RealType >::Line
protected

◆ NumHullPoints

template<typename RealType >
int UE::Geometry::TConvexHull3< RealType >::NumHullPoints = 0
protected

◆ Plane

template<typename RealType >
TPlane3<RealType> UE::Geometry::TConvexHull3< RealType >::Plane
protected

◆ Progress

template<typename RealType >
FProgressCancel* UE::Geometry::TConvexHull3< RealType >::Progress = nullptr

Set this to be able to cancel running operation

◆ SimplificationSettings

template<typename RealType >
TConvexHullSimplificationSettings<RealType> UE::Geometry::TConvexHull3< RealType >::SimplificationSettings

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