Explain Ellipse generating Algorithm?
Algorithm
Step 1: Input radius rx, ry and ellipse center(Xc, Yc)and obtain the first point on the circumference of a circle centered on the origin as
(X0, Y0) = (0, ry)
Step 2: Calculate the initial values of the decision parameter in region 1 as P10 = ry2 - rx2 ry + 1/4 rx2
Step 3: At each position starting at Xk position in region 1,starting at k = 0, perform the following test
If Pk < 0, the next point to plot is (Xk+1, Yk) and P1k+1 = P1k+2 ry2Xk+1 + ry2
Otherwise the next point is (Xk+1, Yk-1) and P1k+1 = P1k+2 ry2Xk+1 - 2ry2 Yk+1 + ry2
Step 4: Calculate the initial values of the decision parameter in region 2 as P20 = ry2 (X0+1/2)2+ rx2 (Y0 – 1)2- rx2 ry2
Step 5: At each position starting at Yk position in region 2,starting at k = 0, perform the following test:
If Pk > 0, the next point to plot is (Xk, Yk-1) and
P2k+1 = P2k - 2 ry2Yk+1 + rx2
Otherwise the next point is (Xk+1, Yk-1) and
P2k+1 = P2k - 2 ry2Yk+1 - 2rx2 Yk+1 + rx2
Step 6: Determine symmetry points in the other three octants
Step 7: 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 8: Repeat steps for region 1 until 2 ry2X>=2 ry2Y