summaryrefslogtreecommitdiff
path: root/lib/stitches/meander_fill.py
diff options
context:
space:
mode:
authorGeorge Steel <george.steel@gmail.com>2024-05-05 13:55:33 -0400
committerGitHub <noreply@github.com>2024-05-05 13:55:33 -0400
commitd32a8fd4661331da0affb15623a2ec9a9eac5c44 (patch)
tree6ac6a11c099a5b6b5463c9ff46bc7fb87d6ba888 /lib/stitches/meander_fill.py
parentedbe382914bc45a3f953c6e0258ff1feb05d8c95 (diff)
Add randomized running and fill stitches (#2830)
Add a mode to running stitch that uses randomized phase and stitch length instead of even spacing. This greatly reduces moire effects when stitching closely-spaced curves in running-stitch-based fills. Add option for randomized running stitch to: ripple stitch circular fill contour fill guided fill auto-fill When is randomization is not selected, ripple stitch will use even running stitch when staggers are set to 0 (default) and the stagger algorithm from guided fill (which does not look nice with a stagger period of 0) when staggers is nonzero. Also includes fix for satin contour underlays (missing tolerance default) mentioned in #2814. This sets the default tolerance to 0.2mm, which is the largest tolerance guaranteed to be backwards-compatible with existing designs using the default inset of 0.4mm. Original commits: * fix satin underlay tolerance default * Add randomized running stitch, make available in ripple stitch, circular, and contour * add randomized guided fill * make ripple stitch use even stitching when not staggering or randomizing. * add random auto-fill and switch jitter parameter to a percentage (matches satin) * fix comments
Diffstat (limited to 'lib/stitches/meander_fill.py')
-rw-r--r--lib/stitches/meander_fill.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/stitches/meander_fill.py b/lib/stitches/meander_fill.py
index 16510dde..94e38e1f 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, zigzag_stitch
+from .running_stitch import bean_stitch, even_running_stitch, zigzag_stitch
def meander_fill(fill, shape, original_shape, shape_index, starting_point, ending_point):
@@ -179,10 +179,10 @@ def post_process(points, shape, original_shape, fill):
smoothed_points = [InkStitchPoint.from_tuple(point) for point in smoothed_points]
if fill.zigzag_spacing > 0:
- stitches = running_stitch(smoothed_points, fill.zigzag_spacing / 2, fill.running_stitch_tolerance)
+ stitches = even_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)
+ stitches = even_running_stitch(smoothed_points, fill.running_stitch_length, fill.running_stitch_tolerance)
if fill.clip:
stitches = clamp_path_to_polygon(stitches, original_shape)