diff --git a/Lab-3_29-08-2019/circle.cpp b/Lab-3_29-08-2019/circle.cpp index c13acf6..27a9370 100644 --- a/Lab-3_29-08-2019/circle.cpp +++ b/Lab-3_29-08-2019/circle.cpp @@ -1,4 +1,4 @@ -// Author: Kartikei Mittal +// Author: Kartikei Mittal, Tokir Manva // Circle Drawing #include #include @@ -15,31 +15,7 @@ void draw_y_axis() {for(int i=-my_SIZE[1]; iy) - // { - // y++; - // if (p <= 0) - // p += 2*y + 1; - // else - // { - // x--; - // p += 2*(y-x) + 1; - // } - // if (x < y) - // break; - // my_putpixel(x + x_c, y + y_c, GREEN); - // my_putpixel(-x + x_c, y + y_c, WHITE); - // my_putpixel(x + x_c, -y + y_c, WHITE); - // my_putpixel(-x + x_c, -y + y_c, WHITE); - // if(x != y) - // { - // my_putpixel( y + x_c, x + y_c, GREEN); - // my_putpixel(-y + x_c, x + y_c, WHITE); - // my_putpixel( y + x_c, -x + y_c, WHITE); - // my_putpixel(-y + x_c, -x + y_c, WHITE); - // } - // } + int p = 1-r; for(int x=0, y=r; x<=r;) { @@ -56,14 +32,36 @@ void my_circle(int x_c, int y_c, int r) my_putpixel( y + x_c, -x + y_c, WHITE); my_putpixel(-y + x_c, -x + y_c, WHITE); } + // delay(50); +} +void flood(int x,int y) +{ + if(getpixel(x,y) == BLACK ) + { + putpixel(x,y,YELLOW); + flood(x+1,y); + flood(x-1,y); + flood(x,y+1); + flood(x,y-1); + } + delay(10); } int main() { + //w for width of circle and width is 10 + int w=10; cout<<"Hello World! "; + // cout<<"Enter Width of Circle\n"; + // scanf("%d",&w); initwindow(my_SIZE[0], my_SIZE[1], "Graphics Window"); draw_x_axis(); draw_y_axis(); + // int gd,gm; + // detectgraph(&gd,&gm); + // initgraph(&gd,&gm,"c:\\tc\\bgi"); my_circle(60, 80, 50); + my_circle(60, 80, 50+w); + flood(60+80+5,80); while(!kbhit()) delay(100); return 0; diff --git a/README.md b/README.md index 3a8e01f..0991234 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,9 @@ # Computer Graphics Lab This repositry contains work done in Computer Graphics Lab. + +## Contributer(s) + +[Kartikei Mittal](https://github.com/Kartikei-12) + +[Tokir Manva](https://github.com/tokirmanva22)