mesh_threshold.py 548 B

12345678910111213141516
  1. """Extracts cells of a Mesh which satisfy
  2. the threshold criterion: 37 < scalar < 37.5"""
  3. from vedo import *
  4. man = Mesh(dataurl+"man.vtk")
  5. scals = man.vertices[:, 0] + 37 # pick y coords of vertices
  6. # scals data is added to mesh points with automatic name PointScalars
  7. man.cmap("cool", scals).add_scalarbar(title="threshold", horizontal=True)
  8. # make a copy and threshold the mesh
  9. cutman = man.clone().threshold("Scalars", 37, 37.5)
  10. # distribute the meshes on the 2 renderers
  11. show([(man, __doc__), cutman], N=2, elevation=-30, axes=11).close()