diff options
| author | George Steel <george.steel@gmail.com> | 2024-05-05 13:55:33 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-05 13:55:33 -0400 |
| commit | d32a8fd4661331da0affb15623a2ec9a9eac5c44 (patch) | |
| tree | 6ac6a11c099a5b6b5463c9ff46bc7fb87d6ba888 /lib/utils | |
| parent | edbe382914bc45a3f953c6e0258ff1feb05d8c95 (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/utils')
| -rw-r--r-- | lib/utils/smoothing.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/utils/smoothing.py b/lib/utils/smoothing.py index 2c210e37..49771b6c 100644 --- a/lib/utils/smoothing.py +++ b/lib/utils/smoothing.py @@ -2,7 +2,7 @@ import numpy as np from scipy.interpolate import splprep, splev from .geometry import Point, coordinate_list_to_point_list -from ..stitches.running_stitch import running_stitch +from ..stitches.running_stitch import even_running_stitch def _remove_duplicate_coordinates(coords_array): @@ -48,7 +48,7 @@ def smooth_path(path, smoothness=1.0): # # Fortunately, we can convert the path to segments that are mostly the same # length by using the running stitch algorithm. - path = running_stitch(coordinate_list_to_point_list(path), 5 * smoothness, smoothness / 2) + path = even_running_stitch(coordinate_list_to_point_list(path), 5 * smoothness, smoothness / 2) # splprep blows up on duplicated consecutive points with "Invalid inputs" coords = _remove_duplicate_coordinates(np.array(path)) |
