Graphics Reference
In-Depth Information
real array A 1 [1..2,1..2], A 2 [1..2,1..2], º , A m [1..2,1..2], p 1 [1..2], p 2 [1..2], º , p m [1..2];
real array s[1..m];
real
x, y, newx, newy;
integer
numIterations, n, ix, iy;
Initialize the arrays A i , p i , and s;
Set the screen to white;
(x,y) := (0,0); numIterations := Desired number of iterations;
for n:=1 to numIterations do
begin
k := one of the indices {1,2, º ,m}, where probability of picking index i is s[i];
(newx,newy) := [x,y]A k +p k ;
(ix,iy) := round (scale factor)*(newx,newy)+(screen center) to integers;
if n > 10 then SetPixel (ix,iy,black);
{ Skip first 10 iterations }
(x,y) := (newx,newy);
end ;
Algorithm 22.4.2.
A nondeterministic iterated function system.
Figure 22.6.
Results of a nondeterministic iterated function system.
q i , i > 0, using the formula q i = T( q i-1 ), where T is one of the transformations w 1 , w 2 ,
..., w m chosen at random (with possibly different probabilities) at each stage. The
scaled and offset points are plotted on the screen as we go along, except that the first
few are discarded and not plotted because they would introduce some initial “noise”
into the picture. Figure 22.6 shows the result after a sufficient number of iterations
using the following data with m = 4 from [Barn88]:
Search WWH ::




Custom Search