summaryrefslogtreecommitdiff
path: root/lib/stitch_plan
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitch_plan')
-rw-r--r--lib/stitch_plan/lock_stitch.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/stitch_plan/lock_stitch.py b/lib/stitch_plan/lock_stitch.py
index 1a8923af..9d720146 100644
--- a/lib/stitch_plan/lock_stitch.py
+++ b/lib/stitch_plan/lock_stitch.py
@@ -85,12 +85,15 @@ class RelativeLock(LockStitchDefinition):
to_previous = stitches[1] - stitches[0]
length = to_previous.length()
+ if length == 0:
+ direction = Stitch(0, 0.5)
+ else:
+ direction = to_previous.unit()
+
# travel at least 0.5 and at most 1.5
length = max(length, 0.5 * PIXELS_PER_MM)
length = min(length, 1.5 * PIXELS_PER_MM)
- direction = to_previous.unit()
-
# Travel back one stitch, stopping halfway there.
# Then go forward one stitch, stopping halfway between
# again.