File: skeletonize.py

package info (click to toggle)
vedo 2025.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,404 kB
  • sloc: python: 64,792; javascript: 1,932; xml: 437; sh: 139; makefile: 6
file content (14 lines) | stat: -rw-r--r-- 395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""Using 1D Moving Least Squares to skeletonize a surface"""
from vedo import dataurl, Points, Plotter

N = 9    # nr of iterations
f = 0.2  # fraction of neighbours

pcl = Points(dataurl+"man.vtk").subsample(0.02)

plt = Plotter(N=N, axes=1)
for i in range(N):
    pcl = pcl.clone().smooth_mls_1d(f=f).color(i)
    plt.at(i).show(f"iteration {i}", pcl, elevation=-8)

plt.interactive().close()