38 lines
1.3 KiB
Text
38 lines
1.3 KiB
Text
Module Mandelbrot(x=0&,y=0&,z=1&) {
|
|
If z<1 then z=1
|
|
If z>16 then z=16
|
|
Const iXmax=32*z
|
|
Const iYmax=26*z
|
|
Def single Cx, Cy, CxMin=-2.05, CxMax=0.85, CyMin=-1.2, CyMax=1.2
|
|
Const PixelWidth=(CxMax-CxMin)/iXmax, iXm=(iXmax-1)*PixelWidth
|
|
Const PixelHeight=(CyMax-CyMin)/iYmax,Ph2=PixelHeight/2
|
|
Const Iteration=25
|
|
Const EscRadious=2.5, ER2=EscRadious**2
|
|
Def single preview
|
|
preview=iXmax*twipsX*(z/16)
|
|
Def long yp, xp, dx, dy, dx1, dy1
|
|
Let dx=twipsx*(16/z), dx1=dx-1
|
|
Let dy=twipsy*(16/z), dy1=dy-1
|
|
yp=y
|
|
Refresh 2000
|
|
For iY=0 to (iYmax-1)*PixelHeight step PixelHeight {
|
|
Cy=CyMin+iY
|
|
xp=x
|
|
if abs(Cy)<Ph2 Then Cy=0
|
|
move xp, yp
|
|
For iX=0 to iXm Step PixelWidth {
|
|
Let Cx=CxMin+iX,Zx=0,Zy=0,Zx2=0,Zy2=0
|
|
For It=Iteration to 1 {Let Zy=2*Zx*Zy+Cy,Zx=Zx2-Zy2+Cx,Zx2=Zx**2,Zy2=Zy**2 :if Zx2+Zy2>ER2 Then exit
|
|
}
|
|
if it>13 then {it-=13} else.if it=0 then fill dx1, dy1, 0: Step 0,-dy1: continue
|
|
it*=10:fill dx1, dy1, color(it, it,255): Step 0,-dy1
|
|
} : yp+=dy
|
|
}
|
|
|
|
}
|
|
Cls 1,0
|
|
sz=(1,2,4,8,16)
|
|
i=each(sz)
|
|
While i {
|
|
Mandelbrot 250*twipsx,100*twipsy, array(i)
|
|
}
|