def darts(n, xx, yy, rr, dst):
"""
get at most n random, uniformly distributed, points in a circle.
centered at (xx,yy), with radius rr. points are no closer to each other
than dst.
"""
## remove new nodes that are too close to other
## new nodes
visited = set()
dartsxy = random_points_in_circle(n, xx, yy, rr)
tree = kdt(dartsxy)
near = tree.query_ball_point(dartsxy, dst)
jj = []
for j,n in enumerate(near):
if len(visited.intersection(n))<1:
jj.append(j)
visited.add(j)
res = dartsxy[jj,:]
return res
评论列表
文章目录