Bresenham’s Circle Drawing Algorithm
The Bresenham’s Circle Drawing Algorithm is used in computer graphics to draw a circle efficiently using only integer arithmetic.
It avoids floating-point calculations, making it faster and suitable for raster displays.
The algorithm determines the nearest pixel position to form a circle using a decision parameter.
Basic Idea of Circle Drawing
A circle with center (xc, yc) and radius r is represented by:
x2 + y2 = r2
Instead of calculating all points using trigonometric equations, Bresenham’s algorithm:
- Starts from the top point (0, r)
- Moves step-by-step in the first octant
- Uses symmetry to generate the remaining points
Why Only One Octant?
A circle is symmetric in 8 octants.
If we calculate one point (x, y) the remaining seven points are:
(x,y) (y,x) (−x,y) (−y,x) (−x,−y) (−y,−x) (x,−y) (y,−x)
Thus, computation becomes much faster.
Steps of Bresenham’s Circle Algorithm
Step 1: Initialize
x = 0 and y = r
Decision parameter:
p0 = 3 − 2r
Step 2: Check Decision Parameter
Case 1: If pk < 0
Choose East pixel (E)
xk+1 = xk + 1, and
yk+1 = yk
pk+1 = pk + 4xk + 6
Case 2: If pk ≥ 0
Choose South-East pixel (SE)
xk+1 = xk + 1
yk+1 = yk − 1
pk+1 = pk + 4(xk − yk) + 10
Step 3: Stop Condition
Repeat until: x ≥ y
Numerical Example
Draw a Circle with:
- Center = (0, 0)
- Radius = 8
Initial Values
x0 = 0 and y0 = 8
Decision parameter:
p0 = 3 − 2r
p0 = 3 − 2(8)
p0 = 3 − 16
p0 = −13
Iteration Table
| Step | xk | yk | pk | Decision | Next Point |
|---|---|---|---|---|---|
| 0 | 0 | 8 | -13 | p < 0 | (1, 8) |
| 1 | 1 | 8 | -7 | p < 0 | (2, 8) |
| 2 | 2 | 8 | 3 | p ≥ 0 | (3, 7) |
| 3 | 3 | 7 | -11 | p < 0 | (4, 7) |
| 4 | 4 | 7 | 7 | p ≥ 0 | (5, 6) |
| 5 | 5 | 6 | 13 | p ≥ 0 | (6, 5) |
Stop here because: x ≥ y
Detailed Calculations
Iteration 0
Current point: (0, 8) and p0= −13
Since: p0 < 0, Choose Case I.
Next point:
xk+1 = 0 + 1 = 1
yk+1 = 8
pk+1 = pk + 4 x 0 + 6
pk+1 = −13 + 4(0) + 6
p1k+1 = −7
Iteration 1
Current point: (1, 8) and p1 = −7
Again: p1 < 0 , Choose Case I.
Next point:
xk+1 = 1 + 1 = 2
yk+1 = 8
pk+1 = −7 + 4(1) + 6
pk+1 = 3
Iteration 2
Current point: (2, 8) and p2 = 3
Since, p2 ≥ 0 Choose Case II.
Next point:
xk+1 = 2 + 1 = 3
yk+1 = 8 - 1 = 7
pk+1 = pk + 4(xk − yk) + 10
pk+1 = 3 + 4(2 − 8) + 10
pk+1 = 3 − 24 + 10
pk+1 = −11
(Some books may show slightly different values depending on the variant used.)
Plotting Symmetric Points
For point: (3,7)
The 8 symmetric points are:
(3,7) (7,3) (−3,7) (−7,3) (−3,−7) (−7,−3) (3,−7) (7,−3)
Advantages of Bresenham Circle Algorithm
- Uses only integer arithmetic
- Faster than direct circle equation
- Efficient for raster graphics
- Avoids floating-point calculations
- Produces smooth circles
Disadvantages of Bresenham Circle Algorithm
- Limited to raster displays
- Slight approximation error may occur
- Complex for beginners compared to DDA
Pseudocode
Input radius r and center (xc, yc)
x = 0
y = r
p = 3 - 2r
while (x <= y)
plot 8 symmetric points
if p < 0
p = p + 4x + 6
else
p = p + 4(x - y) + 10
y = y - 1
x = x + 1Conclusion
The Bresenham Circle Drawing Algorithm is one of the most important algorithms in computer graphics because it efficiently draws circles using integer calculations and symmetry. It is widely used in raster graphics systems for fast rendering of circles and curved shapes.