From 92ac7986937c14b224a24aa483d668557ee8ba53 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sun, 28 Jan 2024 08:48:44 +0100 Subject: add zigzag option to meander (#2699) --- lib/stitches/meander_fill.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/stitches/meander_fill.py') diff --git a/lib/stitches/meander_fill.py b/lib/stitches/meander_fill.py index c1308bf4..16510dde 100644 --- a/lib/stitches/meander_fill.py +++ b/lib/stitches/meander_fill.py @@ -14,7 +14,7 @@ from ..utils.list import poprandom from ..utils.prng import iter_uniform_floats from ..utils.smoothing import smooth_path from ..utils.threading import check_stop_flag -from .running_stitch import bean_stitch, running_stitch +from .running_stitch import bean_stitch, running_stitch, zigzag_stitch def meander_fill(fill, shape, original_shape, shape_index, starting_point, ending_point): @@ -178,7 +178,11 @@ def post_process(points, shape, original_shape, fill): smoothed_points = smooth_path(points, fill.smoothness) smoothed_points = [InkStitchPoint.from_tuple(point) for point in smoothed_points] - stitches = running_stitch(smoothed_points, fill.running_stitch_length, fill.running_stitch_tolerance) + if fill.zigzag_spacing > 0: + stitches = running_stitch(smoothed_points, fill.zigzag_spacing / 2, fill.running_stitch_tolerance) + stitches = zigzag_stitch(stitches, fill.zigzag_spacing, fill.zigzag_width, 0) + else: + stitches = running_stitch(smoothed_points, fill.running_stitch_length, fill.running_stitch_tolerance) if fill.clip: stitches = clamp_path_to_polygon(stitches, original_shape) -- cgit v1.2.3