Mandelbrot program 
Author Message
 Mandelbrot program

There are Mandelbrot program's codes below:

/*------------------------------------------------*/
#include<graphics.h>
#define XMAX 319
#define YMAX 239
#define MAXCOUNT 16

main()
{
 int x,y;
 float xscale,yscale;
 float left,top;
 float xside,yside;
 float zx,zy;
 float cx,cy;
 float tempx;
 int count;
 int driver,mode;

 left=-2.0;
 top=1.25;
 xside=2.5;
 yside=-2.5;
 xscale=xside/XMAX;
 yscale=yside/YMAX;

 driver=DETECT;
 registerbgidriver(EGAVGA_driver);
 initgraph(&driver,&mode,"...");
 rectangle(0,0,XMAX+1,YMAX+1);

 for(y=1;y<=YMAX;y++){
  for(x=1;x<=XMAX;x++){
   cx=x*xscale+left;
   cy=y*yscale+top;
   zx=zy=0;
   count=0;

   while(zx*zx+zy*zy<4 && count<MAXCOUNT){
    tempx=zx*zx-zy*zy+cx;
    zy=2*zx*zy+cy;
    zx=tempx;
    count++;
   }
   putpixel(x,y,count);

   if(kbhit()) exit(0);
  }
 }
 getch();
 closegraph();

Quote:
}

/*----------over-----------*/

To change the variables:left,top,xside,yside's value will explor the details
of the mandelbrot set,but I don't know how to change,it's looked as if
without any rules,and I want to know the algorithm about it also.Thanks.

--



Sun, 24 Mar 2002 03:00:00 GMT  
 Mandelbrot program


Quote:
>There are Mandelbrot program's codes below:

If you did not write this code, you must ask the author.  (Yes I know
how the program works, but there may well be a copyright issue.  Note to
moderator, we should be careful of whole programs quoted by other than
the original author, particularly if acknowledgement of source is given)

Francis Glassborow      Journal Editor, Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
--



Mon, 25 Mar 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Mandelbrot algorithm summary

2. Re : Mandelbrot algorithm

3. Mandelbrot algorithm

4. Mandelbrot Set Graphing

5. C# Newbie needs help on Mandelbrot (fractal) object

6. Convert a VC++program written in .cpp and .bat to a regular MC++ program

7. How to call a program from another program ?

8. Getting a program to make a program

9. new freeware programming tool, source available: Programming Language Creator 1.00c (with C Interpreter Module)

10. Timing a program (process) from another program

11. Execution of another program from a running program

12. Problem with programming in C/ Creating a Robot Chase Program

 

 
Powered by phpBB® Forum Software