Exp 1.4 - Computer Graphics - Aryan - Chherti

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Experiment -4

Student Name: Aryan Chhetri UID: 20BCA1132


Branch: UIC Section/Group: BCA5/A
Semester: 5TH Sem Date of Performance:5.09.2022
Subject Name: Computer Graphics Lab Subject Code: 20CAP316

1. Aim/Overview of the practical: Scan Convert a ellipse with centre (100, 50) and and major axis=50 , minor
axis=30 using Midpoint Ellipse Algorithm

2. Syntax/Format used:

Code:
#include<iostream>
using namespace std;

void midPointCircleDraw(int x_centre, int y_centre, int r)


{
int x = r, y = 0;

cout << "(" << x + x_centre << ", " << y + y_centre << ") ";

if (r > 0)
{
cout << "(" << x + x_centre << ", " << -y + y_centre << ")
"; cout << "(" << y + x_centre << ", " << x + y_centre << ")
"; cout << "(" << -y + x_centre << ", " << x + y_centre <<
")\n";
}

int P = 1 - r;
while (x > y)
{
y++;

if (P <= 0)
P = P + 2*y + 1;

{
x--;
P = P + 2*y - 2*x + 1;
}

if (x <
y)
break;

cout << "(" << x + x_centre << ", " << y + y_centre << ") ";
cout << "(" << -x + x_centre << ", " << y + y_centre << ") ";
cout << "(" << x + x_centre << ", " << -y + y_centre << ") ";
cout << "(" << -x + x_centre << ", " << -y + y_centre << ")\
n";

if (x != y)
{
cout << "(" << y + x_centre << ", " << x + y_centre << ") ";
cout << "(" << -y + x_centre << ", " << x + y_centre << ") ";
cout << "(" << y + x_centre << ", " << -x + y_centre << ") ";
cout << "(" << -y + x_centre << ", " << -x + y_centre << ")\
n";
}
}
}

int main()
{
midPointCircleDraw(100,200,100);
return 0;
}

3. Steps for experiment/practical:


4. Result/Output/Writing Summary:
Learning outcomes (What I have learnt):

1. Converting a circle with center

2.

2. Different functions in c language

Evaluation Grid:

Sr. No. Parameters Marks Obtained Maximum Marks


1. Demonstration/Performance/Pre 5
Lab Quiz
2. Worksheet 10
3. Post Lab Quiz 5

You might also like