cut_with_points1.py 647 B

12345678910111213141516171819202122
  1. """Set a loop of random points on a sphere
  2. to cut a region of the mesh"""
  3. from vedo import *
  4. # This affects how colors are interpolated between points
  5. settings.interpolate_scalars_before_mapping = True
  6. s = Sphere()
  7. s.color("white").alpha(0.25).backface_culling()
  8. s.pointdata['myscalars'] = s.coordinates[:,1]
  9. print(s)
  10. # Pick a few points on the sphere
  11. sv = s.points[[10, 15, 129, 165]]
  12. pts = Points(sv).ps(12)
  13. # Cut the loop region identified by the points
  14. scut = s.clone().cut_with_point_loop(sv, invert=False).scale(1.01)
  15. scut.cmap("Paired", "myscalars").alpha(1).add_scalarbar()
  16. print(scut)
  17. show(s, pts, scut, __doc__, axes=1, viewup="z")