diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-01-25 17:54:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-25 17:54:08 +0100 |
| commit | 2677c30a0f210d14586c83016f45e5a75fb9d647 (patch) | |
| tree | 04a91f0ee9a7f5723abe362890006ed383ddf74e /lib/stitches/guided_fill.py | |
| parent | f44eff9e74b36507cd512aea7aa6f4d698a374d5 (diff) | |
Second chance for invalid fill stitch graphs (#2643)
Diffstat (limited to 'lib/stitches/guided_fill.py')
| -rw-r--r-- | lib/stitches/guided_fill.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/stitches/guided_fill.py b/lib/stitches/guided_fill.py index 762515f6..6f650028 100644 --- a/lib/stitches/guided_fill.py +++ b/lib/stitches/guided_fill.py @@ -3,6 +3,7 @@ from random import random import numpy as np import shapely.prepared +from networkx import is_empty from shapely import geometry as shgeo from shapely.affinity import translate from shapely.ops import linemerge, nearest_points, unary_union @@ -15,7 +16,7 @@ from ..utils.geometry import (ensure_geometry_collection, from ..utils.threading import check_stop_flag from .auto_fill import (auto_fill, build_fill_stitch_graph, build_travel_graph, collapse_sequential_outline_edges, find_stitch_path, - graph_is_valid, travel) + graph_make_valid, travel) def guided_fill(shape, @@ -39,9 +40,10 @@ def guided_fill(shape, fill_stitch_graph = build_fill_stitch_graph(shape, segments, starting_point, ending_point) - if not graph_is_valid(fill_stitch_graph): + if is_empty(fill_stitch_graph): return fallback(shape, guideline, row_spacing, max_stitch_length, running_stitch_length, running_stitch_tolerance, num_staggers, skip_last, starting_point, ending_point, underpath) + fill_stitch_graph = graph_make_valid(fill_stitch_graph) travel_graph = build_travel_graph(fill_stitch_graph, shape, angle, underpath) path = find_stitch_path(fill_stitch_graph, travel_graph, starting_point, ending_point) |
