Home | | Graphics and Multimedia | Ellipse generating Algorithm Properties of the Ellipse

# Ellipse generating Algorithm Properties of the Ellipse

An ellipse is a set of points such that the sum of the distances from two fixed positions (foci) is the same for all points.If the distances to any two foci from any point P=(x,y) on the ellipse are labeled d1 and d2 then the general equation of an an ellipse can be stated as d1 + d2 is constant.

Ellipse generating Algorithm Properties of the Ellipse

An ellipse is a set of points such that the sum of the distances from two fixed positions (foci) is the same for all points.If the distances to any two foci from any point P=(x,y) on the ellipse are labeled d1 and d2 then the general equation of an an ellipse can be stated as d1 + d2 is constant.

An ellipse in standard position is symmetric between quadrants. But it not symmetric between the two octants of the quadrant. So, we must calculate the pixel positions along the elliptical arc throughout one quadrant, then we obtained positions in the remaining three quadrants by symmetry.

Midpoint Ellipse Algorithm

1.Input rx,ry and ellipse center (xc,yc) and obtain the first point on an ellipse centered on the origin as

(x0,y0)=(0,ry)

2.Calculate the initial value of the decision parameter in region 1 as p10 = r2y-r2xry + ¼ r2x

3.At each xk position in region 1,starting at k=0,perform the following test if p1k<0, the next point along the ellipse centered on (0,0)is (xk+1,yk) otherwise the next point along the circle is (xk+1,yk-1) and

p1k+1 = p1k + 2r2yxk+1 – 2r2yxk+1 + r2y

with

2r2yxk+1 = 2r2yxk + 2r2y 2r2xyk-2r2xyk – 2r2x

4.Calculate the initial value of the decision parameter in region 2 using the last point (x0,y0) calculated in region as

p20 = r2y (x0+1/2)2 + r2x(y0-1)2-r2xr2y

5.At each yk position in region2 starting at k=0 ,perform the following test if p2k>0 the next point along the ellipse centered on (0,0) is

(xk,yk-1) and p2k+1=p2k-2r2xyk+1 + r2x

otherwise the next point along the circle is (xk+1,yk-1) and p2k+1 = p2k + 2r2yxk+1 – 2r2xyk+1 +r2x

using the same incremental calculations for x and y as in region1 6.Determine symmetry points in the other three quadrants.

7.Move each calculated pixel position (x,y) onto the elliptical path centered on (xc,yc) and plot the coordinate values.

X=x+xc,y=y+yc

8.Repeat the steps for region1 until 2r2yx > = 2r2xy

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Computer Graphics and Multimedia : Ellipse generating Algorithm Properties of the Ellipse |