0% found this document useful (0 votes)
82 views

Midpoint Circle Algorithm-Cg

The document describes the midpoint circle algorithm for generating points along the circumference of a circle. It takes the radius and center point as input and calculates an initial point and decision parameter. It then uses the decision parameter in a test at each x-value to determine if the next point is above or below the x-axis and updates the decision parameter accordingly. It determines points in the other octants by symmetry and shifts the generated points to be centered on the given center point before plotting. As an example, it gives generating points in the first octant of a circle with radius 10 from x=0 to x=y.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

Midpoint Circle Algorithm-Cg

The document describes the midpoint circle algorithm for generating points along the circumference of a circle. It takes the radius and center point as input and calculates an initial point and decision parameter. It then uses the decision parameter in a test at each x-value to determine if the next point is above or below the x-axis and updates the decision parameter accordingly. It determines points in the other octants by symmetry and shifts the generated points to be centered on the given center point before plotting. As an example, it gives generating points in the first octant of a circle with radius 10 from x=0 to x=y.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Midpoint circle algorithm (1)

1) Input radius r and circle center (xc, yc) and obtain the first point on the
circumference of the circle centered on origin as (x0,y0) = r
2) Calculate the initial value of the decision parameter as
p0 = 5/4 - r
Midpoint circle algorithm (2)

3) At each xk position starting at k = 0 , perform following test


If pk <0 , the next point along the circle centered on (0,0) is (xk+1, y) and
pk + 1 = pk+2xk+1 +1
Otherwise the next point on the circle is (xk + 1,, yk -1) and
pk + 1 = pk + 2xk+1+1 – 2yk+1
where 2xk+1 = 2 xk+2 and 2yk+1 = 2yk-2
Midpoint circle algorithm (3)

4) Determine symmetry points in the other


seven octants
5) Move each pixel position (x,y) on to the circular path centered on (xc,yc) and
plot the co-ordinate values as
x=x + xc and y= y + yc
6) Repeat steps 3 through 5 until x>=y
Given a circle radius r = 10 , demonstrate the mid point circle generating
algorithm by determining positions along the circle octant in the first quadrant
from x =0 to x = y.

You might also like