skeletonize.py 395 B

1234567891011121314
  1. """Using 1D Moving Least Squares to skeletonize a surface"""
  2. from vedo import dataurl, Points, Plotter
  3. N = 9 # nr of iterations
  4. f = 0.2 # fraction of neighbours
  5. pcl = Points(dataurl+"man.vtk").subsample(0.02)
  6. plt = Plotter(N=N, axes=1)
  7. for i in range(N):
  8. pcl = pcl.clone().smooth_mls_1d(f=f).color(i)
  9. plt.at(i).show(f"iteration {i}", pcl, elevation=-8)
  10. plt.interactive().close()