mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
3k stars 580 forks source link

Integration with manifold3d #2318

Open pca006132 opened 1 day ago

pca006132 commented 1 day ago

Some users (of manifold3d) asked if manifold3d can provide methods for import/export meshes using trimesh. However, we are not sure how optional dependencies work in trimesh, as well as how cyclic dependencies work (because trimesh also depends on manifold3d). I wonder if we can have functions in trimesh that convert a mesh to manifold3d mesh and reverse?

We already have a simple implementation of that: https://colab.research.google.com/drive/1VxrFYHPSHZgUbl9TeWzCeovlpXrPQ5J5?usp=sharing, the main problem is where this code should go to.

ping @elalish.

mikedh commented 6 hours ago

Nice!! Yeah I think that makes total sense and happy to help!

However, we are not sure how optional dependencies work in trimesh

So the base dependencies pulled in by pip install trimesh is just numpy, which lets you do most things you'd want, and adding bare trimesh as a dep here would be easy.

as well as how cyclic dependencies work (because trimesh also depends on manifold3d)

So pip install trimesh[easy] does pull in manifold3d. I also am not all that sure how the pip resolver deals with a circular but seemingly resolvable dependency in an extra.

I think the case to check would be to add trimesh to a manifold dependency (maybe as a .rc0 prerelease for testing?), and then see if pip install --pre trimesh[easy] manifold3d does anything disastrous? My reading of the relevant document is that it seems like this should work? Happy to play with the dependency in trimesh too if that's necessary.