Game Development Reference
In-Depth Information
perform the reflection is
R ( n ) = S ( n ,−1)
2
3
1 + (−1 − 1)n x 2
(−1 − 1)n x n y
(−1 − 1)n x n z
4
5
1 + (−1 − 1)n y 2
=
(−1 − 1)n x n y
(−1 − 1)n y n z
3D matrix to reflect
about an arbitrary plane
1 + (−1 − 1)n z 2
(−1 − 1)n x n z
(−1 − 1)n y n z
2
3
1 − 2n x 2
−2n x n y
−2n x n z
4
5
1 − 2n y 2
=
−2n x n y
−2n y n z
.
1 − 2n z 2
−2n x n z
−2n y n z
Notice that an object can be “reflected” only once. If we reflect it again
(even about a different axis or plane) then the object is flipped back to
“right side out,” and it is the same as if we had rotated the object from its
initial position. An example of this is shown in the bottom-left corner of
Figure 5.9.
5.5
Shearing
Shearing is a transformation that “skews”
the coordinate space, stretching it
nonuniformly. Angles are not preserved;
however, surprisingly, areas and volumes
are. The basic idea is to add a multiple
of one coordinate to the other. For ex-
ample, in 2D, we might take a multiple
of y and add it to x, so that x
= x + sy.
This is shown in Figure 5.10.
The matrix that performs this shear
is
1 0
s 1
H x (s) =
,
Figure 5.10
Shearing in 2D
where the notation H x denotes that the
x-coordinate is sheared by the other co-
ordinate, y. The parameter s controls the amount and direction of the
shearing. The other 2D shear matrix, H y , is
1 s
0
H y (s) =
.
1
In 3D, we can take one coordinate and add different multiples of that
coordinate to the other two coordinates. The notation H xy indicates that
Search WWH ::




Custom Search