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

#include <ConvexDecomposition3.h>

Classes

struct  FConvexPart
 
struct  FMergeSettings
 
struct  FPreprocessMeshOptions
 
struct  FProximity
 

Public Member Functions

 FConvexDecomposition3 ()
 
 FConvexDecomposition3 (const FDynamicMesh3 &SourceMesh, bool bMergeEdges=true)
 
 FConvexDecomposition3 (const FDynamicMesh3 &SourceMesh, const FPreprocessMeshOptions &Options)
 
bool IsInputSolid ()
 
GEOMETRYCORE_API void InitializeFromHulls (int32 NumHulls, TFunctionRef< double(int32)> HullVolumes, TFunctionRef< int32(int32)> HullNumVertices, TFunctionRef< FVector3d(int32, int32)> HullVertices, TArrayView< const TPair< int32, int32 > > Proximity)
 
GEOMETRYCORE_API void InitializeProximityFromDecompositionBoundingBoxOverlaps (double BoundsExpandByMinDimFactor, double BoundsExpandByMaxDimFactor, double MinBoundsExpand)
 
GEOMETRYCORE_API void InitializeFromMesh (const FDynamicMesh3 &SourceMesh, bool bMergeEdges)
 
GEOMETRYCORE_API void InitializeFromMesh (const FDynamicMesh3 &SourceMesh, const FPreprocessMeshOptions &Options)
 
GEOMETRYCORE_API void InitializeFromIndexMesh (TArrayView< const FVector3f > Vertices, TArrayView< const FIntVector > Faces, bool bMergeEdges, int32 FaceVertexOffset=0)
 
GEOMETRYCORE_API void InitializeFromIndexMesh (TArrayView< const FVector3f > Vertices, TArrayView< const FIntVector > Faces, const FPreprocessMeshOptions &Options, int32 FaceVertexOffset=0)
 
GEOMETRYCORE_API bool InitializeNegativeSpace (const FNegativeSpaceSampleSettings &Settings, TArrayView< const FVector3d > RequestedSamples=TArrayView< const FVector3d >())
 
GEOMETRYCORE_API void Compute (int32 NumOutputHulls, int32 NumAdditionalSplits=10, double ErrorTolerance=0.0, double MinThicknessTolerance=0, int32 MaxOutputHulls=-1, bool bOnlySplitIfNegativeSpaceCovered=false)
 
GEOMETRYCORE_API int32 SplitWorst (bool bCanSkipUnreliableGeoVolumes=false, double ErrorTolerance=0.0, bool bOnlySplitIfNegativeSpaceCovered=false, double MinSplitSizeInWorldSpace=-1)
 
GEOMETRYCORE_API int32 MergeBest (int32 TargetNumParts, double ErrorTolerance=0, double MinThicknessTolerance=0, bool bAllowCompact=true, bool bRequireHullTriangles=false, int32 MaxOutputHulls=-1, const FSphereCovering *OptionalNegativeSpace=nullptr, const FTransform *OptionalTransformIntoNegativeSpace=nullptr)
 
GEOMETRYCORE_API int32 MergeBest (const FMergeSettings &Settings)
 
double ConvertDistanceToleranceToLocalVolumeTolerance (double DistTolerance) const
 
double ConvertDistanceToleranceToLocalSpace (double DistTolerance) const
 
void Compact ()
 
int32 NumHulls () const
 
TArray< FIndex3i > const & GetTriangles (int32 HullIdx) const
 
template<typename RealType >
TArray< TVector< RealType > > GetVertices (int32 HullIdx, bool bTransformedToOutput=true) const
 
FDynamicMesh3 GetHullMesh (int32 HullIdx) const
 
const FDynamicMesh3GetInternalMesh (int32 HullIdx) const
 
const int32 GetHullSourceID (int32 HullIdx) const
 
const int32 CountMergedParts () const
 
GEOMETRYCORE_API void DeleteProximity (TArray< int32 > &&ToRemove, bool bDeleteMapReferences)
 
GEOMETRYCORE_API void UpdateProximitiesAfterSplit (int32 SplitIdx, int32 NewIdxStart, FPlane3d CutPlane, int32 SecondSideIdxStart, double OrigHullVolume)
 
GEOMETRYCORE_API void FixHullOverlapsInNegativeSpace (double NegativeSpaceTolerance=UE_DOUBLE_KINDA_SMALL_NUMBER, double NegativeSpaceMinRadius=UE_DOUBLE_KINDA_SMALL_NUMBER)
 
const FSphereCoveringGetNegativeSpace () const
 

Static Public Member Functions

static GEOMETRYCORE_API bool ConvexPartVsSphereOverlap (const FConvexPart &Part, FVector3d Center, double Radius, const FTransform *TransformIntoSphereSpace=nullptr, double *OutDistanceSq=nullptr)
 

Public Attributes

double ProximityTolerance = 1e-3
 
double ConnectedComponentTolerance = 1e-3
 
double OnPlaneTolerance = 1e-7
 
double CutLargestAxisErrorScale = .99
 
double ConvexEdgeAngleMoreSamplesThreshold = 30
 
double ConvexEdgeAngleThreshold = 170
 
double BiasToRemoveTooThinParts = .1
 
int32 MaxConvexEdgePlanes = 50
 
bool bSplitDisconnectedComponents = true
 
bool bTreatAsSolid = true
 
double ThickenAfterHullFailure = 0
 
int32 RestrictMergeSearchToLocalAfterTestNumConnections = -1
 
TIndirectArray< FConvexPartDecomposition
 
FTransformSRT3d ResultTransform = FTransformSRT3d::Identity()
 Transform taking the result hull vertices back to the original space of the inputs; automatically applied by GetVertices()
 
TArray< FProximityProximities
 
TMultiMap< int32, int32DecompositionToProximity
 

Constructor & Destructor Documentation

◆ FConvexDecomposition3() [1/3]

UE::Geometry::FConvexDecomposition3::FConvexDecomposition3 ( )
inline

◆ FConvexDecomposition3() [2/3]

UE::Geometry::FConvexDecomposition3::FConvexDecomposition3 ( const FDynamicMesh3 SourceMesh,
bool  bMergeEdges = true 
)
inline

◆ FConvexDecomposition3() [3/3]

UE::Geometry::FConvexDecomposition3::FConvexDecomposition3 ( const FDynamicMesh3 SourceMesh,
const FPreprocessMeshOptions Options 
)
inline

Member Function Documentation

◆ Compact()

void UE::Geometry::FConvexDecomposition3::Compact ( )
inline

◆ Compute()

void UE::Geometry::FConvexDecomposition3::Compute ( int32  NumOutputHulls,
int32  NumAdditionalSplits = 10,
double  ErrorTolerance = 0.0,
double  MinThicknessTolerance = 0,
int32  MaxOutputHulls = -1,
bool  bOnlySplitIfNegativeSpaceCovered = false 
)

Compute a decomposition with the desired number of hulls Note: A future version of this function may replace NumOutputHulls with MaxOutputHulls, but this version keeps both parameters for compatibility / consistent behavior.

Parameters
NumOutputHullsNumber of convex hulls to use in the final convex decomposition
NumAdditionalSplitsHow far to go beyond the target number of hulls when initially the mesh into pieces – larger values will require more computation but can find better convex decompositions
ErrorToleranceStop splitting when hulls have error less than this (expressed in cm; will be cubed for volumetric error). Overrides NumOutputHulls if specified
MinThicknessToleranceOptionally specify a minimum thickness (in cm) for convex parts; parts below this thickness will always be merged away. Overrides NumOutputHulls and ErrorTolerance when needed
MaxOutputHullsIf > 0, maximum number of convex hulls to generate. Overrides ErrorTolerance and TargetNumParts when needed
bOnlySplitIfOverlapNegativeSpaceIf true, use NegativeSpace to guide splits, and only split parts that overlap negative space

◆ ConvertDistanceToleranceToLocalSpace()

double UE::Geometry::FConvexDecomposition3::ConvertDistanceToleranceToLocalSpace ( double  DistTolerance) const
inline

◆ ConvertDistanceToleranceToLocalVolumeTolerance()

double UE::Geometry::FConvexDecomposition3::ConvertDistanceToleranceToLocalVolumeTolerance ( double  DistTolerance) const
inline

◆ ConvexPartVsSphereOverlap()

bool UE::Geometry::FConvexDecomposition3::ConvexPartVsSphereOverlap ( const FConvexPart Part,
FVector3d  Center,
double  Radius,
const FTransform TransformIntoSphereSpace = nullptr,
double OutDistanceSq = nullptr 
)
static

◆ CountMergedParts()

const int32 UE::Geometry::FConvexDecomposition3::CountMergedParts ( ) const
inline

◆ DeleteProximity()

void UE::Geometry::FConvexDecomposition3::DeleteProximity ( TArray< int32 > &&  ToRemove,
bool  bDeleteMapReferences 
)

◆ FixHullOverlapsInNegativeSpace()

void UE::Geometry::FConvexDecomposition3::FixHullOverlapsInNegativeSpace ( double  NegativeSpaceTolerance = UE_DOUBLE_KINDA_SMALL_NUMBER,
double  NegativeSpaceMinRadius = UE_DOUBLE_KINDA_SMALL_NUMBER 
)

◆ GetHullMesh()

FDynamicMesh3 UE::Geometry::FConvexDecomposition3::GetHullMesh ( int32  HullIdx) const
inline

◆ GetHullSourceID()

const int32 UE::Geometry::FConvexDecomposition3::GetHullSourceID ( int32  HullIdx) const
inline

◆ GetInternalMesh()

const FDynamicMesh3 & UE::Geometry::FConvexDecomposition3::GetInternalMesh ( int32  HullIdx) const
inline

◆ GetNegativeSpace()

const FSphereCovering & UE::Geometry::FConvexDecomposition3::GetNegativeSpace ( ) const
inline

◆ GetTriangles()

TArray< FIndex3i > const & UE::Geometry::FConvexDecomposition3::GetTriangles ( int32  HullIdx) const
inline
Returns
convex hull triangles

◆ GetVertices()

template<typename RealType >
TArray< TVector< RealType > > UE::Geometry::FConvexDecomposition3::GetVertices ( int32  HullIdx,
bool  bTransformedToOutput = true 
) const
inline

◆ InitializeFromHulls()

void UE::Geometry::FConvexDecomposition3::InitializeFromHulls ( int32  NumHulls,
TFunctionRef< double(int32)>  HullVolumes,
TFunctionRef< int32(int32)>  HullNumVertices,
TFunctionRef< FVector3d(int32, int32)>  HullVertices,
TArrayView< const TPair< int32, int32 > >  Proximity 
)

Initialize from convex hulls allows the caller to only use the hull merging phase of the algorithm

Parameters
NumHullsNumber of convex hulls in the initial decomposition
HullVolumesFunction from Hull Index -> Hull Volume
HullNumVerticesFunction from Hull Index -> Hull Vertex Count
HullVerticesFunction from Hull Index, Vertex Index -> Hull Vertex Position
ProximityAll the local proximities for the hulls. Hulls will not be merged unless they are connected by this proximity graph.

◆ InitializeFromIndexMesh() [1/2]

void UE::Geometry::FConvexDecomposition3::InitializeFromIndexMesh ( TArrayView< const FVector3f Vertices,
TArrayView< const FIntVector Faces,
bool  bMergeEdges,
int32  FaceVertexOffset = 0 
)

Initialize convex decomposition with a triangle index mesh

Parameters
VerticesVertex buffer for mesh to decompose
FacesTriangle buffer for mesh to decompose
bMergeEdgesWhether to attempt to weld matching edges before computing the convex hull; this can help the convex decomposition find better cutting planes for meshes that have boundaries e.g. due to seams
FaceVertexOffsetIndices from the Faces array are optionally offset by this value. Useful e.g. to take slices of the multi-geometry vertex and face buffers of FGeometryCollection.

◆ InitializeFromIndexMesh() [2/2]

void UE::Geometry::FConvexDecomposition3::InitializeFromIndexMesh ( TArrayView< const FVector3f Vertices,
TArrayView< const FIntVector Faces,
const FPreprocessMeshOptions Options,
int32  FaceVertexOffset = 0 
)

Initialize convex decomposition with a triangle index mesh

Parameters
VerticesVertex buffer for mesh to decompose
FacesTriangle buffer for mesh to decompose
OptionsOptions for pre-processing the mesh before decomposition (e.g., to weld matching edges, thicken degenerate inputs, or to run a general pre-process lambda function)
FaceVertexOffsetIndices from the Faces array are optionally offset by this value. Useful e.g. to take slices of the multi-geometry vertex and face buffers of FGeometryCollection.

◆ InitializeFromMesh() [1/2]

void UE::Geometry::FConvexDecomposition3::InitializeFromMesh ( const FDynamicMesh3 SourceMesh,
bool  bMergeEdges 
)

◆ InitializeFromMesh() [2/2]

void UE::Geometry::FConvexDecomposition3::InitializeFromMesh ( const FDynamicMesh3 SourceMesh,
const FPreprocessMeshOptions Options 
)

◆ InitializeNegativeSpace()

bool UE::Geometry::FConvexDecomposition3::InitializeNegativeSpace ( const FNegativeSpaceSampleSettings Settings,
TArrayView< const FVector3d RequestedSamples = TArrayView<const FVector3d>() 
)

Find negative space that should be protected. Uses the mesh passed on construction or to InitializeFromMesh or InitializeFromIndexMesh

Parameters
SettingsSettings to use to find the negative space
Returns
False on failure – e.g., if there was no mesh available

◆ InitializeProximityFromDecompositionBoundingBoxOverlaps()

void UE::Geometry::FConvexDecomposition3::InitializeProximityFromDecompositionBoundingBoxOverlaps ( double  BoundsExpandByMinDimFactor,
double  BoundsExpandByMaxDimFactor,
double  MinBoundsExpand 
)

Create the proximity graph from the current decomposition, using bounding box overlaps. To consider non-overlapping proximity, the bounding boxes can be expanded by a factor of their own size or by an absolute amount.

Parameters
BoundsExpandByMinDimFactorPart bounds will be expanded by at least this factor of their own min dimension, before finding overlaps
BoundsExpandByMaxDimFactorPart bounds will be expanded by at least this factor of their own max dimension, before finding overlaps
MinBoundsExpandPart bounds will be expanded by at least this fixed amount, before finding overlaps

◆ IsInputSolid()

bool UE::Geometry::FConvexDecomposition3::IsInputSolid ( )
inline

Test whether the input mesh (after preprocessing) is solid. Must be called after initialization, but before decomposition is computed.

◆ MergeBest() [1/2]

int32 UE::Geometry::FConvexDecomposition3::MergeBest ( const FMergeSettings Settings)

◆ MergeBest() [2/2]

int32 UE::Geometry::FConvexDecomposition3::MergeBest ( int32  TargetNumParts,
double  ErrorTolerance = 0,
double  MinThicknessTolerance = 0,
bool  bAllowCompact = true,
bool  bRequireHullTriangles = false,
int32  MaxOutputHulls = -1,
const FSphereCovering OptionalNegativeSpace = nullptr,
const FTransform OptionalTransformIntoNegativeSpace = nullptr 
)

◆ NumHulls()

int32 UE::Geometry::FConvexDecomposition3::NumHulls ( ) const
inline

◆ SplitWorst()

int32 UE::Geometry::FConvexDecomposition3::SplitWorst ( bool  bCanSkipUnreliableGeoVolumes = false,
double  ErrorTolerance = 0.0,
bool  bOnlySplitIfNegativeSpaceCovered = false,
double  MinSplitSizeInWorldSpace = -1 
)

◆ UpdateProximitiesAfterSplit()

void UE::Geometry::FConvexDecomposition3::UpdateProximitiesAfterSplit ( int32  SplitIdx,
int32  NewIdxStart,
FPlane3d  CutPlane,
int32  SecondSideIdxStart,
double  OrigHullVolume 
)

Member Data Documentation

◆ BiasToRemoveTooThinParts

double UE::Geometry::FConvexDecomposition3::BiasToRemoveTooThinParts = .1

◆ bSplitDisconnectedComponents

bool UE::Geometry::FConvexDecomposition3::bSplitDisconnectedComponents = true

◆ bTreatAsSolid

bool UE::Geometry::FConvexDecomposition3::bTreatAsSolid = true

◆ ConnectedComponentTolerance

double UE::Geometry::FConvexDecomposition3::ConnectedComponentTolerance = 1e-3

◆ ConvexEdgeAngleMoreSamplesThreshold

double UE::Geometry::FConvexDecomposition3::ConvexEdgeAngleMoreSamplesThreshold = 30

◆ ConvexEdgeAngleThreshold

double UE::Geometry::FConvexDecomposition3::ConvexEdgeAngleThreshold = 170

◆ CutLargestAxisErrorScale

double UE::Geometry::FConvexDecomposition3::CutLargestAxisErrorScale = .99

◆ Decomposition

TIndirectArray<FConvexPart> UE::Geometry::FConvexDecomposition3::Decomposition

◆ DecompositionToProximity

TMultiMap<int32, int32> UE::Geometry::FConvexDecomposition3::DecompositionToProximity

◆ MaxConvexEdgePlanes

int32 UE::Geometry::FConvexDecomposition3::MaxConvexEdgePlanes = 50

◆ OnPlaneTolerance

double UE::Geometry::FConvexDecomposition3::OnPlaneTolerance = 1e-7

◆ Proximities

TArray<FProximity> UE::Geometry::FConvexDecomposition3::Proximities

◆ ProximityTolerance

double UE::Geometry::FConvexDecomposition3::ProximityTolerance = 1e-3

◆ RestrictMergeSearchToLocalAfterTestNumConnections

int32 UE::Geometry::FConvexDecomposition3::RestrictMergeSearchToLocalAfterTestNumConnections = -1

◆ ResultTransform

FTransformSRT3d UE::Geometry::FConvexDecomposition3::ResultTransform = FTransformSRT3d::Identity()

Transform taking the result hull vertices back to the original space of the inputs; automatically applied by GetVertices()

◆ ThickenAfterHullFailure

double UE::Geometry::FConvexDecomposition3::ThickenAfterHullFailure = 0

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