Explain the Midpoint Circle Algorithm?
Algorithm
Step 1: Input radius r and circle center(Xc, Yc)and obtain the first point on the circumference of a circle centered on the origin as (X0, Y0) = (0, r)
Step 2: Calculate the initial values of the decision parameter as
P0 = 5/4 – r
Step 3: At each position starting at k perform the following test:
If Pk < 0, the next point to plot is (Xk+1, Yk) and Pk+1 = Pk+2 Xk+1 + 1
Otherwise the next point is (Xk+1, Yk+1) and Pk+1 = Pk+2 Xk+1 + 1- 2 Yk-1
Step 4: Determine symmetry points in the other seven octants.
Step 5: Move each pixel position(X, Y) onto the circular path centred on (Xc, Yc) and plot the coordinate values as
X = X + Xc Y = Y + Yc
Step 6: Repeat steps 3 through until X>=Y
Pk + 1= Pk + 2 Y
Other wise, the next point is (Xk+1, Yk+1) and
Pk + 1= Pk + 2 Y - 2 X
Step 5: Repeat steps 4 X times