【发布时间】:2014-09-09 21:53:57
【问题描述】:
我在使用 scipy 的 Voronoi 函数时遇到了问题。我遵循了 2d 示例,但是当我在 3d 中执行类似示例时,并没有计算所有 ridge_points。我的数据是 [0,2]x[0,2]x[0,2] 中的 27 个点的框:
points = np.array([
# bottom plane
[0,2,0], [1,2,0], [2,2,0],
[0,1,0], [1,1,0], [2,1,0],
[0,0,0], [1,0,0], [2,0,0],
# middle plane
[0,2,1], [1,2,1], [2,2,1],
[0,1,1], [1,1,1], [2,1,1],
[0,0,1], [1,0,1], [2,0,1],
# top plane
[0,2,2], [1,2,2], [2,2,2],
[0,1,2], [1,1,2], [2,1,2],
[0,0,2], [1,0,2], [2,0,2]
])
vor = Voronoi(points)
print vor.ridge_points
# outputed
array([[ 4, 7],
[ 4, 5],
[ 4, 3],
[ 4, 1],
[ 4, 13],
[ 3, 12],
[ 7, 16],
[15, 12],
[15, 16],
[ 9, 12],
[ 9, 10],
[ 1, 10],
[12, 21],
[12, 13],
[23, 14],
[23, 22],
[14, 17],
[14, 11],
[14, 5],
[14, 13],
[22, 19],
[22, 21],
[22, 13],
[22, 25],
[17, 16],
[11, 10],
[25, 16],
[16, 13],
[13, 10],
[19, 10], dtype=int32)
我注意到角落上的点:
points[0] = array([0, 2, 0])
points[2] = array([2, 2, 0])
points[6] = array([0, 0, 0])
points[8] = array([2, 0, 0])
points[18] = array([0, 2, 2])
points[20] = array([2, 2, 2])
points[24] = array([0, 0, 2])
points[26] = array([2, 0, 2])
没有任何脊点。我会假设(如 2d 案例)角落会有脊点。例如,我假设 points[6]=[0,0,0] 的脊点为 [1,0,0]、[0,1,0] 和 [0,0,1]。这不可能用 scipy 计算还是我一直在想这个错误?
【问题讨论】:
-
FWIW,Scipy 输出与qvoronoi Fv < pts 一致,请参阅gist.github.com/pv/2f756ec83cdf242ce691 - 但是,我不完全理解为什么 Qhull 报告的 Voronoi 山脊是这样的。
标签: python numpy scipy voronoi