CG-Practical 03 (Midpoint Circle Algorithm) 1
CG-Practical 03 (Midpoint Circle Algorithm) 1
: 03
AIM:
INTRODUCTION:
Drawing a circle on the screen is a little complex than drawing a line. There are
two popular algorithms for generating a circle − Bresenham’s Algorithm and
Midpoint Circle Algorithm. These algorithms are based on the idea of
determining the subsequent points required to draw the circle.
THEORY:
We use the Midpoint Circle algorithm to calculate all the perimeter points of
the circle in the first octant and then print them along with their mirror points
in the other octants. This will work only because a circle is symmetric about it’s
center. For any given pixel (x, y), the next pixel to be plotted is either (x, y+1) or
(x-1, y+1). This can be decided by following the steps below.
1. Find the mid-point p of the two possible pixels i.e (x-0.5, y+1)
2. If p lies inside or on the circle perimeter, we plot the pixel (x, y+1), otherwise
if it’s outside we plot the pixel (x-1, y+1)