- Home
- Documents
- ELLIPSE GENERATING ALGORITHMS 1. DEFINITION Ellipse is an elongated circle. Elliptical curves can be generated by modifying circle-drawing procedures.

prev

next

of 14

Published on

04-Jan-2016View

222Download

0

Embed Size (px)

Transcript

ELLIPSE GENERATING ALGORITHMS

*

DEFINITIONEllipse is an elongated circle. Elliptical curves can be generated by modifying circle-drawing procedures to take into account the different dimensions of an ellipse along the major and minor axes.

*

PROPERTIES OF ELLIPSES Distances from any point on the ellipse to two fixed positions called the foci of the ellipse.Sum of these two distances is the same values for all points on the ellipse. d1+d2=constant

*

Expressing distances d1 and d2 in terms of the focal coordinates F1=(x1,y2) and F2=(x2,y2) sqrt((x-x1)2+(y-y1)2)+sqrt((x-x2)2+(y-y2)2)=constantThe general ellipse equation in the form Ax2+By2+Cxy+Dx+Ey+F=0Coefficients A,B,C,D,E, and F are evaluated in terms of the focal coordinates and the dimensions of the major and minor axes of the ellipse.

*

The major axis is the straight line segment extending from one side of the ellipse to the other through the foci. The minor axis spans the shorter dimension of the ellipse, perpendicularly bisecting the major axis at the halfway position (ellipse center) between the two foci.

*

((x-xc)/rx)2+((y-yc)/ry)2=1

Polar coordinates r and x=xc+rxcos y=yc+rxsin *

MIDPOINT ELLIPSE ALGORITHM The Ellipse function isfellipse (x,y)=ry2x2+rx2y2 rx2 ry2 which has the following properties: fellipse (x,y) 0, if(x,y) is outside the ellipse boundary

*

REGION 1 AND 2 CAN BE PROCESSED IN VARIOUS WAYSSTEP 1 : Start at position (0,ry) and step clockwise along the elliptical path in the first quadrant shifting from unit steps in x to unit steps in y when the slope becomes less than -1 STEP2 : Start at (rx,0) and select points in a counter clockwise order. Shifting from unit steps in y to unit steps in x when the slope becomes greater than -1.0 2.2 Using parallel processors calculate pixel positions in the two regions simultaneouslySTEP 3: Start at (0,ry) step along the ellipse path in clockwise order throughout the first quadrant ellipse function (xc,yc)=(0,0) fellipse (x,y)=ry2x2+rx2y2 rx2 ry2

*

STEP 4: Check the properties

Ellipse function fellipse (x,y) serves as the decision parameter in the midpoint algorithm. Starting at (0,ry)The ellipse slope is calculated dy/dx= -(2ry2x/2rx2y) At the boundary between region 1 and region 2 dy/dx = -1.0 2ry2x=2rx2y Move out of region 1 ; 2ry2x>=2rx2y

*

- To determine the next position along the ellipse path by evaluating the decision parameter at this mid point P1k = fellipse (xk+1,yk - 1/2) = ry2 (xk+1)2 + rx2 (yk-1/2)2 rx2 ry2 if P1k
- Decision parameters are incremented by the following amounts increment = { 2 ry2(xk +1) + ry2 if p1k
Decision parameter is evaluated as p10 = fellipse(1,ry - ) = ry2 + rx2 (ry -)2 - rx2 ry2Or p10 = ry2 - rx2 ry + rx2

*

REGION 2For this region, the decision parameter is evaluated as p2k = fellipse(xk + ,yk - 1) = ry2 (xk + )2 + rx2 (yk - 1)2 - rx2 ry2P2k+1 = fellipse(xk+1 +,yk+1 -1 ) = ry2(xk +) 2 + rx2 [(yk+1 -1) -1]2 - rx2 ry2 or p2k+1 = p2k -2 rx2(yk -1) + rx2 + ry2 [(xk+1 +)2 - (xk +)2] Decision parameter for region 2 p20 = fellipse(x0 + ,y0 - 1) = ry2 (x0 + )2 + rx2 (y0 - 1)2 - rx2 ry2

*

ALGORITHM*