Mid-Point circle generation algorithm aims to find out the points that lie on the circle (or approximately lie on the circle) in a pixel based display. This Algorithm is similar to Bresenhams Circle Generation Algorithm, According to wikipedia bresenhams algorithm is derived from mid-point circle generation algorithm.
In this algorithm we divide the circle into 8 parts and calculate the points only for one part and then apply the property of symmetry to get the points in the remaining 7 parts.
We divide the circle into the following parts.
At the beginning we start with the point x = 0, y = r ;
so we get the first point as (xc + x, yc + y) which lies on the circle. let us denote this point as (xp, yp).
now we have check if the neighbouring point (xp - 1, yp + 1) or (xp, yp + 1) lies on the circle, We do this by checking the value of the variable called parameter which checks if the point lies on the circle or not and accordingly we update the value of x and y to plot the next point.
Algorithm
You might also be interested in
DDA Line Generation Algorithm
Bresenhams Circle Generation Algorithm
Infix to Prefix Conversion
Infix to Postfix Conversion
Bubble Sort
Insertion Sort
Selection sort
Shell Sort
In this algorithm we divide the circle into 8 parts and calculate the points only for one part and then apply the property of symmetry to get the points in the remaining 7 parts.
We divide the circle into the following parts.
At the beginning we start with the point x = 0, y = r ;
so we get the first point as (xc + x, yc + y) which lies on the circle. let us denote this point as (xp, yp).
now we have check if the neighbouring point (xp - 1, yp + 1) or (xp, yp + 1) lies on the circle, We do this by checking the value of the variable called parameter which checks if the point lies on the circle or not and accordingly we update the value of x and y to plot the next point.
Algorithm
- Plot the initial point with x = 0, y = r and initialize parameter = 1 - radius
- While x < y keep repeating steps 3, 4 and 5
- If value of parameter is less than 0 then the point is inside the circle so increase the value of parameter = parameter + 2*x + 3 and x by 1.
- else the point is on or outside the circle hence increase the value of parameter = parameter + 2*(x - y) + 5 ; x by 1 and y by 1.
- Plot the new point.
C Program
You might also be interested in
DDA Line Generation Algorithm
Bresenhams Circle Generation Algorithm
Infix to Prefix Conversion
Infix to Postfix Conversion
Bubble Sort
Insertion Sort
Selection sort
Shell Sort
Comments
Post a Comment