20BCA1290 Computer Graphics Worsheet1.2
20BCA1290 Computer Graphics Worsheet1.2
1. Aim/Overview of the practical: Scan Convert a circle with centre (130, 240) and
radius 110 using mid-point circle algorithm.
2. Task to be done: Scan Convert a circle with centre (130, 240) and radius 110 using mid-
point circle algorithm.
3. Concept used: mid -point circle algorithm
4. Steps/Commands involved to perform practical: #include<graphics.h>
5. #include<conio.h>
6. #include<stdio.h>
7. void main()
8. {
9. int x,y,x_mid,y_mid,radius,dp;
10.int g_mode,g_driver=DETECT;
11.clrscr();
12.initgraph(&g_driver,&g_mode,"C:\\TURBOC3\\BGI");
13.printf("*********** MID POINT Circle drawing algorithm ********\
n\n");
14.printf("\nenter the coordinates= ");
15.scanf("%d %d",&x_mid,&y_mid);
16.printf("\n now enter the radius =");
17.scanf("%d",&radius);
18.x=0;
19.y=radius;
20.dp=1-radius;
21.do
22.{
23.
putpixel(x_mid+x,y_mid+y,YELLOW);
24.putpixel(x_mid+y,y_mid+x,YELLOW);
25.putpixel(x_mid-y,y_mid+x,YELLOW);
26.putpixel(x_mid-x,y_mid+y,YELLOW);
27.putpixel(x_mid-x,y_mid-y,YELLOW);
28.putpixel(x_mid-y,y_mid-x,YELLOW);
29.putpixel(x_mid+y,y_mid-x,YELLOW);
30.putpixel(x_mid+x,y_mid-y,YELLOW);
31.if(dp<0) {
32.dp+=(2*x)+1;
33.}
34.else{
35.y=y-1;
36.dp+=(2*x)-(2*y)+1;
37.}
38.x=x+1;
39.}while(y>x);
40.getch();
41.}
42.Result/Output/Writing Summary:
Learning outcomes (What I have learnt):
1.
2.
3.