summaryrefslogtreecommitdiff
path: root/lib/stitches/contour_fill.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-11-07 17:10:03 +0100
committerGitHub <noreply@github.com>2025-11-07 17:10:03 +0100
commit5a9ae03dc14ea5b68a99581c21a5d8085f1a3243 (patch)
tree4b729fbdc8656f3ba75b7dfdd2ccfecdd8718fee /lib/stitches/contour_fill.py
parent383f164b6d90c0819d49f4fb16deb9efa3e11df2 (diff)
Running stitch length sequence (#4034)
* allow running stitch length sequences * contour fill: fix error message for long stitch length * satin: fix center underlay stitch length
Diffstat (limited to 'lib/stitches/contour_fill.py')
-rw-r--r--lib/stitches/contour_fill.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/stitches/contour_fill.py b/lib/stitches/contour_fill.py
index 0665aacb..6a3ed4ff 100644
--- a/lib/stitches/contour_fill.py
+++ b/lib/stitches/contour_fill.py
@@ -422,7 +422,7 @@ def inner_to_outer(tree, polygon, offset,
smoothed = smooth_path(points, smoothness)
points = clamp_path_to_polygon(smoothed, polygon)
- stitches = running_stitch(points, stitch_length, tolerance, enable_random_stitch_length, random_sigma, random_seed)
+ stitches = running_stitch(points, [stitch_length], tolerance, enable_random_stitch_length, random_sigma, random_seed)
return stitches
@@ -460,6 +460,9 @@ def _interpolate_linear_rings(ring1, ring2, max_stitch_length, start=None):
# orders of magnitude faster because we're not building and querying a KDTree.
num_points = int(20 * ring1.length / max_stitch_length)
+ if num_points <= 1:
+ return LineString()
+
ring1_resampled = trimesh.path.traversal.resample_path(np.array(ring1.coords), count=num_points)
ring2_resampled = trimesh.path.traversal.resample_path(np.array(ring2.coords), count=num_points)
@@ -535,7 +538,7 @@ def _spiral_fill(tree, stitch_length, tolerance, close_point, enable_random_stit
path = spiral_maker(rings, stitch_length, starting_point)
path = [Stitch(*stitch) for stitch in path]
- return running_stitch(path, stitch_length, tolerance, enable_random_stitch_length, random_sigma, random_seed)
+ return running_stitch(path, [stitch_length], tolerance, enable_random_stitch_length, random_sigma, random_seed)
def _get_spiral_rings(tree):