Page 1 of 1

Mandelbrot

Posted: Mon Jul 28, 2014 3:27 pm
by peter
Hello,

Code: Select all

SCREEN 800, 600

Global x#, y#, zx#, zy#, cx#, cy#, tp# 
Global im, z, it

im=570: z=150 
h = ScreenHeight()
w = ScreenWidth ()

Text 200,200,"WAIT A MOMENT...."
DrawScreen 

Lock
For y=0 To h-1
    For x=0 To w-1
        zx=0
        zy=0
        cx= (x-400)/z	
        cy= (y-300)/z
        it = im
	While zx * zx + zy * zy < 4 And it>0 
        tp = zx * zx - zy * zy + cx
        zy = 2 * zx * zy + cy
        zx = tp
        it = it-1
	Wend      
        PutPixel2 x,y, RGB(it*12,it*8,it*4)
    Next x
Next y
Unlock

DrawScreen 
WaitKey

Function RGB(r0, g0, b0) 
    g0=g0*256: r0=r0*65536
    Return r0+g0+b0              
End Function

Re: Mandelbrot

Posted: Tue Jul 29, 2014 8:20 pm
by CCE
This is pretty damn ace! Please make more :)

Edit: By they way, since you seem to be interested in graphics programming, you should check out our CoolBasic demo Linear Minds. Also includes source code!

Re: Mandelbrot

Posted: Tue Jul 29, 2014 8:43 pm
by peter
By they way, since you seem to be interested in graphics programming, you should check out our CoolBasic demo Linear Minds. Also includes source code!
wow, this vector graphic is very cool! well done.
Unfortunately, your source code has too many finnish notations, this isn't that easy to read for me.
nevertheless, thanks for your offer.