首页 > 解决方案 > 如何获得一组二维点的每个 voronoi 区域的多边形?

问题描述

我有一组 2D 点和一些限制所有点的框。我想将每个点的最近邻区域作为多边形(匀称)对象,没有多边形超出边界框。可能吗?

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??

标签: pythonscipyshapelyvoronoi

解决方案


推荐阅读