FBA The Creator
http://www.fbacreator.com/fbaforum/

How to draw fractal
http://www.fbacreator.com/fbaforum/viewtopic.php?f=10&t=146
Page 1 of 1

Author:  dublicator [ Sat Feb 28, 2009 9:01 am ]
Post subject:  How to draw fractal

Code:
function DrawMandelbrot(x,y,au,bu,x2,y2)
 c2=bu
 for i=10,x2 do
  c1=au
  for j=0,y2 do
   z1=0
   z2=0
   count=0
   while (z1*z1+z2*z2<4) and (count<=90) do
    tmp=z1
    z1=z1*z1-z2*z2+c1
    z2=2*tmp*z2+c2
    count=count+1
   end
   tc=16*math.fmod(count,255)
   point(j,i,0,tc,0)
   c1=c1+x
  end
  c2=c2+y
 end
end

Code:
left=0
right=200
top=0
bottom=205
_ao=1
_au=-2
_bo=1.5
_bu=-1.5
dx=(_ao-_au)/(right-left)
dy=(_bo-_bu)/(bottom-top)
DrawMandelbrot(dx,dy,_au,_bu,right,bottom)

Attention! This function is very slow.

Attachments:
fractal.JPG
fractal.JPG [ 10.05 KiB | Viewed 25269 times ]

Author:  evilmaio [ Mon May 04, 2009 10:03 pm ]
Post subject:  Re: How to draw fractal

Very nice, thanks ;)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/