cut_with_points2.py 494 B

123456789101112131415161718192021
  1. """Select cells inside a point loop"""
  2. from vedo import *
  3. mesh = Mesh(dataurl + "dolfin_fine.vtk").lw(1)
  4. pts = [
  5. [0.85382618, 0.1909104],
  6. [0.85585967, 0.8721275],
  7. [0.07500188, 0.8680605],
  8. [0.10143717, 0.0607675],
  9. ]
  10. # Make a copy and cut it
  11. cmesh = mesh.clone().cut_with_point_loop(
  12. pts, on="cells", include_boundary=False, invert=False,
  13. )
  14. cmesh.lw(1).c("tomato")
  15. line = Line(pts, closed=True).lw(5).c("green3")
  16. show([(mesh, line), (cmesh, line, __doc__)], N=2).close()