Navigation
API > API/Plugins > API/Plugins/DynamicMesh > API/Plugins/DynamicMesh/ShapeApproximation
References
| Module | DynamicMesh |
| Header | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/ShapeApproximation/MeshSimpleShapeApproximation.h |
| Include | #include "ShapeApproximation/MeshSimpleShapeApproximation.h" |
Syntax
class FMeshSimpleShapeApproximation
Remarks
FMeshSimpleShapeApproximation can calculate various "simple" shape approximations for a set of meshes, by fitting various primitives/hulls/etc to each mesh. The assumption is that the input mesh(es) are already partitioned into pieces.
There are various Generate_X() functions which apply different strategies, generally to fit a containing simple shape or hull to the mesh. However in addition to these explicit strategies, input meshes that are very close to approximations of spheres/boxes/capsules (ie basically meshed versions of these primitives) can be identified and used directly, skipping the fitting process.
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | bDetectBoxes | Should boxes be auto-detected | |
| bool | bDetectCapsules | Should capsules be auto-detected | |
| bool | bDetectConvexes | Should convex be auto-detected | |
| bool | bDetectSpheres | Configuration parametersShould spheres be auto-detected | |
| bool | bSimplifyHulls | Should hulls be simplified as a post-process | |
| bool | bUseExactComputationForBox | ||
| double | ConvexDecompositionErrorTolerance | Error tolerance to guide convex decomposition (in cm); we stop adding new parts if the volume error is below the threshold. | |
| int32 | ConvexDecompositionMaxPieces | How many convex pieces to target per mesh when creating convex decompositions. | |
| double | ConvexDecompositionMinPartThickness | Minimum part thickness for convex decomposition (in cm); hulls thinner than this will be merged into adjacent hulls, if possible. | |
| float | ConvexDecompositionSearchFactor | How much additional decomposition decomposition + merging to do, as a fraction of max pieces. | |
| double | HullSimplifyTolerance | Simplification tolerance when simplifying 2D convex hulls, eg for swept/projected hulls | |
| int32 | HullTargetFaceCount | Target number of triangles when simplifying 3D convex hulls | |
| int32 | LevelSetGridResolution | Level Set Grid resolution along longest axis | |
| double | MinDimension | Minimal dimension of fit shapes, eg thickness/radius/etc (currently only enforced in certain cases) | |
| TArray< FSourceMeshCache > | SourceMeshCaches | ||
| TArray< const FDynamicMesh3 * > | SourceMeshes |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | DetectAndCacheSimpleShapeType
(
const FDynamicMesh3* SourceMesh, |
||
| void | Generate_AlignedBoxes
(
FSimpleShapeSet3d& ShapeSetOut |
Approximation generators Fit containing axis-aligned boxes to each input mesh and store in ShapeSetOut | |
| void | Generate_Capsules
(
FSimpleShapeSet3d& ShapeSetOut |
Fit containing approximate-minimum-volume capsules to each input mesh and store in ShapeSetOut | |
| void | Generate_ConvexHullDecompositions
(
FSimpleShapeSet3d& ShapeSetOut, |
Calculate multiple 3D Convex Hulls for each input mesh and store in ShapeSetOut. | |
| void | Generate_ConvexHulls
(
FSimpleShapeSet3d& ShapeSetOut, |
Calculate 3D Convex Hulls for each input mesh and store in ShapeSetOut. | |
| void | Generate_LevelSets
(
FSimpleShapeSet3d& ShapeSetOut, |
||
| void | Generate_MinimalSpheres
(
FSimpleShapeSet3d& ShapeSetOut |
Fit containing minimal-volume spheres to each input mesh and store in ShapeSetOut | |
| void | Generate_MinVolume
(
FSimpleShapeSet3d& ShapeSetOut |
Fit containing axis-aligned box, oriented box, capsule, and sphere to each input mesh, and store the one with smallest volume in ShapeSetOut | |
| void | Generate_OrientedBoxes
(
FSimpleShapeSet3d& ShapeSetOut, |
Fit containing minimal-volume oriented boxes to each input mesh and store in ShapeSetOut | |
| void | Generate_ProjectedHulls
(
FSimpleShapeSet3d& ShapeSetOut, |
Calculate Projected Convex Hulls for each input mesh and store in ShapeSetOut. | |
| bool | GetDetectedSimpleShape
(
const FSourceMeshCache& Cache, |
||
| void | InitializeSourceMeshes
(
const TArray< const FDynamicMesh3* >& InputMeshSet |
Setup/initialization Initialize internal mesh sets. |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FSourceMeshCache |
Enums
| Type | Name | Description | |
|---|---|---|---|
| EProjectedHullAxisMode | Type/Mode for deciding 3D axis to use in Generate_ProjectedHulls() |