Navigation
API > API/Plugins > API/Plugins/DynamicMesh
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.
| Name | FMeshSimpleShapeApproximation |
| Type | class |
| Header File | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/ShapeApproximation/MeshSimpleShapeApproximation.h |
| Include Path | #include "ShapeApproximation/MeshSimpleShapeApproximation.h" |
Syntax
class FMeshSimpleShapeApproximation
Structs
| Name | Remarks |
|---|---|
| FSourceMeshCache |
Enums
Public
| Name | Remarks |
|---|---|
| EProjectedHullAxisMode | Type/Mode for deciding 3D axis to use in Generate_ProjectedHulls() |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bConvexDecompositionProtectNegativeSpace | bool | Whether to use 'navigation-driven' convex decomposition using NegativeSpaceTolerance and NegativeSpaceMinRadius to define space that the decomposition hulls cannot occupy | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bDecompositionPreSimplifyWithEdgeLength | bool | Whether to use apply an edge-length based simplification to the input before running convex decompositions. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bDetectBoxes | bool | Should boxes be auto-detected | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bDetectCapsules | bool | Should capsules be auto-detected | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bDetectConvexes | bool | Should convex be auto-detected | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bDetectSpheres | bool | Configuration parameters Should spheres be auto-detected | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bIgnoreInternalNegativeSpace | bool | Whether to ignore negative space that is not accessible by traversing from the convex hull (via paths w/ radius of at least Negative Space Tolerance) | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bSimplifyHulls | bool | Should hulls be simplified as a post-process | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bUseConvexDecompositionMaxPieces | bool | Whether to use the above Max Pieces to drive the convex decomposition. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| bUseExactComputationForBox | bool | ShapeApproximation/MeshSimpleShapeApproximation.h | ||
| ConvexDecompositionErrorTolerance | double | Error tolerance to guide convex decomposition (in cm); we stop adding new parts if the volume error is below the threshold. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| ConvexDecompositionMaxPieces | int32 | How many convex pieces to target per mesh when creating convex decompositions. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| ConvexDecompositionMinPartThickness | double | Minimum part thickness for convex decomposition (in cm); hulls thinner than this will be merged into adjacent hulls, if possible. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| ConvexDecompositionSearchFactor | float | How much additional decomposition decomposition + merging to do, as a fraction of max pieces. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| DecompositionPreSimplifyEdgeLength | double | If enabled by the above bool flag, pre-simplify input geometry to this edge length before computing convex decompositions. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| HullSimplifyTolerance | double | Simplification tolerance when simplifying 2D convex hulls, eg for swept/projected hulls | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| HullTargetFaceCount | int32 | Target number of triangles when simplifying 3D convex hulls | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| LevelSetGridResolution | int32 | Level Set Grid resolution along longest axis | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| MinDimension | double | Minimal dimension of fit shapes, eg thickness/radius/etc (currently only enforced in certain cases) | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| NegativeSpaceMinRadius | double | Minimum radius of negative space to protect; tunnels with radius smaller than this could be filled in | ShapeApproximation/MeshSimpleShapeApproximation.h | |
| NegativeSpaceTolerance | double | Negative space closer to the input than this tolerance distance can be filled in | ShapeApproximation/MeshSimpleShapeApproximation.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Generate_AlignedBoxes
(
FSimpleShapeSet3d& ShapeSetOut |
Approximation generators Fit containing axis-aligned boxes to each input mesh and store in ShapeSetOut | ShapeApproximation/MeshSimpleShapeApproximation.h | |
void Generate_Capsules
(
FSimpleShapeSet3d& ShapeSetOut |
Fit containing approximate-minimum-volume capsules to each input mesh and store in ShapeSetOut | ShapeApproximation/MeshSimpleShapeApproximation.h | |
void Generate_ConvexHullDecompositions
(
FSimpleShapeSet3d& ShapeSetOut, |
Calculate multiple 3D Convex Hulls for each input mesh and store in ShapeSetOut. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
void Generate_ConvexHulls
(
FSimpleShapeSet3d& ShapeSetOut, |
Calculate 3D Convex Hulls for each input mesh and store in ShapeSetOut. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
void Generate_LevelSets
(
FSimpleShapeSet3d& ShapeSetOut, |
ShapeApproximation/MeshSimpleShapeApproximation.h | ||
void Generate_MinimalSpheres
(
FSimpleShapeSet3d& ShapeSetOut |
Fit containing minimal-volume spheres to each input mesh and store in ShapeSetOut | ShapeApproximation/MeshSimpleShapeApproximation.h | |
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 | ShapeApproximation/MeshSimpleShapeApproximation.h | |
void Generate_OrientedBoxes
(
FSimpleShapeSet3d& ShapeSetOut, |
Fit containing minimal-volume oriented boxes to each input mesh and store in ShapeSetOut | ShapeApproximation/MeshSimpleShapeApproximation.h | |
void Generate_ProjectedHulls
(
FSimpleShapeSet3d& ShapeSetOut, |
Calculate Projected Convex Hulls for each input mesh and store in ShapeSetOut. | ShapeApproximation/MeshSimpleShapeApproximation.h | |
void InitializeSourceMeshes
(
const TArray< const FDynamicMesh3* >& InputMeshSet |
Setup/initialization Initialize internal mesh sets. | ShapeApproximation/MeshSimpleShapeApproximation.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void DetectAndCacheSimpleShapeType
(
const FDynamicMesh3* SourceMesh, |
ShapeApproximation/MeshSimpleShapeApproximation.h | ||
bool GetDetectedSimpleShape
(
const FSourceMeshCache& Cache, |
ShapeApproximation/MeshSimpleShapeApproximation.h |