PDA

View Full Version : Fractal Island



peter
04-04-2014, 16:08
Hello,

3D Island.

It seems that every Basic dialect has its own RGB algorithms.
If you change Thinbasic RGB to xRGB, you will see what I mean.



Uses "ui"
#INCLUDE "abc.inc"

OpenWindow 400, 300
Canvas_Clear 0
DrawString 10,10,"A MOMENT...",&hffffff
Canvas_Redraw

Single cRe,cIm,newRe,newIm,oldRe,oldIm,z,movex,movey
Long imax,x,y,i,a

cRe = -0.8 : cIm = 0.27015 : z=1
imax=256

For x=0 To 400
For y=0 To 300
newRe = 1.8 * (x-400*.5) / (.5*z*400) + movex
newIm = (y-300*.5) / (.5*z*300) + movey
For i=0 To imax
oldRe = newRe
oldIm = newIm
newRe = oldRe * oldRe - oldIm * oldIm +cRe
newIm = 2 * oldRe * oldIm + cIm
If((newRe * newRe + newIm * newIm) >5) Then Exit For
Next
canvas_SetPixel x,y, Rgb 55*i, 55, 155-i
Next
Next
Canvas_Redraw

While IsWindow(hwnd) And Key(27)=0
Sleep 10
Wend
Canvas_Window End hwnd