Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "ELLIPSE GENERATING ALGORITHMS 1. DEFINITION Ellipse is an elongated circle. Elliptical curves can be generated by modifying circle-drawing procedures."— Presentation transcript:

1 ELLIPSE GENERATING ALGORITHMS 1

2 DEFINITION Ellipse 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. 2

3 P ROPERTIES 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 3

4 Expressing distances d1 and d2 in terms of the focal coordinates F1=(x 1,y 2 ) and F 2 =(x 2,y 2 ) sqrt((x-x 1 ) 2 +(y-y 1 ) 2 )+sqrt((x-x 2 ) 2 +(y-y 2 ) 2 )=constant The general ellipse equation in the form Ax2+By2+Cxy+Dx+Ey+F=0 Coefficients 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. 4

5 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. 5

6 ((x-x c )/r x ) 2 +((y-y c )/r y ) 2 =1 Polar coordinates r and θ x=xc+rxcos θ y=yc+rxsin θ 6

7 M IDPOINT ELLIPSE A LGORITHM The Ellipse function is f ellipse (x,y)=r y 2 x 2 +r x 2 y 2 –r x 2 r y 2 which has the following properties: f ellipse (x,y)  <0, if (x,y) is inside the ellipse boundary  =0, if(x,y) is on ellipse boundary  >0, if(x,y) is outside the ellipse boundary 7

8 R EGION 1 AND 2 CAN BE PROCESSED IN VARIOUS WAYS STEP 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 simultaneously STEP 3: Start at (0,ry) step along the ellipse path in clockwise order throughout the first quadrant ellipse function (xc,yc)=(0,0) f ellipse (x,y)=r y 2 x 2 +r x 2 y 2 –r x 2 r y 2 8

9 STEP 4: Check the properties Ellipse function f ellipse (x,y) serves as the decision parameter in the midpoint algorithm. Starting at (0,ry) The ellipse slope is calculated dy/dx= -(2r y 2 x/2r x 2 y) At the boundary between region 1 and region 2 dy/dx = - 1.0 2r y 2 x=2r x 2 y Move out of region 1 ; 2r y 2 x>=2r x 2 y 9

10 To determine the next position along the ellipse path by evaluating the decision parameter at this mid point P1 k = f ellipse (x k+1,y k - 1/2) = r y 2 (x k+1 ) 2 + r x 2 (y k -1/2) 2 – r x 2 r y 2 if P1 k <0, Midpoint is inside the ellipse Otherwise the midpoint is outside Next sampling position (xk+1+1=xk+2) the decision parameter for region 1 is calculated as p1 k+1 = f ellipse (x k+1 +1,y k+1 -½ ) =r y 2 [(x k +1 ) + 1] 2 + r x 2 (y k+1 -½) 2 - r x 2 r y 2 OR p1 k+1 = p1 k +2 r y 2 (x k +1 ) + r y 2 + r x 2 [(y k+1 -½) 2 - (y k -½) 2 ] Where y k+1 is y k or y k-1 depending on the sign of P1 k. 10

11 Decision parameters are incremented by the following amounts increment = { 2 r y 2 (x k +1 ) + r y 2 if p1 k <0 } { 2 r y 2 (x k +1 ) + r y 2 - 2r x 2 y k+1 if p1 k ≥ 0 } Increments for the decision parameters can be calculated using only addition and subtraction as in the circle algorithm. The terms 2ry 2 x and 2rx 2 y can be obtained incrementally. At the initial position (0,ry) these two terms evaluate to 2 r y 2 x = 0 2r x 2 y =2r x 2 r y 11

12 Decision parameter is evaluated as p1 0 = f ellipse (1,r y -½ ) = r y 2 + r x 2 (r y -½) 2 - r x 2 r y 2 Or p1 0 = r y 2 - r x 2 r y + ¼ r x 2 12

13 REGION 2 For this region, the decision parameter is evaluated as p2 k = f ellipse (x k +½,y k - 1) = r y 2 (x k +½ ) 2 + r x 2 (y k - 1) 2 - r x 2 r y 2 P2 k+1 = f ellipse (x k+1 +½,y k+1 -1 ) = r y 2 (x k +½) 2 + r x 2 [(y k+1 -1) -1] 2 - r x 2 r y 2 or p2 k+1 = p2 k -2 r x 2 (y k -1 ) + r x 2 + r y 2 [(x k+1 +½) 2 - (x k +½) 2 ] Decision parameter for region 2 p2 0 = f ellipse (x 0 +½,y 0 - 1) = r y 2 (x 0 +½ ) 2 + r x 2 (y 0 - 1) 2 - r x 2 r y 2 13

14 ALGORITHM 14


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

Similar presentations


Ads by Google