Graphics Reference
In-Depth Information
y
Inline Exercise 10.3:
Write down the matrix transformation that rotates every-
thing in the plane by 180
◦
counterclockwise. Actually compute the sines and
cosines so that you end up with a matrix filled with numbers in your answer.
Apply this transformation to the corners of the unit square,
(
0, 0
)
,
(
1, 0
)
,
(
0, 1
)
,
and
(
1, 1
)
.
Example 2: Nonuniform scaling.
Let
M
2
=
30
02
x
and
R
2
:
x
y
M
2
x
y
=
30
02
x
y
=
3
x
2
y
.
Before
T
2
:
R
2
→
→
(10.4)
y
This transformation stretches everything by a factor of three in the
x
-direction
and a factor of two in the
y
-direction, as shown in Figure 10.2. If both stretch
factors were three, we'd say that the transformation “scaled things up by three”
and is a
uniform scaling transformation.
T
2
represents a generalization of this
idea: Rather than scaling uniformly in each direction, it's called a
nonuniform
scaling transformation
or, less formally, a
nonuniform scale.
x
Once again the example generalizes: By placing numbers other than 2 and 3
along the diagonal of the matrix, we can scale each axis by any amount we please.
These scaling amounts can include zero and negative numbers.
After
Inline Exercise 10.4:
Write down the matrix for a uniform scale by
1. How
does your answer relate to your answer to inline Exercise 10.3? Can you
explain?
−
Figure 10.2: T
2
stretches the
x-axis by three and the y-axis
by two.
y
Inline Exercise 10.5:
Write down a transformation matrix that scales in
x
by
zero and in
y
by 1. Informally describe what the associated transformation does
to the house.
Example 3: Shearing.
Let
M
3
=
12
01
x
and
R
2
:
x
y
M
3
x
=
12
01
x
y
=
x
+
2
y
y
.
T
3
:
R
2
→
→
(10.5)
Before
y
y
As Figure 10.3 shows,
T
3
preserves height along the
y
-axis but moves points
parallel to the
x
-axis, with the amount of movement determined by the
y
-value.
The
x
-axis itself remains fixed. Such a transformation is called a
shearing trans-
formation.
Inline Exercise 10.6:
Generalize to build a transformation that keeps the
y
-axis
fixed but shears vertically instead of horizontally.
Example 4: A general transformation.
Let
M
4
=
1
x
and
1
22
−
After
R
2
:
x
y
M
4
x
y
=
1
x
y
.
1
22
−
T
4
:
R
2
→
→
(10.6)
Figure 10.3: A shearing transfor-
mation, T
3
.