Examples Bresenham Circle Drawing Algorithm
Ex1//By using Bresenham Circle Algorithm given the center point coordinates (0, 0) and radius as 8, generate all the points to form a circle.
Solution:
o Given:
Centre Coordinates of Circle: (X0, Y0) = (0, 0)
Radius of Circle = 8
STEP – 01:
o Assign the starting point coordinates (X0, Y0) as:
X0 = 0
Y0 = R = 8
STEP – 02:
o Calculate the value of initial decision parameter P0 as:
P0 = 3 – 2×R = 3 – 2×8 = -13
STEP – 03:
o As Pinitial < 0, so case-01 is satisfied. Thus,
Xk+1 = Xk + 1 = 0 + 1 = 1
Yk+1 = Yk = 8
Pk+1 = Pk + 4×Xk+1 + 6 = -13 + (4×1) + 6 = -3
STEP – 04:
o This step is not applicable here as the given centre point coordinates is (0, 0).
STEP – 05:
o Step-03 is executed similarly until Xk+1 >= Yk+1 as follows:
Ex2//By using Mid Point Circle Algorithm given the center point
coordinates (10, 10) and radius as 10, generate all the points to form a
circle.
Solution:
o Given:
Centre Coordinates of Circle: (X0, Y0) = (10, 10)
Radius of Circle = 10
STEP – 01:
o Assign the starting point coordinates (X0, Y0) as:
X0 = 0
Y0 = R = 10
STEP – 02:
o Calculate the value of initial decision parameter P0 as:
P0 = 3 – 2×R = 3-2×10 = -17
STEP – 03:
o As Pinitial < 0, so case-01 is satisfied. Thus,
Xk+1 = Xk + 1 = 0 + 1 = 1
Yk+1 = Yk = 10
Pk+1 = Pk + 4×Xk+1 + 6 = -17+ (4×1) + 6 = -7
STEP – 04:
o This step is applicable here as the given centre point coordinates is
(10, 10).
Xplot = Xc + X0 = 1 + 10 = 11
Yplot = Yc + Y0 = 10 + 10 = 20