Nice one Wendigo - I love fractals. Here's one I did a few months back. (It has a point and click zoom.)
`******* Mandelbrot Set by Ric *******
`August 2004
remstart
The Mandelbrot Set is a fractal - a pattern with an infinite level of detail.
It is generated using a very simple mathematical equation, but the result is
a stunningly intricate, unpredictable, and non-repeating 'chaotic' pattern.
remend
sync on
s=1 `initial scale factor
limit#=200.0 `maximum number of iterations
zoom: `restart point for zooming in
`c is the input complex number (which has a 'real' part and an 'imaginary' part.)
`z is the output complex number.
for cr#=(-3+y#) to (3+y#) step 0.016 `set a range of values for c(real part
for ci#=(-3+x#) to (3+x#) step 0.016 `and imaginary parts).
cr#=cr#/s `scale the values of c by the scale factor
ci#=ci#/s
zr#=cr# `feed new value of c into initial value of z
zi#=ci# `same for imaginary parts
it#=0.0 `reset number of iterations
repeat
remstart
Now use the equation for the Mandelbrot set, z=z^2+c, expanded using
complex algebra to give: Z(real)=[Z(r)^2-z(i)^2)+C(r)], and
Z(imaginary)=[(2*Z(r)*Z(i))+C(i)], and repeat the process for it# iterations
to allow z the chance to increase.
remend
zrnew#=((zr#^2)-(zi#^2)+cr#)
zinew#=((2*zr#*zi#)+ci#)
it#=it#+1
zr#=zrnew# `note that zi(new) relies on old value of zr, not zr(new).
zi#=zinew#
remstart
Now test whether the amplitude of z (the hypontenues of its
real and imaginary parts) has increased above a certain limit
(ie an unbound/divergent number). If all iterations have
been completed then z is bound/non divergent.
remend
until sqrt((zr#^2)+(zi#^2))>4 or it#>limit#
cr#=cr#*s `unscale c back to normal ready to print pattern
ci#=ci#*s
remstart
draw a dot at a position which represents c, and in a shade which
represents how many iterations it took for z to go over limit
remend
if it#>limit# then it#=0 ` black if it was straight away (no iterations)
ink rgb (it#*12,it#*4,it#*7),0
box ((ci#-x#)*60+(screen width()/2)),((cr#-y#)*60+(screen height()/2)),1+((ci#-x#)*60+(screen width()/2)),1+((cr#-y#)*60+(screen height()/2))
next ci# `repeat for next value of c
sync
if escapekey()=1 then exit
next cr#
`zoom in and reposition the fractal by offseting c by x,y
do
if mouseclick()=1
x#=(x#+(mousex()-(0.5*screen width()))/(60))*2
y#=(y#+(mousey()-(0.5*screen height()))/(60))*2
s=s*2
cls
goto zoom
endif
loop
`have a nice day.