"I'm not motivated to work, so I want to win the geometry processing !!"
I think there are days like that.
This time, I will introduce a library that displays the result after performing geometry processing in Python.
Pymesh is good for geometry processing itself.
meshplot
The one used in libigl's python binding tutorial. It doesn't seem to be on PyPI, so from https://github.com/skoch9/meshplot
python setup.py install
Drop it by yourself.
import meshplot
import trimesh
meshplot.offline()
mesh = trimesh.load('./unchan_pink.obj')
V = mesh.vertices
F = mesh.faces
meshplot.plot(V, F)
Then, html with embedded viewer for displaying mesh is generated after script is executed.
If you want to do it in jupyter, you can delete meshplot.offline ()
(Reference).
The result is like this, you can rotate and Zoom out / in with the mouse.
However, this library is
--You need to install it by yourself --html is generated every time script is executed
So it is a little inconvenient.
polyscope
https://polyscope.run/py/
A relatively new viewer of the Contributor, Keenan Crane, who has a strong Geometry neighborhood.
There is a C ++ version and a Python version, both of which are easy to use.
Backend seems to be based on OpenGL.
Install can be done with pip.
pip install polyscope
The display script looks like this.
import polyscope as ps
import trimesh
mesh = trimesh.load('./unchan_pink.obj')
V = mesh.vertices
F = mesh.faces
ps.init()
ps.register_point_cloud("my points", V)
ps.register_surface_mesh("my mesh", V, F, smooth_shade=True)
ps.show()
The result works like this at about 60fps. You can freely change the colors of the vertices and triangles.
polyscope convenient!
Recommended Posts