/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º º º º º cjulia = ADVANCED PROGRAM TO MAP THE JULIA SETS º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ */ #include #include #include #include #include #include "tools.h" #include const int maxcol = 639; const int maxrow = 349; const int max_colors = 16; int CURSOR_X=0,CURSOR_Y=0,col,row; int max_iterations; int max_size = 4; int LINEWIDTH=1, OPERATOR=0x00, ANGLE, XCENTER, YCENTER; unsigned long int PATTERN=0xFFFFFFFF; unsigned char PALETTE[16]={0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63}; int colors [8]= {0,1,2,3,4,5,20,7}; float P,Q; float TXMax,TXMin,TYMax,TYMin; union LIMIT XMax,YMax,XMin,YMin,Pval,Qval; char file_name[13] = {"mandel00.pcx"}; char file_name2[13] = {"julia000.pcx"}; FILE *f1,*f2; main() { float deltaX, deltaY, X, Y, Xsquare, Ysquare; int i,color, row, col,error,response,repeat=0x30,start_col; printf("Enter '0' to quit, '1' to expand " "or finish julia, '2' for new plot: "); do repeat = getch(); while ((repeat != 0x30) && (repeat != 0x31) && (repeat != 0x32)); while (repeat != 0x30) { printf("\nEnter number of iterations: "); scanf("%d",&max_iterations); printf("\nEnter background and six other colors separated by" " commas: "); scanf("%d,%d,%d,%d,%d,%d,%d",&colors[0],&colors[1], &colors[2],&colors[3],&colors[4],&colors[5], &colors[6]); if (repeat == 0x32) { printf("\nEnter mandelbrot set number " "(00 - 99): "); file_name[6] = getche(); file_name[7] = getche(); setMode(16); if ((isdigit(file_name[6])) && (isdigit(file_name [7]))) { error = restore_screen(file_name); } else exit(0); getch(); start_col = 0; move_cursor(2,15,0,0); XMax.f = 1.8; XMin.f = -1.8; YMax.f = 1.2; YMin.f = -1.2; P = Pval.f; Q = Qval.f; cls(7); } else { printf("\nEnter julia screen number " "(00 - 99): "); file_name2[6] = getche(); file_name2[7] = getche(); if ((isdigit(file_name2[6])) && (isdigit(file_name2[7]))) error = restore_screen(file_name2); else exit(0); if (error == 0) exit(0); else { if (error < 639) { start_col = 8 * (error/8); remove(file_name2); P = Pval.f; Q = Qval.f; } else { move_cursor(0,15,0,0); move_cursor(1,15,CURSOR_X,CURSOR_Y); XMax.f = TXMax; XMin.f = TXMin; YMax.f = TYMax; YMin.f = TYMin; start_col = 0; cls(7); } } } if (colors[0] <64) { setEGApalette(0,colors[0]); setEGApalette(1,colors[1]); setEGApalette(2,colors[2]); setEGApalette(3,colors[3]); setEGApalette(4,colors[4]); setEGApalette(5,colors[5]); setEGApalette(6,colors[6]); } deltaX = (XMax.f - XMin.f)/(maxcol); deltaY = (YMax.f - YMin.f)/(maxrow); for (col=start_col; col<=maxcol; col++) { if (kbhit() != 0) { Pval.f = P; Qval.f = Q; save_screen(0,0,col,349,file_name2); exit(0); } for (row=0; row<=maxrow; row++) { X = XMin.f + col * deltaX; Y = YMax.f - row * deltaY; Xsquare = 0; Ysquare = 0; color = 0; while ((color= max_iterations) { color = ((int)((Xsquare + Ysquare) *6.0))%6 + 1; } else color = 0; plot(col, row, color); } } Pval.f = P; Qval.f = Q; save_screen(0,0,639,349,file_name2); getch(); gotoxy(1,24); printf("File Name: %s Enter '0' = quit, '1' = expand " "plot, '2' = new plot: ",file_name2); repeat = getche(); } getch(); }