mesh2volume.py 443 B

123456789101112131415
  1. """Build a volume from a mesh where the
  2. foreground voxels are set to 255 and the background voxels are 0"""
  3. from vedo import Mesh, dataurl, Plotter
  4. surf = Mesh(dataurl+"bunny.obj").normalize().wireframe()
  5. vol = surf.binarize()
  6. vol.alpha([0,0.75]).cmap('blue5')
  7. iso = vol.isosurface().color("blue5")
  8. plt = Plotter(N=2, axes=9)
  9. plt.at(0).show(vol, surf, __doc__)
  10. plt.at(1).show("..the volume is isosurfaced:", iso)
  11. plt.interactive().close()