#include #include #include #include #include /* Create a number of randomly chosen thorn fractals Note this has been "minimalised" to convey the algorithm */ // The number of random images to create #define N 10 // Generally create the image large and subsample down for higher dynamic range #define NX 10000 #define NY 10000 int main(int argc,char **argv) { int i,j,k,im; double ir,ii,a,b,zi,zr; char fname[64]; FILE *fptr; short int *density = NULL; double xmin,xmax,ymin,ymax; double escape = 10000; int iterations = 255; double ci,cr; // Range on the plane for the image xmin = -M_PI; xmax = M_PI; ymin = -M_PI; ymax = M_PI; // Random seed srand(time(NULL)); // Create the image density = malloc(NX*NY*sizeof(short)); for (im=0;im 10; ci = (rand() % 10000) / 500.0 - 10; fprintf(stderr,"Creating image %d, (c_x,c_y) = (%g,%g)\n",im,cr,ci); for (i=0;i escape) break; } density[j*NX+i] = k; } } // Write the image to a raw file sprintf(fname,"%03d.raw",im); if ((fptr = fopen(fname,"w")) == NULL) { fprintf(stderr,"Unable to create image file\n"); exit(0); } for (j=0;j