tetgen
tetgen copied to clipboard
the input of pytetgen
Now I only have some point saved by a .ply file, and I want to use the pytetgen to generate the tetrahedra and visualize.Is it possible?
Now I only have some point saved by a .ply file
I'm assuming you have a surface. If so, I'd follow the steps in the README to load and tetrahedralize the surface. See the sphere example, but substitute your mesh for the sphere by first loading your mesh with pyvista.read.
To be extra clear, try this:
import pyvista as pv
import tetgen
surface = pv.read('mysurface.ply')
tet = tetgen.TetGen(surface)
tet.tetrahedralize()
grid = tet.grid
grid.plot(show_edges=True)
grid.clip().plot(show_edges=True)
Once you tetrahedralize it, then you should head over to PyVista's documentation to learn how to do all the visualization: https://docs.pyvista.org/examples/index.html
Hi, is it possible for this interface to generates the Delaunay tetrahedralization from points only, instead of a surface?
With C++ tetgen this functionality is there (Figure 12 of http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual005.html).
To be extra clear, try this:
import pyvista as pv import tetgen surface = pv.read('mysurface.ply') tet = tetgen.TetGen(surface) tet.tetrahedralize() grid = tet.grid grid.plot(show_edges=True) grid.clip().plot(show_edges=True)
Tried loading a ply file using this example with point coordinates only (no face record) but failed:
RuntimeError: Failed to tetrahedralize.
May need to repair surface by making it manifold
Hi, is it possible for this interface to generates the Delaunay tetrahedralization from points only, instead of a surface?
Nope, the input must be a manifold, triangular surface
Hi, is it possible for this interface to generates the Delaunay tetrahedralization from points only, instead of a surface?
With C++ tetgen this functionality is there (Figure 12 of http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual005.html).
Thanks @banesullivan. For others looking for this, scipy.spatial.Delaunay supports Delaunay tessellation in N dimensions.