diff options
| author | George Steel <george.steel@gmail.com> | 2022-10-27 23:01:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-27 23:01:05 -0400 |
| commit | 0032e5cdd0bf26e5061d460903ffaaf34c120de0 (patch) | |
| tree | d2cba9647dca3baa490b84c8db1438d964101242 /lib/stitches/guided_fill.py | |
| parent | 27d2fcecaaec7ab3b153981a77f53a9eda8a8add (diff) | |
| parent | 1cc0eab91189227371c5bb78d9e1f1f06deaeaf5 (diff) | |
Merge pull request #1874 from inkstitch/george-steel/fractional-stagger
Add support for fractional-length stagger cycles in fills
Diffstat (limited to 'lib/stitches/guided_fill.py')
| -rw-r--r-- | lib/stitches/guided_fill.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/stitches/guided_fill.py b/lib/stitches/guided_fill.py index 05de14cd..6a92f8e8 100644 --- a/lib/stitches/guided_fill.py +++ b/lib/stitches/guided_fill.py @@ -148,7 +148,9 @@ def take_only_line_strings(thing): def apply_stitches(line, max_stitch_length, num_staggers, row_spacing, row_num): - start = (float(row_num % num_staggers) / num_staggers) * max_stitch_length + if num_staggers == 0: + num_staggers = 1 # sanity check to avoid division by zero. + start = ((row_num / num_staggers) % 1) * max_stitch_length projections = np.arange(start, line.length, max_stitch_length) points = np.array([line.interpolate(projection).coords[0] for projection in projections]) stitched_line = shgeo.LineString(points) |
