From 7943fa23909400a3b622c9dd8cb8fbce3be70433 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sat, 1 Feb 2020 15:22:35 +0100 Subject: [PATCH] flex2D: Fix division by zero for too small patterns --- boxes/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boxes/__init__.py b/boxes/__init__.py index 20c6a99..8f6c77f 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -1442,8 +1442,12 @@ class Boxes: """ width *= self.thickness cx = int(x // (5 * width)) - wx = x / 5. / cx cy = int(y // (5 * width)) + + if cx == 0 or cy == 0: + return + + wx = x / 5. / cx wy = y / 5. / cy armx = (4 * wx, 90, 4 * wy, 90, 2 * wx, 90, 2 * wy)