Skip to content

Instantly share code, notes, and snippets.

View sakshamphul's full-sized avatar
💭
Breaking the code everyday!

Saksham Phul sakshamphul

💭
Breaking the code everyday!
View GitHub Profile
@sakshamphul
sakshamphul / Python concave hull ( alpha shape ) .md
Created June 23, 2019 22:31 — 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)