summaryrefslogtreecommitdiff
path: root/lib/stitches/auto_fill.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-06-23 22:53:17 -0400
committerLex Neva <github.com@lexneva.name>2018-06-23 22:53:17 -0400
commit78efaf120f08883e00428d54c2035e63934566ba (patch)
tree893471e90964f9112ebcb8faf81c270cc6906abb /lib/stitches/auto_fill.py
parente0a2b31ede8b412c83747fef168c3dda0d07087f (diff)
remove unnecessary travel back to start
Diffstat (limited to 'lib/stitches/auto_fill.py')
-rw-r--r--lib/stitches/auto_fill.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/stitches/auto_fill.py b/lib/stitches/auto_fill.py
index 42fd1ef5..c7c3cdec 100644
--- a/lib/stitches/auto_fill.py
+++ b/lib/stitches/auto_fill.py
@@ -47,8 +47,10 @@ def auto_fill(shape, angle, row_spacing, end_row_spacing, max_stitch_length, run
graph = build_graph(shape, segments, angle, row_spacing)
path = find_stitch_path(graph, segments, starting_point, ending_point)
-# if starting_point:
-# stitches.extend(connect_points(shape, starting_point, path[0][0], running_stitch_length))
+ if ending_point is None:
+ # The end of the path travels around the outline back to the start.
+ # This isn't necessary, so remove it.
+ trim_end(path)
stitches.extend(path_to_stitches(graph, path, shape, angle, row_spacing, max_stitch_length, running_stitch_length, staggers))
@@ -516,6 +518,9 @@ def connect_points(shape, start, end, running_stitch_length):
return stitches
+def trim_end(path):
+ while path and path[-1].is_outline():
+ path.pop()
def path_to_stitches(graph, path, shape, angle, row_spacing, max_stitch_length, running_stitch_length, staggers):
path = collapse_sequential_outline_edges(graph, path)