Graphics Reference
In-Depth Information
formations w
1
, w
2
, and w
3
to all the points of the rectangle. Figure 22.5 shows the pic-
tures after the first seven iterations in Algorithm 22.4.1.
Algorithm 22.4.1 is what Barnsley calls a deterministic algorithm. We can intro-
duce some chance into the algorithm by picking our transformations w
i
randomly.
This and a slight generalization of Algorithm 22.4.1 leads to the nondeterministic
Algorithm 22.4.2. We start off with
q
0
= (0,0) and then generate the sequence of points
integer array
x[1..100,1..100], y[1..100,1..100], p
1
[1..2], p
2
[1..2], p
3
[1..2] ;
real array
A
1
[1..2,1..2], A
2
[1..2,1..2], A
3
[1..2,1..2];
integer
i, j;
Assuming that 1 corresponds to the color white and 0 to black, initialize the array x
so that
x[i,j] := 0 if i = 1,100 or j = 1,100 ,
:= 1 , otherwise
Draw x;
Initialize the arrays A
i
and p
i
to the values shown in (22.3) and (22.4), respectively.
loop
Initialize the array y to all 1s.
for
i:=1
to
100
do
for
j:=1
to
100
do
if
x[i,j] = 0
then
begin
y[ [i,j]A
1
+p
1
] := 0;
{ We truncate coordinates to integers }
y[ [i,j]A
2
+p
2
] := 0;
y[ [i,j]A
3
+p
3
] := 0;
end
;
x := y;
Draw x;
endloop
;
Algorithm 22.4.1.
A deterministic iterated function system.
Figure 22.5.
Results of a deterministic iterated function system ([Barn88]).