diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-03-20 20:45:29 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-03-20 20:45:29 -0400 |
| commit | 4c1f1bc2bbf9277e399dc8ddbed5c0d81d930a34 (patch) | |
| tree | dad05f7d7d2f51e31f25f95601338d61e011363e /lib | |
| parent | 69df0271b5e9c5be8ff0d16fe6e24f1e7ed8e6fc (diff) | |
tidy up start/end travel code
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/stitches/auto_fill.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/stitches/auto_fill.py b/lib/stitches/auto_fill.py index 8435d156..2414e937 100644 --- a/lib/stitches/auto_fill.py +++ b/lib/stitches/auto_fill.py @@ -360,13 +360,14 @@ def find_stitch_path(graph, travel_graph, starting_point=None, ending_point=None if starting_node is not ending_node: path.insert(0, PathEdge((starting_node, ending_node), key="initial")) + # If the starting and/or ending point falls far away from the end of a row + # of stitches (like can happen at the top of a square), then we need to + # add travel stitch to that point. real_start = nearest_node(travel_graph, starting_point) - if real_start != starting_node: - path.insert(0, PathEdge((real_start, starting_node), key="outline")) + path.insert(0, PathEdge((real_start, starting_node), key="outline")) real_end = nearest_node(travel_graph, ending_point) - if real_end != ending_node: - path.append(PathEdge((ending_node, real_end), key="outline")) + path.append(PathEdge((ending_node, real_end), key="outline")) return path |
