diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-06-23 22:53:17 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-06-23 22:53:17 -0400 |
| commit | 78efaf120f08883e00428d54c2035e63934566ba (patch) | |
| tree | 893471e90964f9112ebcb8faf81c270cc6906abb /lib | |
| parent | e0a2b31ede8b412c83747fef168c3dda0d07087f (diff) | |
remove unnecessary travel back to start
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/stitches/auto_fill.py | 9 |
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) |
