diff options
| author | Kaalleen <reni@allenka.de> | 2022-05-19 20:03:37 +0200 |
|---|---|---|
| committer | Kaalleen <reni@allenka.de> | 2022-05-19 20:03:37 +0200 |
| commit | 47123198760f8740acda0799d3b22f14b3f69550 (patch) | |
| tree | 80c2448484b4f5891af78e9486dbcb44b819c8af | |
| parent | 1b0d46af36c38fda204f4107d1b8b469277fefa6 (diff) | |
avoid simple satin division by zero error
| -rw-r--r-- | lib/elements/stroke.py | 4 |
1 files changed, 4 insertions, 0 deletions
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() |
