def remove_close(points, face_index, radius):
'''
Given an (n, m) set of points where n=(2|3) return a list of points
where no point is closer than radius
'''
from scipy.spatial import cKDTree as KDTree
tree = KDTree(points)
consumed = np.zeros(len(points), dtype=np.bool)
unique = np.zeros(len(points), dtype=np.bool)
for i in range(len(points)):
if consumed[i]: continue
neighbors = tree.query_ball_point(points[i], r=radius)
consumed[neighbors] = True
unique[i] = True
return points[unique], face_index[unique]
评论列表
文章目录