Graphics Programs Reference
In-Depth Information
100
0
010
100
001
,
10
001
and
respectively.
One feature that makes Equation (1.9) less than general is the way the sine and
cosine are obtained from the tangent of a known angle. Given that the slope a equals
tan α , we can calculate
sin α
cos α
sin α
a =tan α =
=
1
,
sin 2 α
which yields sin 2 α = a 2 / (1 + a 2 )or
a
1+ a 2
1
1+ a 2 .
sin α =
±
and cos α =
±
The signs depend on the angle (or rather the quadrant in which the angle happens to
be) and cannot be determined in a general way.
Exercise 1.14: Calculate the numerical value of matrix T reflect for the case α =30
and b =1.
Exercise 1.15: Digital images displayed on a screen or printed on paper consist of
pixels. Even smooth curves are made of pixels. Thus, there is a need for e cient
algorithms to compute the best pixels for a given curve or geometric figure. The circle
has a high degree of symmetry, which is why it is possible to determine the best pixels for
a given circle by computing the pixels for one octant and duplicating and transforming
each pixel seven times to complete the remaining seven octants. The question is, is it
possible to improve such an algorithm even more by doing half an octant and duplicating
each pixel 15 times?
Another feature that makes Equation (1.9) less than general is the use of the
explicit representation y = ax + b . This representation is limited because it cannot
express vertical lines (for which a would be infinite). When reflecting a point about an
arbitrary line, it is better to use the more general implicit representation of a straight
line ax + by + c =0,where a or b but not both can be zero. The slope of this line is
a/b , and substituting b = 0 yields a vertical line.
Given such a line, we start with a point P =( x, y ) and its reflection P =( x ,y )
about the line. It is clear that the segment PP must be perpendicular to the line, so
its equation must be bx
ay + d =0. Sinceboth P and P areonsuchaline,they
ay + d =0and bx
ay + d = 0. Subtracting these two expressions yields
satisfy bx
x )= a ( y
y ) .
b ( x
(1.10)
We assume that P is the reflection of P about the line ax + by + c =0,sothemidpoint
of segment PP ,whichisthepoint ( x + x ) / 2 , ( y + y ) / 2 , must be on this line and
Search WWH ::




Custom Search