You are on page 1of 3

5.7.3.

Bresenham's
Circle Drawing Algorithm Y
Bresenham's method of drawing the circle is n
efficient method because it avoids trigonometricand
square root calculation by adopting only integer
operation involving squares of the pixel separation
distances.
The Bresenham's circle drawing algorithm 900
considers the eight way symmetry of the circle. It 450
plots 1/8th part of the circle from 900 to 450. As
circle is drawn from 900 to 450,the x-movesin + ve
direction and y movesin the —ve direction.
To achieve best approximation to the truecircle Fig. 5.17.
we have to select those pixels in the raster that
falls the least distance from the true circle,Let us
observe the 900 to 450 portion of the circle, each
new point closestto the true circlecan be found by applying
either of two options :
Yn
(a) Increment in positive x direction by .one unit or
(b) Increment in positive x direction and negative y direc- (xn+lbl)
tion both by one unit.
If Pn is a current point with co-ordinates(xn,yn) then the
next point could be either A or B.
Fig. 5.18.
We have to select A or B, depending on which is close to the
circle, and for that we have to perform some test.
The closer pixel amongst these two can be determined as follows.
The distances of pixels A and B from the origin (0, 0) are given by
O Scan Conversion O 1011
CIA= 2
x,t+l + .Yn

dB 2 2
and n+l
Now,the distances of pixels A and B from the true circle whose radius r are given as
öA= CIA r and = dB r
To avoid square root in derivation of decision variable, we use
6 = d 2 —r2 and 6B = d} —r2
But 6A is always positive and 6B is always negative. Therefore we can define decision
variable di as
di =öA+ö
If di < 0 i.e., ö < ö then only x is incremented.
Otherwise x is incremented in positive direction and y is incremented in negative direction
i.e.,
For di < 0
x.
else x.
Yi+l = Yi—l
The equation for di at starting point i.e., x = 0 and y = r is as follows
i- A xn+l xn+l Yn-l -P
= (O+ + r2_ r2+ (0 + + (r _ _ r2

As stated earlier, if d. < 0 then it impliesA is closerto the true circle,hence increment
only x value.
i.e., If di < 0 then Xi+ 1
else x.
=Yi-l
So, recompute the new decision value, by substituting new value of Xiwe get
di+l = di + 4Xi+ 6 if di < 0
= di + 4 (Xi—"i) + 10 if di 2 0
Algorithm for Bresenham's circle drawing
1. Read the radius r of the circle.
2. Initialize the decision variable
d = 3-2* r
3.

4. If we are using octant symmetry to plot the pixels then until (x < y) we have to
perform following steps.
if (d < 0) then

•else
1402 O ComputerGraphics O
d d + 4(x y) + 10

5. Plot (x, y)
also.
6. Determine the symmetry points in other octants
7. Stop.
EXAMPLE. 5.7.
is 3 and center is (O,O).
Plot a circle by Bresenham•salgorithm whose radius
Solution:
4

Here 3

2
Plot first point (x, y) i.e.,
Now d = j—3 (< 0) then
(0,0) I 2 3 4
Fig. 5.19.

Plot (1, 3).


Now 3(> 0) then
d+ —y)+ 10
= 3 + 4 (l 3) + 10
= 3-8+10=5 a
-x +1=1 +1=2 b

Plot (2, 2) Fig. 5.20.


After plotting these points, we will get the
circle.

You might also like