Game Development Reference
In-Depth Information
2
3
m
11
m
12
m
13
m
21
m
22
m
23
m
31
m
32
m
33
4
5
Multiplying 3D row and
column vectors with a
3 × 3 matrix
x y z
=
(4.4)
[
xm
11
+ ym
21
+ zm
31
xm
12
+ ym
22
+ zm
32
xm
13
+ ym
23
+ zm
33
];
2
3
2
3
2
3
m
11
m
12
m
13
m
21
m
22
m
23
m
31
m
32
m
33
x
y
z
xm
11
+ ym
12
+ zm
13
xm
21
+ ym
22
+ zm
23
xm
31
+ ym
32
+ zm
33
4
5
4
5
4
5
=
;
(4.5)
2
3
5
m
11
m
12
m
13
m
21
m
22
m
23
m
31
m
32
m
33
4
x y z
= (undefined);
(4.6)
2
3
2
3
x
y
z
m
11
m
12
m
13
m
21
m
22
m
23
m
31
m
32
m
33
4
5
4
5
= (undefined).
(4.7)
As you can see, when we multiply a row vector on the left by a matrix on
the right, as in Equation (4.4), the result is a row vector. When we multiply
a matrix on the left by a column vector on the right, as in Equation (4.5),
the result is a column vector. (Please observe that this result is a column
vector, even though it looks like a matrix.) The other two combinations
are not allowed: you cannot multiply a matrix on the left by a row vector
on the right, nor can you multiply a column vector on the left by a matrix
on the right.
Let's make a few interesting observations regarding vector-times-matrix
multiplication. First, each element in the resulting vector is the dot product
of the original vector with a single row or column from the matrix.
Second, each element in the matrix determines how much “weight” a
particular element in the input vector contributes to an element in the
output vector. For example, in Equation (4.4) when row vectors are used,
m
12
controls how much of the input x value goes towards the output y
value.
Third, vector-times-matrix multiplication distributes over vector addi-
tion, that is, for vectors
v
,
w
, and matrix
M
,
(
v
+
w
)
M
=
vM
+
wM
.
Finally, and perhaps most important of all, the result of the multipli-
cation is a linear combination of the rows or columns of the matrix. For
example, in Equation (4.5), when column vectors are used, the resulting
column vector can be interpreted as a linear combination of the columns of
Search WWH ::
Custom Search