Mid-Point Ellipse Algorithm
Mid-Point Ellipse Algorithm
1. Take input radius along x axis and y axis and obtain center of
ellipse.
2. Initially, we assume ellipse to be centered at origin and the first
point as : (x, y0)= (0, r y).
3. Obtain the initial decision parameter for region 1 as: p10=ry2+1/4rx2-
rx 2ry
4. For every xk position in region 1 :
If p1k<0 then the next point along the is (x k+1 , yk) and
p1k+1=p1k+2ry2xk+1+ry2
Else, the next point is (xk+1, yk-1 )
And p1k+1=p1k+2ry2xk+1 – 2rx2yk+1+ry2
5. Obtain the initial value in region 2 using the last point (x0, y0) of
region 1 as: p20=ry2(x0+1/2) 2+rx2 (y0-1)2-rx2ry2
6. At each y k in region 2 starting at k =0 perform the following task.
If p2k>0 the next point is (xk, yk-1) and p2k+1=p2k-2rx2yk+1+rx2
7. Else, the next point is (xk+1, yk -1) and p2k+1=p2k+2ry2xk+1 -2rx2yk+1+rx2
8. Now obtain the symmetric points in the three quadrants and plot
the coordinate value as: x=x+xc, y=y+yc
9. Repeat the steps for region 1 until 2r y2x>=2rx2y