Older Version Newer Version

bluatigro bluatigro Apr 4, 2010

WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
nomainwin
global mx , my , d , winx , winy , pi
pi = atn( 1 ) * 4
winx = WindowWidth
winy = WindowHeight
prompt "Mid X =" ; x$
prompt "Mid Y =" ; y$
prompt "Diam =" ; d$
mx = val( x$ )
my = val( y$ )
d = val( d$ )
if d < 1e-13 then d = 1e-13
open "Madelbrot"for graphics as #m
#m "trapclose [quit]"
for x = 0 - winx / 2 to winx / 2
for y = 0 - winy / 2 to winy / 2
cx = x / winx * d + mx
cy = y / winy * d + my
zx = cx
zy = cy
tel = 0
while sqr( zx ^ 2 + zy ^ 2 ) < 50 and tel < 36
hx = zx ^ 2 - zy ^ 2 + cx
hy = 2 * zx * zy + cy
zx = hx
zy = hy
tel = tel + 1
wend
r = sin( rad( tel * 10 ) ) * 127 + 128
g = sin( rad( tel * 10 - 120 ) ) * 127 + 128
b = sin( rad( tel * 10 + 120 ) ) * 127 + 128
#m "color " ; r ; " " ; g ; " " ; b
if tel = 36 then #m "color black"
#m "goto " ; x + winx / 2 ; " " ; y + winy / 2
#m "down"
#m "set " ; x + winx / 2 ; " " ; y + winy / 2
#m "up"
next y
next x
#m "flush"
wait
function rad( deg )
rad = deg * pi / 180
end function
[quit]
close #m
end