summaryrefslogtreecommitdiff
path: root/lib/stitches/fill.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-03-29 10:25:02 +0100
committerGitHub <noreply@github.com>2024-03-29 10:25:02 +0100
commit2439adafa8592995d9acead47ef2802d5d95c373 (patch)
treebfa10aaf017bc48cf6c166c7adeb9afd5dc12922 /lib/stitches/fill.py
parentfb1ecd0badf5eb142f17cc7f0f7e8b347151b002 (diff)
Add "the tartan universe" (#2782)
Diffstat (limited to 'lib/stitches/fill.py')
-rw-r--r--lib/stitches/fill.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py
index 9e9ff790..c492a629 100644
--- a/lib/stitches/fill.py
+++ b/lib/stitches/fill.py
@@ -14,12 +14,15 @@ from ..utils import cache
from ..utils.threading import check_stop_flag
-def legacy_fill(shape, angle, row_spacing, end_row_spacing, max_stitch_length, flip, staggers, skip_last):
+def legacy_fill(shape, angle, row_spacing, end_row_spacing, max_stitch_length, flip, reverse, staggers, skip_last):
rows_of_segments = intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing, flip)
groups_of_segments = pull_runs(rows_of_segments, shape, row_spacing)
- return [section_to_stitches(group, angle, row_spacing, max_stitch_length, staggers, skip_last)
- for group in groups_of_segments]
+ stitches = [section_to_stitches(group, angle, row_spacing, max_stitch_length, staggers, skip_last)
+ for group in groups_of_segments]
+ if reverse:
+ stitches = [segment[::-1] for segment in stitches[::-1]]
+ return stitches
@cache
@@ -223,14 +226,8 @@ def pull_runs(rows, shape, row_spacing):
# over to midway up the lower right leg. We want to stop there and
# start a new patch.
- # for row in rows:
- # print >> sys.stderr, len(row)
-
- # print >>sys.stderr, "\n".join(str(len(row)) for row in rows)
-
rows = list(rows)
runs = []
- count = 0
while (len(rows) > 0):
run = []
prev = None
@@ -248,10 +245,7 @@ def pull_runs(rows, shape, row_spacing):
rows[row_num] = rest
- # print >> sys.stderr, len(run)
runs.append(run)
rows = [r for r in rows if len(r) > 0]
- count += 1
-
return runs