proteus2002
01-03-2008, 02:42 PM
it is very slow and even useless, but maybe someone is iterested in this mandelbrot script.
i have adapted the code from here: http://gmc.yoyogames.com/index.php?showtopic=273433
if someone has an idea to make it faster, then do it !
greetings boris
pr = undefined
pt = undefined
iter = 0.0
zoomf = 1.0
moveX = -0.5
moveY = 0.0
maxIterations = 50
newRe = 0.0
newIm = 0.0
oldRe = 0.0
oldIm = 0.0
w = 300
h = 300
tmp_bmp = bitmap w h
col_arr = #()
disableSceneRedraw()
undo off
for xx = 1 to w do
(
col_arr = #()
for yy = 1 to h do
(
pr = 1.5 * (xx - w / 2.0) / (0.5 * zoomf * w) + moveX
pt = (yy - h / 2.0) / (0.5 * zoomf * h) + moveY
newRe = 0.0
newIm = 0.0
oldRe = 0.0
oldIm = 0.0
for i = 0 to maxIterations by 1 do
(
oldRe = newRe
oldIm = newIm
newRe = oldRe * oldRe - oldIm * oldIm + pr
newIm = 2.0 * oldRe * oldIm + pt
iter = i -- this is the iteration when exiting the loop
if((newRe * newRe + newIm * newIm) > 4) then exit
)
col = 256.0/maxIterations*iter -- create a color value based on iter
newcol = (color col col col)
append col_arr newcol
)
setpixels tmp_bmp [0,xx] col_arr
display tmp_bmp
)
enableSceneRedraw()
i have adapted the code from here: http://gmc.yoyogames.com/index.php?showtopic=273433
if someone has an idea to make it faster, then do it !
greetings boris
pr = undefined
pt = undefined
iter = 0.0
zoomf = 1.0
moveX = -0.5
moveY = 0.0
maxIterations = 50
newRe = 0.0
newIm = 0.0
oldRe = 0.0
oldIm = 0.0
w = 300
h = 300
tmp_bmp = bitmap w h
col_arr = #()
disableSceneRedraw()
undo off
for xx = 1 to w do
(
col_arr = #()
for yy = 1 to h do
(
pr = 1.5 * (xx - w / 2.0) / (0.5 * zoomf * w) + moveX
pt = (yy - h / 2.0) / (0.5 * zoomf * h) + moveY
newRe = 0.0
newIm = 0.0
oldRe = 0.0
oldIm = 0.0
for i = 0 to maxIterations by 1 do
(
oldRe = newRe
oldIm = newIm
newRe = oldRe * oldRe - oldIm * oldIm + pr
newIm = 2.0 * oldRe * oldIm + pt
iter = i -- this is the iteration when exiting the loop
if((newRe * newRe + newIm * newIm) > 4) then exit
)
col = 256.0/maxIterations*iter -- create a color value based on iter
newcol = (color col col col)
append col_arr newcol
)
setpixels tmp_bmp [0,xx] col_arr
display tmp_bmp
)
enableSceneRedraw()
