huggingface / huggingface/simulate
Meshes for non-convex polygons
- Dominant language
- Python
- Stars
- 195
- Forks
- 13
- Avg merge
- 58m
- Merged PRs (30d)
- 1
Description
Collider-meshes for non-convex polygons currently require re-building a polygon out of invisible components or an advanced integration of a V-HACD algorithm for re-constructing a non-convex mesh as a convex set of meshes.
Some resources for solving this:
Code snippet that would work if `trimesh` has an installed `v-hacd` binary:
```python
extract_mesh = land.mesh.extract_surface().triangulate()
faces_as_array = extract_mesh.faces.reshape((extract_mesh.n_faces, 4))[:, 1:]
tmesh = trimesh.Trimesh(land.mesh.points, faces_as_array)
meshes = trimesh.interfaces.vhacd.convex_decomposition(tmesh)
```
(reliant on [converting meshes](https://github.com/pyvista/pyvista/discussions/2268) from `pyvista`)
Other:
* [Habitat](https://github.com/facebookresearch/habitat-sim/tree/main/src/deps) builds a old VHACD from source as a dependency
* a [unity VHACD](https://github.com/Unity-Technologies/VHACD)
* the most popular [v-hacd repo](https://github.com/kmammou/v-hacd) (one C file to use it)
Contributor guide
Assessment
This issue has not been assessed yet.