Page 97 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 97
Unit 5: Implementing Ellipse Algorithm
area consists of two segments from each ellipse, and a central convex quadrilateral. For the Notes
approach presented here, the four intersection points are sorted ascending in a counter-clockwise
order around the first ellipse. The ordered set of intersection points is (x 1 , y 1 ), (x 2 , y 2 ), (x 3 , y 3 ) and
(x 4 , y 4 ). The ordering allows a direct calculation of the quadrilateral area. The standard formula
uses the cross-product of the two diagonals:
1 1
Area = (x 3 – x 1 , y 3 – y 1 ) x (x 4 – x 2 , y 4 – y 2 ) = (x 3 – x 1 ) (y 4 – y 2 ) – (x 4 – x 2 ) – (x 3 – x 1 )
2 2
The point ordering also simplifies the search for the appropriate segments of each ellipse
that contribute to the overlap area. Suppose that the first two sorted points (x 1 , y 1 ) and
(x 2 , y 2 ) demarcate a segment of the first ellipse that contributes to the overlap area. It follows
that contributing segments from the first ellipse are between(x 1 , y 1 ) and (x 2 , y 2 ), and also between
(x 3 , y 3 ) and (x 4 , y 4 ). In this case, the contributing segments from the second ellipse are between
(x 2 , y 2 ) and (x 3 , y 3 ), and between (x 4 , y 4 ) and (x 1 , y 1 ). To determine which segments contribute
to the overlap area, it suffices to test whether a point midway between (x 1 , y 1 ) and (x 2 , y 2 ) is
inside or outside the second ellipse. The segment algorithm is used for each of the four areas,
and added to the quadrilateral to obtain the total overlap area. (See Figure 5.8)
Figure 5.8: When three intersection points exist, one must be a tangent, and the ellipse
curves must cross at the other two points, always resulting in a partial
overlap. When four intersection points exist, the ellipse curves must cross
at all four points, resulting in a partial overlap consisting of two segments
from each ellipse, and a central convex quadrilateral.
Self Assessment Questions
6. A (n) …………..is a circle whose centre is located on the circumference of another circle.
(a) equant (b) deferent
(c) ellipse (d) epicycle
7. The geometry of an ellipse is described by two numbers. The ………….. which is half the
longest diameter of the ellipse and the ………….. which tells us the shape of the ellipse.
(a) radius, eccentricity (b) radius, deferent
(c) semi major axis, epicycle (d) semi major axis eccentricity
8. If the eccentricity is less than one then the conic is?
(a) circle (b) parabola
(c) ellipse (d) none of these
LOVELY PROFESSIONAL UNIVERSITY 91