CG unit 2 part2
CG unit 2 part2
In this article, we will discuss about Mid Point Circle Drawing Algorithm.
The points for other octacts are generated using the eight symmetry property.
Procedure-
Given-
Centre point of Circle = (X0, Y0)
Radius of Circle = R
The points generation using Mid Point Circle Drawing Algorithm involves the following steps-
Step-01:
Step-02:
Step-03:
Suppose the current point is (Xk, Yk) and the next point is (Xk+1, Yk+1).
Find the next point of the first octant depending on the value of decision parameter P k.
Follow the below two cases-
Step-04:
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
Step-05:
Step-06:
Problem-01:
Given the centre point coordinates (0, 0) and radius as 10, generate all the points to form a circle.
Solution-
Given-
Centre Coordinates of Circle (X0, Y0) = (0, 0)
Radius of Circle = 10
Step-01:
Step-02:
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
These are all points for Octant-1.
(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-
Quadrant-3 (-X,-
Quadrant-1 (X,Y) Quadrant-2 (-X,Y) Quadrant-4 (X,-Y)
Y)
Problem-02:
Given the centre point coordinates (4, -4) and radius as 10, generate all the points to form a circle.
Solution-
Given-
Centre Coordinates of Circle (X0, Y0) = (4, -4)
Radius of Circle = 10
(9, 5) (13, 9)
(9, 4) (13, 8)
(10, 3) (14, 7)
(10, 2) (14, 6)
(10, 1) (14, 5)
(10, 0) (14, 4)
The following table shows the points for all the quadrants-
Quadrant-3 (-X,-
Quadrant-1 (X,Y) Quadrant-2 (-X,Y) Quadrant-4 (X,-Y)
Y)
Important Points
Circle drawing algorithms take the advantage of 8 symmetry property of circle.
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.
The points for other octacts are generated using the eight symmetry property.
Procedure-
Given-
Centre point of Circle = (X0, Y0)
Radius of Circle = R
The points generation using Bresenham Circle Drawing Algorithm involves the following steps-
Step-01:
Step-02:
Step-03:
Suppose the current point is (Xk, Yk) and the next point is (Xk+1, Yk+1).
Find the next point of the first octant depending on the value of decision parameter P k.
Follow the below two cases-
Step-04:
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
Step-05:
Step-06:
Given the centre point coordinates (0, 0) and radius as 8, generate all the points to form a circle.
Solution-
Given-
Centre Coordinates of Circle (X0, Y0) = (0, 0)
Radius of Circle = 8
Step-01:
Step-02:
Step-03:
Thus,
Xk+1 = Xk + 1 = 0 + 1 = 1
Yk+1 = Yk = 8
Pk+1 = Pk + 4 x Xk+1 + 6 = -13 + (4 x 1) + 6 = -3
Step-04:
This step is not applicable here as the given centre point coordinates is (0, 0).
Step-05:
(0, 8)
-13 -3 (1, 8)
-3 11 (2, 8)
11 5 (3, 7)
5 7 (4, 6)
7 (5, 5)
Algorithm Terminates
These are all points for Octant-1.
(1, 8) (6, 4)
(2, 8) (7, 3)
(3, 7) (8, 2)
(4, 6) (8, 1)
(5, 5) (8, 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-
Quadrant-3 (-X,-
Quadrant-1 (X,Y) Quadrant-2 (-X,Y) Quadrant-4 (X,-Y)
Y)
Problem-02:
Given the centre point coordinates (10, 10) and radius as 10, generate all the points to form a
circle.
Solution-
Given-
Centre Coordinates of Circle (X0, Y0) = (10, 10)
Radius of Circle = 10
Step-01:
Step-02:
Calculate the value of initial decision parameter P0 as-
P0 = 3 – 2 x R
P0 = 3 – 2 x 10
P0 = -17
Step-03:
Thus,
Xk+1 = Xk + 1 = 0 + 1 = 1
Yk+1 = Yk = 10
Pk+1 = Pk + 4 x Xk+1 + 6 = -17 + (4 x 1) + 6 = -7
Step-04:
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
Step-05:
Step-03 and Step-04 are executed similarly until Xplot => Yplot as follows-
Algorithm Terminates
These are all points for Octant-1.
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-
Quadrant-3 (-X,-
Quadrant-1 (X,Y) Quadrant-2 (-X,Y) Quadrant-4 (X,-Y)
Y)