summaryrefslogtreecommitdiff
path: root/lib/extensions/fill_to_stroke.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/extensions/fill_to_stroke.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/extensions/fill_to_stroke.py')
-rw-r--r--lib/extensions/fill_to_stroke.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/extensions/fill_to_stroke.py b/lib/extensions/fill_to_stroke.py
index c33ede3d..db5719a6 100644
--- a/lib/extensions/fill_to_stroke.py
+++ b/lib/extensions/fill_to_stroke.py
@@ -10,7 +10,7 @@ from shapely.ops import linemerge, nearest_points, split, voronoi_diagram
from ..elements import FillStitch, Stroke
from ..i18n import _
-from ..stitches.running_stitch import running_stitch
+from ..stitches.running_stitch import even_running_stitch
from ..svg import get_correction_transform
from ..utils import ensure_multi_line_string
from ..utils.geometry import Point as InkstitchPoint
@@ -110,11 +110,11 @@ class FillToStroke(InkstitchExtension):
def _get_high_res_polygon(self, polygon):
# use running stitch method
- runs = [running_stitch(line_string_to_point_list(polygon.exterior), 1, 0.1)]
+ runs = [even_running_stitch(line_string_to_point_list(polygon.exterior), 1, 0.1)]
if len(runs[0]) < 3:
return
for interior in polygon.interiors:
- shape = running_stitch(line_string_to_point_list(interior), 1, 0.1)
+ shape = even_running_stitch(line_string_to_point_list(interior), 1, 0.1)
if len(shape) >= 3:
runs.append(shape)
return MultiPolygon([(runs[0], runs[1:])])