diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-01-04 20:08:11 -0500 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-01-04 20:08:11 -0500 |
| commit | 04ed93cb25198d216ea7adef66a1f4a1be854b58 (patch) | |
| tree | e2e53df82ded7d9dca97ed8dac7f1cc57c9e3e16 /lib/stitches/running_stitch.py | |
| parent | 004df12e88d1531740238ab9831577123e539196 (diff) | |
ability to stitch a single-point running stitch path
Diffstat (limited to 'lib/stitches/running_stitch.py')
| -rw-r--r-- | lib/stitches/running_stitch.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/stitches/running_stitch.py b/lib/stitches/running_stitch.py index 5f8ed21e..fa8c50ba 100644 --- a/lib/stitches/running_stitch.py +++ b/lib/stitches/running_stitch.py @@ -23,7 +23,7 @@ def running_stitch(points, stitch_length): segment_start = points[0] last_segment_direction = None - # This tracks the distance we've travelled along the current segment so + # This tracks the distance we've traveled along the current segment so # far. Each time we make a stitch, we add the stitch_length to this # value. If we fall off the end of the current segment, we carry over # the remainder to the next segment. @@ -62,8 +62,12 @@ def running_stitch(points, stitch_length): last_segment_direction = segment_direction distance -= segment_length + # stitch a single point if the path has a length of zero + if not output: + output.append(segment_start) + # stitch the last point unless we're already almost there - if (segment_start - output[-1]).length() > 0.1: + if (segment_start - output[-1]).length() > 0.1 or len(output) == 0: output.append(segment_start) return output |
