summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorpopolon.org <popolon@popolon.org>2007-07-12 22:42:04 +0000
committerpopolon2 <popolon2@users.sourceforge.net>2007-07-12 22:42:04 +0000
commitf868408d957f0b7edac70230e2c8d147b9826322 (patch)
tree244ecb12b6c5b818e07184a95983208f6b9b46b5 /share
parentswitch back to cairo pdf importer temporarily (diff)
downloadinkscape-f868408d957f0b7edac70230e2c8d147b9826322.tar.gz
inkscape-f868408d957f0b7edac70230e2c8d147b9826322.zip
fix bug #1752969 division by zero in fractalize
(bzr r3236)
Diffstat (limited to 'share')
-rwxr-xr-xshare/extensions/fractalize.py8
1 files 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