from scipy.spatial import cKDTree
ListArray = np.array([[0,0],[1,1],[0,2],[2,2]])
b=np.array(cKDTree(ListArray).query_pairs(r=1.9))
print b
output: set([(0, 1), (1, 2), (1, 3)])

输出结果表示所有距离小于(r=1.9)的点对,如[0, 1]表示第一点和第二点的距离小于1.9



Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐