From fc3d05845a9e04a9dbe69e8ed6a025e3e77e6349 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 1 May 2022 13:16:23 -0400 Subject: simpler, faster inner-to-outer algo --- lib/stitches/tangential_fill_stitch_line_creator.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/stitches/tangential_fill_stitch_line_creator.py') diff --git a/lib/stitches/tangential_fill_stitch_line_creator.py b/lib/stitches/tangential_fill_stitch_line_creator.py index 466fd6b6..416974c5 100644 --- a/lib/stitches/tangential_fill_stitch_line_creator.py +++ b/lib/stitches/tangential_fill_stitch_line_creator.py @@ -10,8 +10,11 @@ from shapely.ops import polygonize from ..stitches import constants from ..stitches import tangential_fill_stitch_pattern_creator +from ..stitch_plan import Stitch from ..utils import DotDict +from .running_stitch import running_stitch + class Tree(nx.DiGraph): # This lets us do tree.nodes['somenode'].parent instead of the default @@ -350,8 +353,10 @@ def offset_poly(poly, offset, join_style, stitch_distance, min_stitch_distance, make_tree_uniform_ccw(tree) if strategy == StitchingStrategy.INNER_TO_OUTER: - (connected_line, connected_line_origin) = tangential_fill_stitch_pattern_creator.connect_raster_tree_from_inner_to_outer( - tree, 'root', offset, stitch_distance, min_stitch_distance, starting_point, offset_by_half) + connected_line = tangential_fill_stitch_pattern_creator.connect_raster_tree_from_inner_to_outer( + tree, 'root', abs(offset), stitch_distance, min_stitch_distance, starting_point, offset_by_half) + path = [Stitch(*point) for point in connected_line.coords] + return running_stitch(path, stitch_distance), "whatever" elif strategy == StitchingStrategy.SPIRAL: if not check_and_prepare_tree_for_valid_spiral(tree): raise ValueError("Geometry cannot be filled with one spiral!") -- cgit v1.2.3