181. Friangle
~~~~~~~~
The inspiration for this program came to Bob G3WWF whilst watching a
programme on Channel 4. The theme was concerned with how simple rules are
able to define quite complex structures, such as a fern leaf. To illustrate
this, a simple method of plotting a sort of Fractal Triangle, (hence
"Friangle"), was briefly described. In Bob's words:-
"Three points of an equilateral triangle are stated, and then a random
initial point. A point is then plotted which is half way from the initial
point to one of the three triangle tips, chosen at random. From this new
point another point is plotted, again halfway to one of the triangle tips at
random, and so on. One's first assumption is surely that the points will fill
the triangle randomly, but not so!"
The program is very simple indeed, and has been further simplified and
speeded up by Rick G4BLT. An additional 20% increase in speed can be achieved
by using Integer arithmetic; change X to X%, Y to Y% and replace "/" with
"DIV". The result is surprising and pleasing; a recursive pattern in fact. A
few apparently 'stray' points will sometimes appear; see if you can work out
why this happens!
10 MODE0:X=RND(1182)-1:Y=RND(1024)-1:MOVEX,Y
20 REPEAT:ONRND(3)GOSUB100,110,120:PLOT69,X,Y:UNTILFALSE
30 :
100 X=X/2:Y=Y/2:RETURN
110 X=(X+1181)/2:Y=Y/2:RETURN
120 X=(X+590)/2:Y=(Y+1023)/2:RETURN