我认为我的问题与这个问题或其他问题有一些共同点,但无论如何,我的问题并不具体涉及它们。
在找到某些点的泰森多边形后,我希望能够检查“其他”给定点在哪个泰森多边形内。 特别是:
假设有50个额外点,我想要能够计算每个泰森多边形包含多少个这些额外点。
我的最小工作示例(MWE)
from scipy.spatial import ConvexHull, Voronoi, voronoi_plot_2d
import matplotlib.pyplot as plt
points = [[0,0], [1,4], [2,3], [4,1], [1,1], [2,2], [5,3]]
#voronoi
vor = Voronoi(points)
voronoi_plot_2d(vor)
plt.show()
现在我获得了额外的分数
extraPoints = [[0.5,0.2], [3, 0], [4,0],[5,0], [4,3]]
# In this case we have that the first point is in the bottom left,
# the successive three are in the bottom right and the last one
# is in the top right cell.
我在考虑利用获取vor.regions
或vor.vertices
的事实,但是我真的想不出什么办法。
是否有参数或方法可以实现这一点?