space_for_point: only spaces with distance < 0.5m
This commit is contained in:
parent
d979a298c2
commit
9963fa4c48
1 changed files with 4 additions and 1 deletions
|
@ -291,7 +291,10 @@ class Router:
|
|||
continue
|
||||
if self.spaces[space].geometry_prep.contains(point):
|
||||
return self.spaces[space]
|
||||
return self.spaces[min(level.spaces, key=lambda space: self.spaces[space].geometry.distance(point))]
|
||||
spaces = (self.spaces[space] for space in level.spaces)
|
||||
spaces = ((space, space.geometry.distance(point)) for space in spaces)
|
||||
spaces = ((space, distance) for space, distance in spaces if distance < 0.5)
|
||||
return min(spaces, key=operator.itemgetter(1))[0]
|
||||
|
||||
def describe_custom_location(self, location):
|
||||
return CustomLocationDescription(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue