def darts_rect(n, xx, yy, w=1, h=1, dst=0):
## remove new nodes that are too close to other
## new nodes
visited = set()
dartsxy = random_points_in_rectangle(n, xx, yy, w, h)
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
评论列表
文章目录