From 8c60045382c5f841af4f4bfc047425eabb0578ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sun, 4 Dec 2016 14:03:54 +0100 Subject: [PATCH] buildgraph: fix filling graph in narrow areas --- src/c3nav/routing/graph/room.py | 5 +++-- src/c3nav/routing/utils/coords.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/c3nav/routing/graph/room.py b/src/c3nav/routing/graph/room.py index 9b94e58a..edfcc950 100644 --- a/src/c3nav/routing/graph/room.py +++ b/src/c3nav/routing/graph/room.py @@ -38,10 +38,11 @@ class GraphRoom(): self._add_ring(interior, want_left=True) # now fill in missing doorways or similar - missing_geometry = self.clear_geometry.difference(geometry.buffer(0.61, join_style=JOIN_STYLE.mitre)) + accessible_clear_geometry = geometry.buffer(0.31, join_style=JOIN_STYLE.mitre) + missing_geometry = self.clear_geometry.difference(accessible_clear_geometry) polygons = assert_multipolygon(missing_geometry) for polygon in polygons: - overlaps = polygon.buffer(0.62).intersection(geometry) + overlaps = polygon.buffer(0.02).intersection(accessible_clear_geometry) if overlaps.is_empty: continue diff --git a/src/c3nav/routing/utils/coords.py b/src/c3nav/routing/utils/coords.py index 67e9ecbb..6fc31ced 100644 --- a/src/c3nav/routing/utils/coords.py +++ b/src/c3nav/routing/utils/coords.py @@ -33,6 +33,8 @@ def get_coords_angles(geom): :rtype: a list of ((x, y), is_left) tuples """ coords = list(cleanup_coords(geom.coords)) + if len(coords) < 3: + return [] last_coords = coords[-2:] last_angle = coord_angle(last_coords[-2], last_coords[-1]) result = []