Page 82 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 82
Lab on Computer Graphics
Notes Suppose we seek to find the segment area within the rotated + translated ellipse that is
demarcated by a line, say y = mx + b. If (h, k) and φ are known for the rotated + translated
ellipse, then any two points on the line y = mx + b can be translated by an amount (–h, –k),
and then rotated through –φ, to define two points on a new line defined by y = m′x + b′. The
segment area in the general ellipse with parameters (A, B, h, k, φ) that is demarcated by y = mx
+ b will be the same as the segment area in the centred, un-rotated ellipse that is demarcated by
y = m′x + b′. Rotation and translation are affine transformations that also preserve lengths and
areas. In particular, the semi-axis lengths in the general rotated ellipse are preserved by both
transformations, and corresponding points on the two ellipses will demarcate equal segment
areas. To find the segment area, first determine any intersection points between the line y =
m′x + b′ and the centred, un-rotated ellipse. Then, the core segment area algorithm can be
called with the intersection points and the semi-axis lengths of the original ellipse, shown in
Figure (See Figure 5.3)
Figure 5.3: Translation and Rotation are Affine Transformations that are also
Length-and Area-preserving. Corresponding Points on the
Two Ellipses will Demarcate Equal Partition Areas
Several concepts should be considered when using the core segment area algorithm. First, the
order of points passed to ELLIPSE_SEGMENT will determine which segment area is returned.
If the line has an inherent direction, as depicted in Figure 5.3, then the points can be passed to
ELLIPSE_SEGMENT in the order that the line contacts the ellipse, and the area returned will be
to the right of the line. A second point to consider is that the algorithms presented here assume
that the semi-axis lengths A and B are in the direction of the x- and y-axes, respectively, in
the un-rotated ellipse. In its rotated orientation, the semi-axis length A will rarely be oriented
horizontally; e.g., for φ = /4, the semi-axis length A will be oriented vertically.
For any point (x i , y i ) on the line y = mx + b, the transformations required to move the points
into an orientation with respect to a standard ellipse that is analogous to their orientation to
the given ellipse are the inverse of what it took to rotate and translate a standard ellipse to its
desired position. The point is first translated, and then rotated by:
x È 1 ˘ È cos(-j ) - sin(-j )˘ È x - h˘
TR
Í y ˙ = Í ˙ Í 1 ˙
Î 1 TR ˚ Î sin(-j ) cos(-j ) ˚ Î y - k ˚
1
76 LOVELY PROFESSIONAL UNIVERSITY