summaryrefslogtreecommitdiff
path: root/lib/stitches/tangential_fill_stitch_line_creator.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2022-05-01 13:16:23 -0400
committerKaalleen <reni@allenka.de>2022-05-04 19:18:33 +0200
commitfc3d05845a9e04a9dbe69e8ed6a025e3e77e6349 (patch)
tree380f6a53b6b4597131354af14c658c4f35dda6aa /lib/stitches/tangential_fill_stitch_line_creator.py
parenteefb3460e31bc39060deafee3128533f08be53f1 (diff)
simpler, faster inner-to-outer algo
Diffstat (limited to 'lib/stitches/tangential_fill_stitch_line_creator.py')
-rw-r--r--lib/stitches/tangential_fill_stitch_line_creator.py9
1 files changed, 7 insertions, 2 deletions
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!")