Practice Problems Based On Mid Point Circle Drawing Algorithm
Practice Problems Based On Mid Point Circle Drawing Algorithm
Problem-01:
Given the centre point coordinates (0, 0) and radius as 10, generate all the points to form a circle.
Solution-
Given-
Radius of Circle = 10
Step-01:
X0 = 0
Y0 = R = 10
Step-02:
P0 = 1 – R
P0 = 1 – 10
P0 = -9
Step-03:
Thus,
Xk+1 = Xk + 1 = 0 + 1 = 1
Yk+1 = Yk = 10
Pk+1 = Pk + 2 x Xk+1 + 1 = -9 + (2 x 1) + 1 = -6
Step-04:
This step is not applicable here as the given centre point coordinates is (0, 0).
Step-05:
(0, 10)
-9 -6 (1, 10)
-6 -1 (2, 10)
-1 6 (3, 10)
6 -3 (4, 9)
-3 8 (5, 9)
8 5 (6, 8)
Algorithm Terminates
Now, the points of octant-2 are obtained using the mirror effect by swapping X and Y coordinates.
Octant-1 Points Octant-2 Points
(4, 9) (10, 2)
(5, 9) (10, 1)
(6, 8) (10, 0)
Now, the points for rest of the part are generated by following the signs of other quadrants.
The other points can also be generated by calculating each octant separately.
Here, all the points have been generated with respect to quadrant-1-
Problem-02:
Given the centre point coordinates (4, -4) and radius as 10, generate all the points to form a circle.
Solution-
Given-
Radius of Circle = 10
We first calculate the points assuming the centre coordinates is (0, 0).
Now, we find the values of Xplot and Yplot using the formula given in Step-04 of the main algorithm.
Xplot = Xc + X0 = 4 + X0
Yplot = Yc + Y0 = 4 + Y0
(9, 5) (13, 9)
(9, 4) (13, 8)
(10, 3) (14, 7)
(10, 2) (14, 6)
(10, 1) (14, 5)
(10, 0) (14, 4)
These are all points for Quadrant-1.
The following table shows the points for all the quadrants-
Important Points
Every circle has 8 octants and the circle drawing algorithm generates all the points for one octant.
The points for other 7 octants are generated by changing the sign towards X and Y coordinates.
To take the advantage of 8 symmetry property, the circle must be formed assuming that the centre
point coordinates is (0, 0).
If the centre coordinates are other than (0, 0), then we add the X and Y coordinate values with each
point of circle with the coordinate values generated by assuming (0, 0) as centre point.