marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
2.05k stars 266 forks source link

How to construct tetrahedron using vessel surface? #731

Closed zhang-qiang-github closed 2 years ago

zhang-qiang-github commented 2 years ago

Please have a look at following picture:

image

If I have a 3D vessel surface (the black), how to construct the inside tetrahedron just like the red color.

marcomusy commented 2 years ago

There are many tools to create a tetmesh (eg TetGen), vedo can also do it:

from vedo import Tube, Sphere, show

surf = Sphere(quads=True, res=15)
# surf = Tube([(0,0,0), (1,1,1), (2,3,4)], res=15)

tmesh = surf.tetralize(side=0.025, debug=True)
#tmesh.write('mytetmesh.vtk')  # save to disk!

show(tmesh.tomesh().alpha(1), axes=1)

Screenshot from 2022-11-10 15-51-55

check also https://github.com/marcomusy/vedo/blob/master/examples/volumetric/tetralize_surface.py

zhang-qiang-github commented 2 years ago

Thank you very much ~~~

zhang-qiang-github commented 2 years ago

For tmesh.tomesh(), how to set alpha=0 for face, but alpha=1 for all lines? In this way, I want to see only the line.

marcomusy commented 2 years ago

use .wireframe() instead.

zhang-qiang-github commented 2 years ago

thx~~~