0% found this document useful (0 votes)
12 views4 pages

I014 - CG-Lab 3

Uploaded by

jashkathiria98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

I014 - CG-Lab 3

Uploaded by

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

SVKM’s NMIMS University

Mukesh Patel School of Technology Management & Engineering

PROGRAM: BTech IT/MBATECH SEMESTER V

COURSE: Computer Graphics Practical Experiment: 3

Part A (To be referred by students)

SAVE THE FILE AND UPLOAD AS (RollNo_Name_Exp1)

Topic covered: Circle Drawing Algorithm (DDA:- Digital Differential Analyzer) and
Bresenham Line Drawing Algorithm.

Learning Objective: Learner would be able to


1. To understand the different algorithm for drawing a circle.
2. Bresenham's and the Mid-Point Circle Drawing algorithm, are designed to determine the points
needed for rasterizing a circle on a grid (like a computer screen or a graph paper) where only discrete
points are available.

Prerequisites:-
- Python and c

Outcomes:-
- Student will explore the method to draw line with x and y coordinates for drawing a circle.

1|P a g e
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering

PROGRAM: BTech IT/MBATECH SEMESTER VI

COURSE: Computer Graphics Practical Experiment:3

Student Name Jash Bharat Kathiria Student Sap ID:- 70412100135


Student Roll Number I014 Date of Conduction :03/ 01 / 2024
Class :- MBA.Tech IT/B.Tech IT VI sem

Aim:- To learn the algorithm to draw a mid point and Bresenham circle Drawing Algorithm with
given x and y coordinates.

Assignment 2
1. Draw a circle with Mid point algorithm with X,Y(0,0) and Radius =10 and display the
coordinates and place a circle.

2
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering

PROGRAM: BTech IT/MBATECH SEMESTER VI

COURSE: Computer Graphics Practical Experiment:3

2. Draw a circle with Bresenham algorithm with X,Y(0,0) and Radius =10 and display the
coordinates and place a circle.
import matplotlib.pyplot as plt
def bresenham_circle(x0, y0, radius):
x = radius
y=0
err = 0
points = []
while x >= y:
points.append((x0 + x, y0 + y))
points.append((x0 + y, y0 + x))
points.append((x0 - y, y0 + x))
points.append((x0 - x, y0 + y))
points.append((x0 - x, y0 - y))
points.append((x0 - y, y0 - x))
points.append((x0 + y, y0 - x))
points.append((x0 + x, y0 - y))
y += 1
err += 1 + 2*y
if 2*(err-x) + 1 > 0:
x -= 1
err += 1 - 2*x
return points
points = bresenham_circle(0, 0, 10)
# plot the points
plt.scatter([x for x, y in points], [y for x, y in points])
# draw the circle
circle = plt.Circle((50, 50), 30, fill=False)
plt.gcf().gca().add_artist(circle)
plt.show()

3
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering

PROGRAM: BTech IT/MBATECH SEMESTER VI

COURSE: Computer Graphics Practical Experiment:3

3. Find out the difference in both the algorithms and justify which one is better algorithm for
circle drawing algorithm.
Comparison:

Both algorithms are highly efficient and accurate for drawing circles, and the differences between
them are subtle.
The Midpoint Circle Algorithm generally requires fewer arithmetic operations per pixel compared to
Bresenham's algorithm, making it slightly more efficient in terms of computation.
The differences in performance are usually minimal, and the choice between the two often depends
on factors such as ease of implementation and specific requirements of the application.

Conclusion:-

In practice, the choice between the Midpoint Circle Algorithm and Bresenham's Circle Algorithm may not
significantly impact performance in modern computing environments.
Both algorithms are widely used and have stood the test of time, demonstrating their reliability and efficiency.
The choice between them may come down to personal preference, ease of understanding, or specific requirements of
the application or platform.
Ultimately, both algorithms are excellent choices for drawing circles, and the "better" algorithm depends on the
specific context and requirements of the application.

You might also like