FBA The Creator

The True Multiplatform PC / PocketPC Opensource Development Tool - Read Only Mode - Kept only for historical purposes - Thank you all ;)
It is currently Sun Oct 24, 2021 3:49 pm

All times are UTC




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How to draw fractal
PostPosted: Sat Feb 28, 2009 9:01 am 
Offline

Joined: Sat Feb 28, 2009 8:41 am
Posts: 2
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 12780 times ]
Top
   
 Post subject: Re: How to draw fractal
PostPosted: Mon May 04, 2009 10:03 pm 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
Very nice, thanks ;)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited