Skip to content

Instantly share code, notes, and snippets.

View arijitlaik's full-sized avatar

Arijit Laik arijitlaik

View GitHub Profile
@arijitlaik
arijitlaik / Python concave hull ( alpha shape ) .md
Created January 14, 2019 12:59 — forked from hellpanderrr/Python concave hull ( alpha shape ) .md
Concave hull in python using scipy and networkx
from scipy.spatial import Delaunay, ConvexHull
import networkx as nx
 
points = [ [0,0],[0,50],[50,50],[50,0],[0,400],[0,450],[50,400],[50,450],[700,300],[700,350],[750,300],[750,350],
          [900,600],[950,650],[950,600],[900,650]
]
def concave(points,alpha_x=150,alpha_y=250):
    points = [(i[0],i[1]) if type(i) <> tuple else i for i in points]
    de = Delaunay(points)