/* Brotkopie in F_b */ #include #include #include #include /* Default dimensions */ #define IDIM 120 #define JDIM 160 #define MAXITER 500 #define CENTRE {-3,0} #define CENTREX -20 /* small:cx=-5.385, y=0, r=.05*/ #define CENTREY 0 /*copy: cx=-3.8,cy=0,r=2.2 */ #define RADIUS 50 /* big :cx=-20,cy=0,r=50 */ FILE *ptcol,*outfpt; int idim,jdim,redn,bluen,greenn; int rotate,aux1,aux2,aux3,k; int maxiter,max_a,max_b,min_a,min_b,aux; int red[65536],green[65536],blue[65536]; int store[65536]; /*stores one line of the raster image file for writing later*/ main() { char outfile[25]; double centrex,centrey; double deltax,gx,gy,balt, calt, reeins, imeins, rezwei, imzwei, imteil, reteil, betrag, betrageins,deltay,startx,starty; double radius; double b,c,lambdar, lambdai; int j,k; int i; double x_size, y_size; double re,im, imag, real; void printhex(int k); /* outputs a two digit hexadecimal number to the postscript file*/ x_size=IDIM; y_size=JDIM; idim = IDIM; jdim = JDIM; rotate = (IDIM > JDIM) ? 0 : 1; maxiter = MAXITER; centrex = CENTREX; centrey = CENTREY; radius = RADIUS; lambdar=0.27334; /*0.25939+0.00046i*/ lambdai=0.00742; printf("Please specify the name of the output file\n"); scanf("%s",&outfile); strcat(outfile,".ps"); printf("The outputfile will be called: %s\n",outfile); outfpt = fopen(outfile, "w"); if(outfpt == NULL) { printf("Cannot open the file %s\n",outfile); exit(0); } /* fprintf(outfpt,"%!\n");*/ fprintf(outfpt,"%%%%BoundingBox: 0 0 %d %d\n",idim, jdim); fprintf(outfpt,"%d %d scale\n",800,600); if (rotate == 0) { fprintf(outfpt,"/linebuf %d string def\n",3*jdim); fprintf(outfpt,"%d %d 8\n",jdim,idim); fprintf(outfpt,"[%d 0 0 -%d 0 %d]\n",idim,jdim,idim); fprintf(outfpt,"{currentfile linebuf readhexstring pop}\n"); fprintf(outfpt,"false 3 colorimage\n"); startx=centrex-radius; starty=centrey-0.75*radius; deltax=2*radius/x_size; deltay=1.5*radius/y_size; for (i=0; i 4) {break;} } /* aux=255*((re)*(re)+im*im>4); if ((re)*(re)+im*im<400) aux=180; if ((re)*(re)+im*im<50) aux=120; if ((re)*(re)+im*im<7) aux=60; if ((re)*(re)+im*im<4) aux=0;*/ if (k==maxiter) {aux1=0;aux2=0;aux3=0;} if (k0.16*maxiter) {aux1=255;aux2=255*(k/(0.06*maxiter)-0.16/0.06);aux3=0;} /*gelb*/ if (k<0.16*maxiter) {aux1=255;aux2=0;aux3=0;} /*rot*/ if (k<0.08*maxiter) {aux1=255-102*(-k/(maxiter*0.01)+0.08/0.01);aux2=0;aux3=102-102*(k/(maxiter*0.01)-0.07/0.01);} /*violett*/ /*---------------------------------------------------------------------------------------------*/ printhex(aux1); printhex(aux2); printhex(aux3); } }} else { fprintf(outfpt,"/linebuf %d string def\n",3*idim); fprintf(outfpt,"%d %d 8\n",idim,jdim); fprintf(outfpt,"[%d 0 0 -%d 0 %d]\n",jdim,idim,jdim); fprintf(outfpt,"{currentfile linebuf readhexstring pop}\n"); fprintf(outfpt,"false 3 colorimage\n"); startx = -.75*radius + centrex; starty = -1.0*radius + centrey; deltax = 1.5*radius/x_size; deltay = 2.0*radius/y_size; for (j=0; j0 && c*c0 && c*c-1 && b<8) {aux=255;} */ if (aux==255) {aux1=255;aux2=255;aux3=255;} if (aux==0) {aux1=0;aux2=0;aux3=0;} if (k<20) {aux1=255;aux2=255;aux3=0;} /*gelb*/ /* if (k<12 && k>6) {aux1=255;aux2=255*(k/4-11/4);aux3=0;} /*gelb*/ if (k==13) {aux1=255;aux2=200;aux3=0;} if (k==12) {aux1=255;aux2=150;aux3=0;} if (k==11) {aux1=255;aux2=100;aux3=0;} if (k==10) {aux1=255;aux2=50;aux3=0;} if (k==9) {aux1=255;aux2=0;aux3=0;} if (k<9) {aux1=255;aux2=0;aux3=0;} /*rot*/ if (k<8) {aux1=225;aux2=0;aux3=25;} if (k<6) {aux1=200;aux2=0;aux3=50;} if (k<4) {aux1=175;aux2=0;aux3=75;} /*if (k<2) {aux1=150;aux2=0;aux3=100;} /* if (k<4) {aux1=153;aux2=0;aux3=102;} if (k==4) {aux1=125;aux2=0;aux3=125;} if (k<4) {aux1=100;aux2=0;aux3=150;} */ if (b>-1 && b<7.5 && c*c<4.8*(7.5-b)) {aux=128;} if (b>-1.6 && b<7.5 && c==0) {aux=128;} if (aux==128) {aux1=102;aux2=0;aux3=153;} /*---------------------------------------------------------------------------------------------*/ printhex(aux1); printhex(aux2); printhex(aux3); } } } fprintf(outfpt,"\n"); fprintf(outfpt,"showpage\n"); fclose(outfpt); } void printhex(int k) { if (k<16) fprintf(outfpt,"0%x",k); else fprintf(outfpt,"%x",k); }