100% found this document useful (1 vote)
59 views3 pages

20BCA1290 Computer Graphics Worsheet1.2

The document provides instructions for a computer graphics practical to scan convert a circle with a center of (130, 240) and radius of 110 using the midpoint circle algorithm. It lists the aim, task, concept, and steps used which include initializing graphics mode, getting user input for center and radius, and implementing a do-while loop to calculate and plot pixels using the midpoint algorithm formulas. The student is to run the code and observe the output of the drawn circle.

Uploaded by

Neeraj Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
59 views3 pages

20BCA1290 Computer Graphics Worsheet1.2

The document provides instructions for a computer graphics practical to scan convert a circle with a center of (130, 240) and radius of 110 using the midpoint circle algorithm. It lists the aim, task, concept, and steps used which include initializing graphics mode, getting user input for center and radius, and implementing a do-while loop to calculate and plot pixels using the midpoint algorithm formulas. The student is to run the code and observe the output of the drawn circle.

Uploaded by

Neeraj Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

INSTRUCTIONS

Student Name: Davansh Choudhary UID: 20BCA1290


Branch: BCA Section/Group 20BCA3/b
Semester: 5th Date of Performance:2/9/22
Subject Name computer graphics Subject Code:20CAP-316

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.

You might also like