summaryrefslogtreecommitdiff
path: root/lib/utils/clamp_path.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-03-29 10:25:02 +0100
committerGitHub <noreply@github.com>2024-03-29 10:25:02 +0100
commit2439adafa8592995d9acead47ef2802d5d95c373 (patch)
treebfa10aaf017bc48cf6c166c7adeb9afd5dc12922 /lib/utils/clamp_path.py
parentfb1ecd0badf5eb142f17cc7f0f7e8b347151b002 (diff)
Add "the tartan universe" (#2782)
Diffstat (limited to 'lib/utils/clamp_path.py')
-rw-r--r--lib/utils/clamp_path.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/utils/clamp_path.py b/lib/utils/clamp_path.py
index f6db66a8..0f58f83c 100644
--- a/lib/utils/clamp_path.py
+++ b/lib/utils/clamp_path.py
@@ -1,6 +1,9 @@
-from shapely.geometry import LineString, Point as ShapelyPoint, MultiPolygon
+from shapely.geometry import LineString, MultiPolygon
+from shapely.geometry import Point as ShapelyPoint
from shapely.prepared import prep
-from .geometry import Point, ensure_geometry_collection
+
+from .geometry import (Point, ensure_geometry_collection,
+ ensure_multi_line_string)
def path_to_segments(path):
@@ -122,7 +125,7 @@ def clamp_path_to_polygon(path, polygon):
if not exit_point.intersects(entry_point):
# Now break the border into pieces using those points.
border = find_border(polygon, exit_point)
- border_pieces = border.difference(MultiPolygon((entry_point, exit_point))).geoms
+ border_pieces = ensure_multi_line_string(border.difference(MultiPolygon((entry_point, exit_point)))).geoms
border_pieces = fix_starting_point(border_pieces)
# Pick the shortest way to get from the exiting to the