midpoint ellipse drawing algorithm in computer graphics

First time here? Checkout the FAQ!

x

**Mid-Point Ellipse Algorithm :**

- Take input radius along x axis and y axis and obtain center of ellipse.
- Initially, we assume ellipse to be centered at origin and the first point as : (x, y0)= (0, ry).
- Obtain the initial decision parameter for region 1 as: p10=ry2+1/4rx2-rx 2ry
- For every xk position in region 1 :

If p1k<0 then the next point along the is (xk+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 - 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
- At each yk 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 - Else, the next point is (xk+1, yk -1) and p2k+1=p2k+2ry2xk+1 -2rx2yk+1+rx2
- Now obtain the symmetric points in the three quadrants and plot the coordinate value as: x=x+xc, y=y+yc
- Repeat the steps for region 1 until 2ry2x>=2rx2y