Posted: 12:04pm 22 May 2020 |
|
|
|
Julia and mandlebrot
map maximite 'Specify initial values RealOffset = -1.5 '-1.30 RIGHT-left ImaginOffset = -1.1 '1.0 '-1.22 Top-Bottom '------------------------------------------------* 'Set the Julia set constant [eg C = -1.2 + 0.8i] CRealVal = -0.78 CImagVal = -0.20 '------------------------------------------------* MAXIT=30'0 '80 'max iterations PixelWidth = MM.HRes PixelHeight = MM.VRes GAP = PixelHeight / PixelWidth SIZE = 2.9 '2.50 - bigger value = smaller width XDelta = SIZE / PixelWidth YDelta = (SIZE * GAP) / PixelHeight
'Loop processing - visit every pixel For X = 0 To (PixelWidth - 1) CX = X * Xdelta + RealOffset For Y = 0 To (PixelHeight - 1) CY = Y * YDelta + ImaginOffset Zr = CX Zi = CY COUNT = 0 'Begin Iteration loop Do While (( COUNT <= MAXIT ) And (( Zr * Zr + Zi * Zi ) < 4 )) new_Zr = Zr * Zr - Zi * Zi + CRealVal new_Zi = 2 * Zr * Zi + CImagVal Zr = new_Zr Zi = new_Zi COUNT = COUNT + 1 Loop Pixel X,Y,map(COUNT Mod 8 +48) Next Y Next X save image "Julia2.bmp" Do a$ = Inkey$ Loop While a$ = ""
sizex%=800 sizey%=600 maxiter%=64 'Option console off CLS For X% = 0 To 2*sizex%-2 Step 2 xi = X%/200 - 2 For Y% = 0 To sizey%-2 Step 2 yi = Y% / 200 xx = 0 yy = 0 For I% = 1 To maxiter% If xx*xx+yy*yy > 4 Then Exit For xt = xi + xx*xx-yy*yy yy = yi + 2*xx*yy xx = xt Next If I%>=maxiter% Then I%=0 Box X%,Y%+300,2,2,,map(i%*4) : Box X%,-Y%+300,2,2,,map(i%*4) Next Y% Next X% |