From 68590492f55af51bf681a73200f12eb4d9a4f27a Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 19 Mar 2019 22:36:05 -0400 Subject: allow starting and ending on the border of a hole --- lib/stitches/auto_fill.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/stitches/auto_fill.py') diff --git a/lib/stitches/auto_fill.py b/lib/stitches/auto_fill.py index 7ca354bb..3dff3d96 100644 --- a/lib/stitches/auto_fill.py +++ b/lib/stitches/auto_fill.py @@ -281,10 +281,9 @@ def check_graph(graph, shape, max_stitch_length): "This most often happens because your shape is made up of multiple sections that aren't connected.")) -def nearest_node_on_outline(graph, point, outline_index=0): +def nearest_node_on_outline(graph, point): point = shgeo.Point(*point) - outline_nodes = [node for node, data in graph.nodes(data=True) if data['outline'] == outline_index] - nearest = min(outline_nodes, key=lambda node: shgeo.Point(*node).distance(point)) + nearest = min(graph.nodes, key=lambda node: shgeo.Point(*node).distance(point)) return nearest -- cgit v1.2.3