#include #include #include #include "paulslib.h" #include "bitmaplib.h" /* Fractal popcorn */ #define width 1000 #define height 1000 int main(int argc,char **argv) { int i,j,ix,iy,n,N,M; BITMAP4 *image = NULL; COLOUR colour; BITMAP4 bc,white = {255,255,255}; FILE *fptr; char fname[100]; double scale = 1; double hconst = 0.05; double x,y,xnew,ynew; if (argc < 5) { fprintf(stderr,"Usage: %s scale N M hconst\n",argv[0]); exit(-1); } scale = atof(argv[1]); // Width of image in world coordinates N = atoi(argv[2]); // Number of points to draw, eg: 100 M = atoi(argv[3]); // Density of sampling the image as initial conditions hconst = atof(argv[4]); image = Create_Bitmap(width,height); Erase_Bitmap(image,width,height,white); for (i=0;i= 0 && iy >= 0 && ix < width && iy < height) Draw_Pixel(image,width,height,ix,iy,bc); x = xnew; y = ynew; } } } sprintf(fname,"%g_%d,%d_%g.tga",scale,N,M,hconst); fptr = fopen(fname,"w"); Write_Bitmap(fptr,image,width,height,12); fclose(fptr); exit(0); }