From 47123198760f8740acda0799d3b22f14b3f69550 Mon Sep 17 00:00:00 2001 From: Kaalleen Date: Thu, 19 May 2022 20:03:37 +0200 Subject: avoid simple satin division by zero error --- lib/elements/stroke.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/elements/stroke.py') diff --git a/lib/elements/stroke.py b/lib/elements/stroke.py index 307c78b8..c9c0f795 100644 --- a/lib/elements/stroke.py +++ b/lib/elements/stroke.py @@ -167,6 +167,10 @@ class Stroke(EmbroideryElement): for i in range(len(patch) - 1): start = patch.stitches[i] end = patch.stitches[i + 1] + # sometimes the stitch results into zero length which cause a division by zero error + # ignoring this leads to a slightly bad result, but that is better than no output + if (end - start).length() == 0: + continue segment_direction = (end - start).unit() zigzag_direction = segment_direction.rotate_left() -- cgit v1.2.3