diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-05-28 21:34:58 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-05-28 21:34:58 -0400 |
| commit | 49b8c9f00b589ec4f2bac02a17b8d58583903e27 (patch) | |
| tree | afa344dcae324576bbe631a4d8fb88379a6ae55d /lib/stitches/running_stitch.py | |
| parent | 9c2350eff7c3ba48f69858f5e3a710a4dd404846 (diff) | |
fix two bugs in running stitch
* the first stitch was duplicated
* the last stitch was omitted
Diffstat (limited to 'lib/stitches/running_stitch.py')
| -rw-r--r-- | lib/stitches/running_stitch.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/stitches/running_stitch.py b/lib/stitches/running_stitch.py index 81124339..96075e7a 100644 --- a/lib/stitches/running_stitch.py +++ b/lib/stitches/running_stitch.py @@ -16,7 +16,7 @@ def running_stitch(points, stitch_length): if len(points) < 2: return [] - output = [points[0]] + output = [] segment_start = points[0] last_segment_direction = None @@ -59,8 +59,8 @@ def running_stitch(points, stitch_length): last_segment_direction = segment_direction distance -= segment_length - # stitch the last point unless we're already almos there - if (segment_start - points[-1]).length() > 0.1: + # stitch the last point unless we're already almost there + if (segment_start - output[-1]).length() > 0.1: output.append(segment_start) return output |
