I have a set of 2D points and some box that bounds all the points. I would like to have each point's nearest neighbor region as a Polygon (shapely) object, with no polygon stepping out the bounding box. Is it possible?
buffer = 10
points = np.random.rand(1,100, (20,2))
# bounding box
xmin, ymin = points.min(axis=0) - buffer
xmax, ymax = points.max(axis=0) + buffer
vor = scipy.spatial.Voronoi(points)
# scipy.spatial.voronoi_plot_2d(vor) # <- How to get each region as shapely polygon??