volume_from_mesh.py 422 B

1234567891011121314
  1. """Generate a Volume with the signed distance from a Mesh,
  2. then generate the isosurface at distance -0.5"""
  3. from vedo import *
  4. mesh = Mesh(dataurl+"beethoven.ply").subdivide()
  5. mesh.color('k').point_size(3) # render mesh as points
  6. # Generate signed distance volume
  7. vol = mesh.signed_distance(dims=(40,40,40))
  8. # Generate an isosurface at distance -0.5
  9. iso = vol.isosurface(-0.5)
  10. show(mesh, iso, __doc__, axes=1).close()