tetgen icon indicating copy to clipboard operation
tetgen copied to clipboard

the input of pytetgen

Open tftangming opened this issue 4 years ago • 6 comments

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?

tftangming avatar Aug 21 '20 09:08 tftangming

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.

akaszynski avatar Aug 21 '20 16:08 akaszynski

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)

banesullivan avatar Aug 25 '20 01:08 banesullivan

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

banesullivan avatar Aug 25 '20 01:08 banesullivan

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

chenzhaiyu avatar Dec 14 '20 18:12 chenzhaiyu

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

banesullivan avatar Dec 15 '20 21:12 banesullivan

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.

chenzhaiyu avatar Dec 18 '20 10:12 chenzhaiyu