Graphics Reference
In-Depth Information
B.3 Transformations
B.3.1 Transforming a point using vector-matrix multiplication
Vector-matrix multiplication is usually how the transformation of a point is represented. Because a
vector is just an N
1 matrix, vector-matrix multiplication is actually a special case of matrix-matrix
multiplication. Vector-matrix multiplication is usually performed by premultiplying a column vector
by a matrix. This is equivalent to post-multiplying a row vector by the transpose of that same matrix.
Both notations are encountered in the graphics literature, but use of the column vector is more common.
The examples in Equations B.33 and B.34 use a 4
4 matrix and a point in three-space using homo-
geneous coordinates, consistent with what is typically encountered in graphics applications.
2
3
2
3
2
3
Q x
Q y
Q z
Q w
M 11
M 12
M 13
M 14
P x
P y
P z
1
4
5 ¼ Q ¼ MP ¼
4
5
4
5
M 21
M 22
M 23
M 24
(B.33)
M 31
M 32
M 33
M 34
M 41
M 42
M 43
M 44
¼ Q T
¼ P T M T
Q x Q y Q z Q w
2
3
M 11
M 21
M 31
M 41
4
5
M 12
M 22
M 32
M 42
¼ P x P y P z 1
(B.34)
M 13
M 23
M 33
M 43
M 14
M 24
M 34
M 44
B.3.2 Transforming a vector using vector-matrix multiplication
In addition to transforming points, it is also often useful to transform vectors, such as normal vectors,
from one space to another. However, the computations used to transform a vector are different from
those used to transform a point. Vectors have direction and magnitude but do not have a position in
space. Thus, for example, a pure translation has no effect on a vector. If the transformation of one space
to another is a pure rotation and uniform scale, then those transformations can be applied directly to the
vector. However, it is not so obvious how to apply transformations that incorporate nonuniform scale.
The transformation of a vector can be demonstrated by considering a point, P , which satisfies a
planar equation ( Eq. B.35 ) . Note that ( a , b , c ) represents a vector normal to the plane. Showing
how to transform a planar equation will, in effect, show how to transform a vector. The point is trans-
formed by a matrix, M ( Eq. B.36 ). Because the transformations of rotation, translation, and scale pre-
serve planarity, the transformed point, P 0 , will satisfy some new planar equation, N 0 , in the transformed
space ( Eq. B.37 ). Substituting the definition of the transformed point, Equation B.36 , into
Equation B.37 produces Equation B.38 . If the transformed planar equation is equal to the original nor-
mal postmultiplied by the inverse of the transformation matrix ( Eq. B.39 ), then Equation B.37 is sat-
isfied, as shown by Equation B.40 . The transformed normal vector is, therefore, ( a 0 , b 0 , c 0 ).
ax þ by þ cz þ d ¼
0
2
4
3
5 ¼
x
y
1
½
abcd
0
(B.35)
 
Search WWH ::




Custom Search