Numerical of Bresenham’s Circle Algorithm
Bresenham’s Circle Algorithm
Draw a circle using BCA having radius as 10 and center of circle (100,100).
S-1; Enter the center h=100, k=100 and radius r=10.
S-2: Find d=3-2*(10)= -17 and take x = 0 , y = 10 ;
S-3: If (d>=0) then x = x +1 and y = y -1 ; d = d + 4*(x-y) + 10;
S-4: if (d <0) then x =x +1 and d = d +4*x + 6;
Where to stop : x or y = 10/sqrt(2) which is 10/1.414= approx = 7. So either x or y reaches 7, the algorithm will stop.
Bresenham’s Circle Algorithm (r=10,h,k=100) | ||||
Step Number | X | Y | d | Pixel |
1 | 0 | 10 | -17 | (x +h ,y +k) = 100,110 |
2 | 1 | 10 | -7 | 101,110 |
3 | 2 | 10 | 7 | 102,110 |
4 | 3 | 9 | -7 | 103,109 |
5 | 4 | 8 | 15 | 104,108 |
6 | 5 | 7 | Time to STOP Algo. | 105,107 |
Rest of the points will be plotted using 8-Way Symmetry.