/* F_a */ #include #include #include #include /* Default dimensions */ #define IDIM 600 #define JDIM 800 #define MAXITER 500 #define CENTRE {-3,0} #define CENTREX 2 #define CENTREY 0 /*kleine kopie: cx=0.05 cy=-.11 r=.012 fa2*/ #define RADIUS 3 /*bild5: cx=0.05,cy=-.07,r=0.07 fa1*/ /*bild6: cx=2,cy=0,r=3 fa3*/ /*bild7: cx=25 ,cy=0,r= 50 fa4*/ 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=204;aux2=0;aux3=51;} if (k==7) {aux1=153;aux2=0;aux3=102;} /* if (k<4) {aux1=153;aux2=0;aux3=102;} */ if (k<7) {aux1=0;aux2=0;aux3=255;} if (k<5) {aux1=51;aux2=0;aux3=204;} if (k<3) {aux1=51;aux2=0;aux3=150;} if (b>-.7 && b<7.5 && c*c<4.8*(7.5-b)) {aux=128;} /*if (b>-1 && b<7.5 && c==0) {aux=128;}*/ if (aux==128) {aux1=0;aux2=0;aux3=255;} if (b>-1.6 && b<-1.55-0.015/12-1/80 && c*c<0.00001) {aux1=255;aux2=0;aux3=0;} if (b>-1.55-0.015/12-1/80-0.00001 && b<-1.2616 && c*c<0.00001) {aux1=204;aux2=0;aux3=51;} if (b>-1.2616 && b<-.9 && c*c<0.01 && aux1==51) {aux1=153;aux2=0;aux3=102;} } /*---------------------------------------------------------------------------------------------*/ 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); }