summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 71558df)
raw | patch | inline | side by side (parent: 71558df)
author | popolon2 <popolon2@users.sourceforge.net> | |
Thu, 12 Jul 2007 22:42:04 +0000 (22:42 +0000) | ||
committer | popolon2 <popolon2@users.sourceforge.net> | |
Thu, 12 Jul 2007 22:42:04 +0000 (22:42 +0000) |
share/extensions/fractalize.py | patch | blob | history |
index 8ec9f80aed078f14c255d9052165045c126056f8..e0611d75cd25271a701c3159d969ddec500039fd 100755 (executable)
hy = y1 + y3/2\r
""" Calculate normalized vector perpendicular to the vector (x3,y3) """\r
length = math.sqrt(x3*x3 + y3*y3)\r
- nx = -y3/length\r
- ny = x3/length\r
+ if length != 0:\r
+ nx = -y3/length\r
+ ny = x3/length\r
+ else:\r
+ nx = 1\r
+ ny = 0\r
""" Scale perpendicular vector by random factor """\r
r = random.uniform(-length/(1+smoothness),length/(1+smoothness))\r
nx = nx * r\r