-
Notifications
You must be signed in to change notification settings - Fork 1
/
bifs.py
30 lines (25 loc) · 832 Bytes
/
bifs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import fractal
def makeFunc(n):
def f(x):
# f(x) is the function u will create. use n as a variable parameter
return x #should return a tuple
return f
NUM_OF_FUNCS = 20
bifs = []
weights = []
for i in xrange(NUM_OF_FUNCS):
ifs.append(makeFunc(i))
weights.append(1.0) # generally weight should be approx. indirectly
# related to contraction constant
# use best judgement
#normalize weights
sumWeights = float(sum(weights))
for i in xrange(len(weights)):
weights[i] = weights[i]/sumWeights
# draw fractal
fractal.makeFractal(ifs=bifs,
weights=weights,
height=1000, width=1000,
xRange=(-0.25, 1.25), yRange=(-0.25, 1.25),
iterations=3000000, graininess=5,
bmpname="carpetBIFS")