Mandelbrot

Do you have something to share with us? A tip for newbies, perhaps? Post it here.
Post Reply
peter
Active Member
Posts: 123
Joined: Mon Oct 22, 2007 2:31 pm

Mandelbrot

Post 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
User avatar
CCE
Artist
Artist
Posts: 650
Joined: Mon Aug 27, 2007 9:53 pm

Re: Mandelbrot

Post 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!
peter
Active Member
Posts: 123
Joined: Mon Oct 22, 2007 2:31 pm

Re: Mandelbrot

Post 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.
Post Reply