Bresenham Circle
Bresenham Circle
It is not easy to display a continuous smooth arc on the computer screen as our computer
screen is made of pixels organized in matrix form. So, to draw a circle on a computer
screen we should always choose the nearest pixels from a printed pixel so as they could
form an arc. There are two algorithm to do this:
1. Mid-Point circle drawing algorithm
2. Bresenham’s circle drawing algorithm
We have already discussed the Mid-Point circle drawing algorithm in our previous post.In
this post we will discuss about the Bresenham’s circle drawing algorithm.
Both of these algorithms uses the key feature of circle that it is highly symmetric. So, for
whole 360 degree of circle we will divide it in 8-parts each octant of 45 degree. In order to
do that we will use Bresenham’s Circle Algorithm for calculation of the locations of the
pixels in the first octant of 45 degrees. It assumes that the circle is centered on the origin.
So for every pixel (x, y) it calculates, we draw a pixel in each of the 8 octants of the circle
as shown below :
Now, we will see how to calculate the next pixel location from a previously known pixel
location (x, y). In Bresenham’s algorithm at any point (x, y) we have two option either to
choose the next pixel in the east i.e. (x+1, y) or in the south east i.e. (x+1, y-1)
And this can be decided by using the decision parameter d as:
If d > 0, then (x+1, y-1) is to be chosen as the next pixel as it will be closer to the arc.
else (x+1, y) is to be chosen as next pixel.
Now to draw the circle for a given radius ‘r’ and centre (xc, yc) We will start from (0, r)
and move in first quadrant till x=y (i.e. 45 degree). We should start from listed initial
condition:
d = 3 - (2 * r)
x=0
y=r
Now for each pixel, we will do the following operations:
1. Set initial values of (xc, yc) and (x, y)
2. Set decision parameter d to d = 3 – (2 * r).
Advantages
It is a simple algorithm.
It can be implemented easily
It is totally based on the equation of circle i.e. x 2 +y2 =r2
Disadvantages
There is a problem of accuracy while generating points.
This algorithm is not suitable for complex and high graphic images.