Graphics Reference
In-Depth Information
would never want the length of a vector to change just by changing coordinate
systems. Rotation matrices have the interesting property of being orthonormal,
which means that their rows are a set of three mutually perpendicular unit vectors
(the same is true for their columns). There is an easy way to get two such matrices,
and in fact they are all we need:
x u
y u
z u
M 1 =
x v
y v
z v
x w
y w
z w
and
x u
x v
x w
.
M 2 =
y u
y v
y w
z u
z v
z w
Note that these two matrices are the transposes of each other (rows and columns
exchanged). For rotation matrices such as these, the transpose is the inverse. Thus
each matrix is the geometric opposite of the other and “unrotates” the action of its
partner. Now suppose that
so the vector is just in the direction
of V u but has length 2. If we apply M 2 to that vector, we get
(
u
,
v
,
w
)=(
2
,
0
,
0
)
(
,
,
)
,so
for that vector, M 2 seems to rewrite the uvw into the right xyz . Try this with other
simple uvw cases. In fact, in general, M 2 takes uvw coordinates and converts them
into the equivalent xyz coordinates. The matrix M 1 does the opposite: it takes xyz
coordinates to uvw coordinates.
If you ever have three coordinate systems, you can either pass through two
matrices A and B or note that passing through the matrix product C
2 x u
2 y u
2 z u
=
BA is
equivalent.
One question that arises is whether all vectors transform the same. The answer
is no. Surface normal vectors transform using
M 1
T instead of M . Fortunately,
for rotation matrices, those are the same. However, if your matrix ever has any
nonuniform scaling in it (e.g., a scaling that would take a sphere to an ellipsoid),
then you will need to use the inverse transpose.
(
)
Search WWH ::




Custom Search