05-alpha-shapes.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Sat, 16 Jun 2012 12:13:53 -0700
changeset 2 4b3728f0d920
parent 0 04-alpha-shapes.py@337c84a13184
permissions -rw-r--r--
Clean-up and sync with the slides

# Alpha shapes
points = read_points('data/trefoil.pts')
f = Filtration()
fill_alpha_complex(points, f)
for s in f:
    print s, s.data

from math import sqrt
show_complex(points, [s for s in f if sqrt(s.data[0]) < .5])
show_complex(points, [s for s in f if sqrt(s.data[0]) < .8])

f.sort(dim_data_cmp)
p = StaticPersistence(f)
p.pair_simplices()

dgms = init_diagrams(p, f, lambda s: sqrt(s.data[0]))
show_diagram(dgms)