diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-03-19 22:36:05 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-03-19 22:36:05 -0400 |
| commit | 68590492f55af51bf681a73200f12eb4d9a4f27a (patch) | |
| tree | 5ce0e8d2fec69e39a80e85a4a8a1d5f2864e43a3 /lib/stitches | |
| parent | 6b8121fb04075b135f6f67954a9f7686460ce5f5 (diff) | |
allow starting and ending on the border of a hole
Diffstat (limited to 'lib/stitches')
| -rw-r--r-- | lib/stitches/auto_fill.py | 5 |
1 files changed, 2 insertions, 3 deletions
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 |
