如果我有细胞的坐标,我怎样才能找到 voronoi 细胞的种子?

问题描述

我想计算 voronoi 单元格的顶点与该特定单元格的种子之间的距离。但是,我无法弄清楚如何获得该特定单元格的种子坐标。我在这里给出了我的代码,它生成了一个单元坐标数组。谁能告诉我如何找到特定细胞的相应种子?

import numpy as np
import freud
import matplotlib
import matplotlib.pyplot as plt
import freud.box
import matplotlib.pyplot as plt

points = np.array([
    [-2,2,0],[2,4,[-2,3,[3,5,0]])

box = freud.box.Box(10,12,is2D= True )
voro = freud.locality.Voronoi()
cells= voro.compute((box,points)).polytopes
print(cells)
plt.figure()
ax = plt.gca()
ax.scatter(points[:,points[:,1],c= 'k')
voro.plot(ax=ax)
plt.show()

此代码的输出是下面的图,print(cells) 打印单元格顶点的坐标,如下所示。

enter image description here

[array([[-6.46875,-1.40625,0.        ],[-2.7,-3.5,[-1.3,[ 2.26086957,-1.52173913,[ 0.25,2.5,[-5.1,[-5.25,2.25,0.        ]]),array([[ 0.25,[ 3.53125,[ 4.75,[-1.16666667,8.16666667,array([[-5.1,8.5,array([[ 4.75,[ 4.9,[ 7.3,10.59375,10.47826087,0.        ]])]


我想计算每个单元格的顶点到种子距离,如图中的线所示。

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)