Graphics Programs Reference
In-Depth Information
Notice that a + b =1,whichiswhy P c is a point on the straight segment connecting
P 1 and P 2 (see also Equation (Ans.7)).
In the special case P 1 = P 2 , it is easy to see that the center of the double scaling
is P c = P 1 = P 2 .
Exercise 1.25: What is the result of two consecutive scalings with the same scaling
factors but about two different points?
Exercise 1.26: Show that all the points with coordinates ( t 2 ,t ), where 0
t
1, after
being transformed by
101
020
101
,
lie on the perimeter of the unit circle x 2 + y 2 = 1. (Hint: See Figure 1.9.)
y
2 t
x
θ
t 2
1
Figure 1.9: A Unit Circle.
It is easy to see that the transformations discussed here can change lengths and
angles. Scaling changes the lengths of objects. Rotation and shearing change angles.
One feature that's preserved, though, is parallel lines. A pair of parallel lines will
remain parallel after any scaling, reflection, rotation, shearing, and translation. A
transformation that preserves parallelism (and also maps finite points to finite points)
is called a ne .
1.2.3 Fast Rotations
Rotation requires the calculation of the transcendental sine and cosine functions, which
is time-consuming. If many rotations are needed, it is preferable to precalculate the
trigonometric functions for many angles and store them in a table. This section shows
how to do this using integers only, a method that results in much faster rotations than
using floating-point numbers.
The method is illustrated for the first quadrant (rotation angles of 0 to 90 )in
increments of 1 . Notice that rotations in other quadrants can be achieved by a first-
quadrant rotation followed by a reflection. The following Mathematica code generates
Search WWH ::




Custom Search