From e5ccb10eef83b88b722e94dc39f8bcc7692a3ce1 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Mon, 24 Apr 2023 22:52:31 +0200 Subject: Add bean stitch and repeat options to meander fill (#2232) --- lib/stitches/meander_fill.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/stitches/meander_fill.py') diff --git a/lib/stitches/meander_fill.py b/lib/stitches/meander_fill.py index 08ff4999..f6106606 100644 --- a/lib/stitches/meander_fill.py +++ b/lib/stitches/meander_fill.py @@ -15,7 +15,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 running_stitch +from .running_stitch import bean_stitch, running_stitch def meander_fill(fill, shape, original_shape, shape_index, starting_point, ending_point): @@ -186,6 +186,17 @@ def post_process(points, shape, original_shape, fill): if fill.clip: stitches = clamp_path_to_polygon(stitches, original_shape) + if fill.bean_stitch_repeats: + stitches = bean_stitch(stitches, fill.bean_stitch_repeats) + + if fill.repeats: + for i in range(1, fill.repeats): + if i % 2 == 1: + # reverse every other pass + stitches.extend(stitches[::-1]) + else: + stitches.extend(stitches) + return stitches -- cgit v1.2.3