48 lines
1 KiB
Text
48 lines
1 KiB
Text
SCREEN 1,320,200,5,1
|
|
WINDOW 2,"Mandelbrot",,0,1
|
|
|
|
maxIteration = 100
|
|
xmin = -2
|
|
xmax = 1
|
|
ymin = -1.5
|
|
ymax = 1.5
|
|
xs = 300
|
|
ys = 180
|
|
st = .01 ' use e.g. st = .05 for a coarser but faster picture
|
|
' and perhaps also lower maxIteration = 10 or so
|
|
xp = xs / (xmax - xmin) * st
|
|
yp = ys / (ymax - ymin) * st
|
|
|
|
FOR x0 = xmin TO xmax STEP st
|
|
FOR y0 = ymin TO ymax STEP st
|
|
x = 0
|
|
y = 0
|
|
iteration = 0
|
|
|
|
WHILE (x * x + y * y <= (2 * 2) AND iteration < maxIteration)
|
|
xtemp = x * x - y * y + x0
|
|
y = 2 * x * y + y0
|
|
|
|
x = xtemp
|
|
|
|
iteration = iteration + 1
|
|
WEND
|
|
|
|
IF iteration <> maxIteration THEN
|
|
c = iteration
|
|
ELSE
|
|
c = 0
|
|
END IF
|
|
COLOR c MOD 32
|
|
AREA ((x0 - xmin) * xp / st, (y0 - ymin) * yp / st)
|
|
AREA STEP (xp, 0)
|
|
AREA STEP (0, yp)
|
|
AREA STEP (-xp, 0)
|
|
AREA STEP (0, -yp)
|
|
AREAFILL
|
|
NEXT
|
|
NEXT
|
|
|
|
' endless loop, use Run -> Stop from the menu to stop program
|
|
WHILE (1)
|
|
WEND
|