Ignore multipoints in intersect regions with gratings (#2647)

pull/2656/head
Kaalleen 2023-12-25 08:48:20 +01:00 zatwierdzone przez GitHub
rodzic 838d811ae6
commit 9afbf02384
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -149,14 +149,13 @@ def intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing=Non
res = grating_line.intersection(shape)
if (isinstance(res, shapely.geometry.MultiLineString) or isinstance(res, shapely.geometry.GeometryCollection)):
runs = [line_string.coords for line_string in res.geoms if isinstance(line_string, shapely.geometry.LineString)]
if res.geom_type in ["MultiLineString", "GeometryCollection"]:
runs = [line_string.coords for line_string in res.geoms if line_string.geom_type == "LineString"]
elif res.geom_type in ["Point", "MultiPoint"] or res.is_empty:
# ignore if we intersected at a single point or no points
runs = []
else:
if res.is_empty or len(res.coords) == 1:
# ignore if we intersected at a single point or no points
runs = []
else:
runs = [res.coords]
runs = [res.coords]
if runs:
runs.sort(key=lambda seg: (InkstitchPoint(*seg[0]) - upper_left).length())