Circle Drawing Algorithms
Circle Drawing Algorithms
Problem 1
Given the centre point coordinates (0, 0) and radius as 8, generate all the points to form a circle.
Solution 1
Given,
Radius of Circle = 8
X0 = 0
Y0 = r = 8
PK = 3 – 2 x r = 3 - 2(8) = -13
Here, PK < 0
Pk Pk+1 (Xk+1, Yk+1)
(0, 8)
-3 -3 + (4 x 2) + 6 = 11 (2, 8)
11 11 + 4 (3 -7) + 10 = 5 (3, 7)
5 5 + 4 (4 - 6) + 10 = 7 (4, 6)
7 (5, 5)
Algorithm Terminates
Now, the points of octant-2 are obtained using the mirror effect by swapping X and Y coordinates.
(0, 8) (5, 5)
(1, 8) (6, 4)
(2, 8) (7, 3)
(3, 7) (8, 2)
(4, 6) (8, 1)
(5, 5) (8, 0)
Problem 2
Given the centre point coordinates (2, 2) and radius as 8, generate all the points to form a circle.
Solution 2
Given,
Radius of Circle = 8
X0 = 0
Y0 = r = 8
PK = 3 – 2 x r = 3 - 2(8) = -13
Here, PK < 0
Pk Pk+1 (Xk+1, Yk+1) (Xplot, Yplot)
5 5 + 4 (4 - 6) + 10 = 7 (4, 6) (6, 8)
7 (5, 5) (7, 7)
Algorithm Terminates
Now, the points of octant-2 are obtained using the mirror effect by swapping X and Y coordinates.
(5, 9) (10, 4)
(6, 8) (10, 3)
(7, 7) (10, 2)
(2, 10) (7, 7) (-2, 10) (7, -7) (-2, -10) (-7, -7) (2, -10) (-7, 7)
(3, 10) (8, 6) (-3, 10) (8, -6) (-3, -10) (-8, -6) (3, -10) (-8, 6)
(4, 10) (9, 5) (-4, 10) (9, -5) (-4, -10) (-9, -5) (4, -10) (-9, 5)
(5, 9) (10, 4) (-5, 9) (10, -4) (-5, -9) (-10, -4) (5, -9) (-10, 4)
(6, 8) (10, 3) (-6, 8) (10, -3) (-6, -8) (-10, -3) (6, -8) (-10, 3)
(7, 7) (10, 2) (-7, 7) (10, -2) (-7, -7) (-10, -2) (7, -7) (-10, 2)
Step 4: If the given centre point (X0, Y0) is not (0, 0), then do the following and plot the point-
Xplot = Xc + X0
Yplot = Yc + Y0
Here, (Xc, Yc) denotes the current value of X and Y coordinates.
Step 5: Keep repeating Step-03 and Step-04 until Xplot => Yplot.
Step 6: Step 05 generates all the points for one octant. To find the points for other seven octants,
follow the eight-symmetry property of circle. This is depicted by the following figure-
Problem 3
Given the center point coordinates (0, 0) and radius as 10, generate all the points to form a circle.
Solution 3
Given,
Radius of Circle = 10
X0 = 0
Y0 = r = 10
PK = 1 - r = 1 - 10 = -9
Here, PK < 0
Pk Pk+1 (Xk+1, Yk+1)
(0, 10)
-3 -3 + 2(5) + 1 = 8 (5, 9)
5 (7, 7)
Algorithm Terminates
Now, the points of octant-2 are obtained using the mirror effect by swapping X and Y coordinates.
(4, 9) (10, 3)
(5, 9) (10, 2)
(6, 8) (10, 1)
(7, 7) (10, 0)
(0, 10) (7, 7) (0, 10) (7, -7) (0, -10) (-7, -7) (0, -10) (-7, 7)
(1, 10) (8, 6) (-1, 10) (8, -6) (-1, -10) (-8, -6) (1, -10) (-8, 6)
(2, 10) (9, 5) (-2, 10) (9, -5) (-2, -10) (-9, -5) (2, -10) (-9, 5)
(3, 10) (9, 4) (-3, 10) (9, -4) (-3, -10) (-9, -4) (3, -10) (-9, 4)
(4, 9) (10, 3) (-4, 9) (10, -3) (-4, -9) (-10, -3) (4, -9) (-10, 3)
(5, 9) (10, 2) (-5, 9) (10, -2) (-5, -9) (-10, -2) (5, -9) (-10, 2)
(6, 8) (10, 1) (-6, 8) (10, -1) (-6, -8) (-10, -1) (6, -8) (-10, 1)
(7, 7) (10, 0) (-7, 7) (10, 0) (-7, -7) (-10, 0) (7, -7) (-10, 0)
Problem 4
Given the starting point coordinates (4, -4) and radius as 10, generate all the points to form a circle.
Solution 4
Given,
Radius of Circle = 10
X0 = 0
Y0 = r = 10
PK = 1 - r = 1 - 10 = -9
Here, PK < 0
Pk Pk+1 (Xk+1, Yk+1) (Xplot, Yplot)
5 (7, 7) (11, 3)
Algorithm Terminates
Now, the points of octant-2 are obtained using the mirror effect by swapping X and Y coordinates.
(6, 6) (5, 9)
(7, 6) (5, 8)
(8, 5) (6, 7)
(9, 5) (6, 6)
(10, 4) (6, 5)
(11, 3) (6, 4)
(4, 6) (3, 11) (-4, 6) (3, -11) (-4, -6) (-3, -11) (4, -6) (-3, 11)
(5, 6) (4, 10) (-5, 6) (4, -10) (-5, -6) (-4, -10) (5, -6) (-4, 10)
(6, 6) (5, 9) (-6, 6) (5, -9) (-6, -6) (-5, -9) (6, -6) (-5, 9)
(7, 6) (5, 8) (-7, 6) (5, -8) (-7, -6) (-5, -8) (7, -6) (-5, 8)
(8, 5) (6, 7) (-8, 5) (6, -7) (-8, -5) (-6, -7) (8, -5) (-6, 7)
(9, 5) (6, 6) (-9, 5) (6, -6) (-9, -5) (-6, -6) (9, -5) (-6, 6)
(10, 4) (6, 5) (-10, 4) (6, -5) (-10, -4) (-6, -5) (10, -4) (-6, 5)
(11, 3) (6, 4) (-11, 3) (6, -4) (-11, -3) (-6, -4) (11, -3) (-6, 4)