diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2019-02-16 17:07:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-16 17:07:34 -0500 |
| commit | 2ab4c451e8042868b2516a6b3fe1f60836f27ffe (patch) | |
| tree | 0ce616ac57e6a2aa507461486233c71373467c9a /lib/stitches/running_stitch.py | |
| parent | bd6e4d9d32fd314b66f3c5d798c7151bf543d07f (diff) | |
| parent | fa3236372bcee28f4aaa78da47b68c5d7f32cca4 (diff) | |
tons of bug fixes (#364)
bug fixes
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 |
