Permalink
Browse files

added a linear transformation

  • Loading branch information...
1 parent 2503c4e commit 666d0dad62c4190617bd48d13e973140f77e87be @jtauber committed Jul 3, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 pyifs.py
View
@@ -57,6 +57,18 @@ def transform_colour(self, r, g, b):
return r, g, b
+class Linear(Transform):
+ def __init__(self):
+ super(Linear, self).__init__()
+ self.a = random.random() * 2 - 1
+ self.b = random.random() * 2 - 1
+ self.c = random.random() * 2 - 1
+ self.d = random.random() * 2 - 1
+
+ def transform(self, px, py):
+ return (self.a * px + self.b * py, self.c * px + self.d * py)
+
+
class ComplexTransform(Transform):
def transform(self, px, py):
@@ -117,7 +129,7 @@ def f(self, z):
ifs = IFS()
for n in range(NUM_TRANSFORMS):
- cls = random.choice([InverseJulia, Moebius, InverseJulia])
+ cls = random.choice([Linear, Moebius])
ifs.add(cls())

0 comments on commit 666d0da

Please sign in to comment.