diff options
| author | Lex Neva <github.com@lexneva.name> | 2023-07-21 22:55:18 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2023-07-21 22:55:18 -0400 |
| commit | 6f541a79f302dca67fa5fc60ec3fd9659c7b7a85 (patch) | |
| tree | 91c72427c77e553edb8e04cb10055c46af1c3c86 | |
| parent | 1e4a63f5e6195ed606a050bf53e8aa8b72c347d9 (diff) | |
fix zig-zag short stitches
| -rw-r--r-- | lib/elements/satin_column.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index d137c2d6..25606ab8 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -1273,8 +1273,8 @@ class SatinColumn(EmbroideryElement): # alternate picking one point from each pair, first on one rail then the other points = [p[i % 2] for i, p in enumerate(pairs)] - # turn the list of points back into pairs, (a, b), (b, c), (c, d), etc - pairs = list(zip(points[:-1], points[1:])) + # turn the list of points back into pairs + pairs = [points[i:i + 2] for i in range(0, len(points), 2)] short_pairs = self.inset_short_stitches_sawtooth(pairs) max_stitch_length = self.max_stitch_length_px @@ -1283,13 +1283,26 @@ class SatinColumn(EmbroideryElement): min_split_length = self.min_random_split_length_px seed = self.random_seed - patch.add_stitch(pairs[0][0]) + last_point = None + last_point_short = None for i, (a, b), (a_short, b_short) in zip(itertools.count(0), pairs, short_pairs): + if last_point: + split_points, _ = self.get_split_points( + last_point, a, last_point_short, a_short, max_stitch_length, None, + length_sigma, random_phase, min_split_length, prng.join_args(seed, 'satin-split', 2 * i), row_num=2 * i, from_end=True) + patch.add_stitches(split_points, ("satin_column", "zigzag_split_stitch")) + + patch.add_stitch(a_short) + split_points, _ = self.get_split_points( a, b, a_short, b_short, max_stitch_length, None, - length_sigma, random_phase, min_split_length, prng.join_args(seed, 'satin-split', 2 * i), row_num=i, from_end=(i % 2 == 0)) + length_sigma, random_phase, min_split_length, prng.join_args(seed, 'satin-split', 2 * i + 1), row_num=2 * i + 1) patch.add_stitches(split_points, ("satin_column", "zigzag_split_stitch")) - patch.add_stitch(b) + + patch.add_stitch(b_short) + + last_point = b + last_point_short = b_short if self._center_walk_is_odd(): patch.stitches = list(reversed(patch.stitches)) |
