diff --git a/extensions/fablabchemnitz/flevobezier.py b/extensions/fablabchemnitz/flevobezier.py index 6c013b13..8ea87284 100644 --- a/extensions/fablabchemnitz/flevobezier.py +++ b/extensions/fablabchemnitz/flevobezier.py @@ -65,7 +65,11 @@ def flevobezier(points, z): window = points[trail:lead + 1] # Extend the window one more node v = window[-3] - window[-2] w = window[-1] - window[-2] - if dotp(v, w) / dist(v) / dist(w) >= 0.5: # 60 degrees or less, over by angle + try: + v_w = dist(v) / dist(w) + except ZeroDivisionError as e: + pout("Division by zero. Check if your path contains duplicate handles.") + if dotp(v, w) / v_w >= 0.5: # 60 degrees or less, over by angle if maybeover: # backup newcurve = stress(points[prevtrail:lead])[0] res[-3:] = newcurve[1:] # replace the last three nodes in res with those of newcurve