home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- #include <math.h>
- #include <graphics.h>
-
-
- void main(void)
- {
- int i,j,k,l;
- int height, height2;
- unsigned char x,y,z;
- unsigned char bubblemass[70][70][70];
- unsigned char bubble[21][21][21];
- int graphdriver, graphmode, grerror;
-
-
-
- /*MAKE BUBBLE*/
-
- for(i=-10; i < 11; i++)
- {
- height = ceil(10*sin(acos((double)i/10)));
- if(height != 0)
- for(j=-height; j < height+1; j++)
- {
- height2 = ceil(height*sin(acos((double)j/height)));
- if(height2 !=0)
- for(k=-height2; k < height2+1; k++)
- bubble[i+10][j+10][k+10] = 1;
- }
- }
-
-
- /*INITIATE BUBBLE MASS*/
-
- for(i=0; i < 70; i++)
- for(j=0; j < 70; j++)
- for(k=0; k < 70; k++)
- bubblemass[i][j][k] = 0;
-
-
- /*CREATE BUBBLE MASS*/
-
- for(l=0; l<75; l++)
- {
- x = (unsigned char)(((double)(rand())*30/
- (double)RAND_MAX) + 10);
- y = (unsigned char)(((double)(rand())*30/
- (double)RAND_MAX) + 10);
- z = (unsigned char)(((double)(rand())*30/
- (double)RAND_MAX) + 10);
-
- for(i=0; i < 21; i++)
- for(j=0; j < 21; j++)
- for(k=0; k < 21; k++)
- if(bubble[i][j][k] == 1)
- if(bubblemass[x+i][y+j][z+k] < 15)
- bubblemass[x+i][y+j][z+k] ++;
- }
-
-
- /*PLOT RESLICED IMAGES*/
-
- graphdriver = VGA256;
- graphmode = 0;
- initgraph(&graphdriver, &graphmode, "");
- grerror = graphresult();
- if(grerror)
- {
- closegraph();
- printf("Error Initializing Graphics Mode.\n");
- exit(1);
- }
-
- while(!kbhit())
- {
- for(i=0; i < 70; i++)
- for(j=0; j < 70; j++)
- for(k=0; k < 70; k++)
- {
- putpixel(j, k, 16+bubblemass[i][j][k]);
- putpixel(j+70, k, 16+bubblemass[k][i][j]);
- putpixel(j, k+70, 16+bubblemass[j][k][i]);
- }
- }
-
- getch();
- closegraph();
- }
-