05-alpha-shapes.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Sat, 16 Jun 2012 12:25:46 -0700
changeset 3 ef86268a3695
parent 2 4b3728f0d920
permissions -rw-r--r--
Fixed bugs in 08-extended-persistence.py

# 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)