Page 92 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 92
Lab on Computer Graphics
Notes return (OverlapArea, Code)
case 3:
(OverlapArea,Code) THREEINTPTS (xint,yint,A1,B1,PHI_1,A2,B2,H2_TR,K2_
TR,PHI_2,AA,BB,CC,DD,EE,FF)91
return (OverlapArea, Code)
case 4:
(OverlapArea,Code) ← FOURINTPTS (xint,yint,A1,B1,PHI_1,A2, B2,H2_TR,K2_
TR,PHI_2,AA,BB,CC,DD,EE,FF)
return (OverlapArea,Code)
Area Determination for Non-Intersecting Ellipses
If the polynomial solver returns no real roots of the polynomial, then the ellipse curves do
not intersect. It follows that the two ellipse areas are either disjoint, or one ellipse area is fully
contained within the other; all three possibilities are shown in Figure (See Figure 5.5)
Figure 5.5: When the Quadratic Polynomial has no Real Roots, the Ellipse Curves do
not Intersect. It Follows that Either One Ellipse is Fully Contained within
the Other, or the Ellipse Areas are Completely Disjoint, Resulting in three
Distinct Cases for Overlap Area
Each sub-case in Figure 5.5 requires a different overlap-area calculation, i.e. either the overlap
area is zero (Case 0-3), or the overlap is the area of the first ellipse (Case 0-2), or the overlap
is the area of the second ellipse (Case 0-1). When the polynomial has no real roots, geometry
can be used to determine which specific sub-case of Figure 5.5 is represented. An efficient logic
starts by determining the relative size of the two ellipses, e.g., by comparing the product of
semi-axis lengths for each ellipse. The area of an ellipse is proportional to the product of its
two semi-axis lengths, so the relative size of two ellipses can be determined by comparing the
product of semi-axis lengths:
(20)
A 1 B 1 ≤ (or ≥) A 1 B 1 A 1 B 1 ≤ (or ≥) A 1 B 1
Suppose the first ellipse is larger than the second ellipse, as determined by the relation in Equation
TR
TR
(20). In this case, if the second ellipse center (h 2 , k 2 ) is inside the first ellipse, then the second
86 LOVELY PROFESSIONAL UNIVERSITY