From cdeaa3f33033035a0248b1cbac7da401609d5706 Mon Sep 17 00:00:00 2001 From: popolon2 Date: Thu, 12 Jul 2007 22:42:04 +0000 Subject: [PATCH] fix bug #1752969 division by zero in fractalize --- share/extensions/fractalize.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/extensions/fractalize.py b/share/extensions/fractalize.py index 8ec9f80ae..e0611d75c 100755 --- a/share/extensions/fractalize.py +++ b/share/extensions/fractalize.py @@ -27,8 +27,12 @@ def calculateSubdivision(x1,y1,x2,y2,smoothness): hy = y1 + y3/2 """ Calculate normalized vector perpendicular to the vector (x3,y3) """ length = math.sqrt(x3*x3 + y3*y3) - nx = -y3/length - ny = x3/length + if length != 0: + nx = -y3/length + ny = x3/length + else: + nx = 1 + ny = 0 """ Scale perpendicular vector by random factor """ r = random.uniform(-length/(1+smoothness),length/(1+smoothness)) nx = nx * r -- 2.30.2