Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### firstly, import Polygon class ####
- from shapely.geometry import MultiPolygon, Polygon
- .
- .
- .
- # make polygon
- thetas = np.linspace(0, 2 * np.pi, 360)
- polygon_x = x[:,None] + r[:,None] * np.sin(thetas)
- polygon_y = y[:,None] + r[:,None] * np.cos(thetas)
- # list of convex hulls of subsequent circles
- ps = [Polygon(i) for i in np.dstack((polygon_x, polygon_y))]
- # list of convex hulls of subsequent circles
- n = range(len(ps)-1)
- convex_hulls = [MultiPolygon([ps[i], ps[i+1]]).convex_hull for i in n]
- # Final polygon
- polygons = cascaded_union(convex_hulls)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement