semantic_digital_twin.pipeline.mesh_decomposer#
Classes#
Approximation shape type |
|
Manifold preprocessing mode |
|
MeshDecomposer is an abstract base class for decomposing complex 3D meshes into simpler convex components. |
|
COACDMeshDecomposer is a class for decomposing complex 3D meshes into simpler convex components |
Module Contents#
- class semantic_digital_twin.pipeline.mesh_decomposer.ApproximationMode#
Bases:
enum.StrEnumApproximation shape type
- BOX = 'box'#
- CONVEX_HULL = 'ch'#
- class semantic_digital_twin.pipeline.mesh_decomposer.PreprocessingMode#
Bases:
enum.StrEnumManifold preprocessing mode
- AUTO = 'auto'#
Automatically chose based on the geometry.
- ON = 'on'#
Force turn on the pre-processing
- OFF = 'off'#
Force turn off the pre-processing
- class semantic_digital_twin.pipeline.mesh_decomposer.MeshDecomposer#
Bases:
semantic_digital_twin.pipeline.pipeline.Step,abc.ABCMeshDecomposer is an abstract base class for decomposing complex 3D meshes into simpler convex components. It provides methods to apply the decomposition to meshes, shapes, bodies, and entire worlds. Subclasses should implement the apply_to_mesh method to define the specific decomposition algorithm. 3D meshes are represented using the trimesh library, and the decomposed parts are returned as a list of TriangleMesh objects.
- abstract apply_to_mesh(mesh: semantic_digital_twin.world_description.geometry.Mesh) List[semantic_digital_twin.world_description.geometry.TriangleMesh]#
Apply the mesh decomposition to a given mesh. Returns a list of TriangleMesh objects representing the decomposed convex parts.
- apply_to_shape(shape: semantic_digital_twin.world_description.geometry.Shape) List[semantic_digital_twin.world_description.geometry.Shape]#
Apply the mesh decomposition to a given shape. If the shape is a Mesh, it will be decomposed into multiple TriangleMesh objects. Otherwise, the shape will be returned as is in a list.
- apply_to_body(body: semantic_digital_twin.world_description.world_entity.Body) semantic_digital_twin.world_description.world_entity.Body#
Apply the mesh decomposition to all shapes in a given body. The body’s collision shapes will be replaced with the decomposed shapes. Returns the modified body.
- class semantic_digital_twin.pipeline.mesh_decomposer.COACDMeshDecomposer#
Bases:
MeshDecomposerCOACDMeshDecomposer is a class for decomposing complex 3D meshes into simpler convex components using the COACD (Convex Optimization for Approximate Convex Decomposition) algorithm. It is designed to preprocess, analyze, and process 3D meshes with a focus on efficiency and scalability in fields such as robotics, gaming, and simulation.
Check SarahWeiii/CoACD for further details.
- threshold: float = 0.05#
Concavity threshold for terminating the decomposition (0.01 - 1)
- max_convex_hull: int | None = None#
Maximum number of convex hulls in the result. Works only when merge is enabled (may introduce convex hull with a concavity larger than the threshold)
- preprocess_mode: PreprocessingMode#
Manifold preprocessing mode.
- preprocess_resolution: int = 50#
Resolution for manifold preprocess (20~100)
- resolution: int = 2000#
Sampling resolution for Hausdorff distance calculation (1 000 - 10 000)
- search_nodes: int = 20#
Max number of child nodes in the monte carlo tree search (10 - 40).
- search_iterations: int = 150#
Number of search iterations in the monte carlo tree search (60 - 2000).
- search_depth: int = 3#
Maximum search depth in the monte carlo tree search (2 - 7).
- pca: bool = False#
Enable PCA pre-processing
- merge: bool = True#
Enable merge postprocessing.
- max_convex_hull_vertices: int | None = None#
Maximum vertex value for each convex hull, only when decimate is enabled.
- extrude_margin: float | None = None#
Extrude margin, only when extrude is enabled
- approximation_mode: ApproximationMode#
Approximation mode to use.
- seed: int#
Random seed used for sampling.
- apply_to_mesh(mesh: semantic_digital_twin.world_description.geometry.Mesh) List[semantic_digital_twin.world_description.geometry.TriangleMesh]#
Apply the COACD mesh decomposition to a given mesh. Returns a list of TriangleMesh objects representing the decomposed convex parts.