Game Development Reference
In-Depth Information
the matrix, where the coe cients come from the vector operand. This is a
key fact, not just for our purposes but also for linear algebra in general, so
bear it in mind. We will return to it shortly.
4.1.8 Row versus Column Vectors
This section explains why the distinction between row and column vectors
is significant and gives our rationale for preferring row vectors. In Equa-
tion (4.4), when we multiply a row vector on the left with matrix on the
right, we get the row vector
xm 11 + ym 21 + zm 31 xm 12 + ym 22 + zm 32 xm 13 + ym 23 + zm 33
.
Compare that with the result from Equation (4.5), when a column vector
on the right is multiplied by a matrix on the left:
2
3
xm 11 + ym 12 + zm 13
xm 21 + ym 22 + zm 23
xm 31 + ym 32 + zm 33
4
5
.
Disregarding the fact that one is a row vector and the other is a column
vector, the values for the components of the vector are not the same! This
is why the distinction between row and column vectors is so
important.
Although some matrices in video game programming do represent ar-
bitrary systems of equations, a much larger majority are transformation
matrices of the type we have been describing, which express relationships
between coordinate spaces. For this purpose, we find row vectors to be
preferable for the “eminently sensible” reason [1] that the order of transfor-
mations reads like a sentence from left to right. This is especially important
when more than one transformation takes place. For example, if we wish
to transform a vector v by the matrices A , B , and C , in that order, we
write vABC , with the matrices listed in order of transformation from left
to right. If column vectors are used, then the vector is on the right, and so
the transformations will occur in order from right to left. In this case, we
would write CBAv . We discuss concatenation of multiple transformation
matrices in detail in Section 5.6.
Unfortunately, row vectors lead to very “wide” equations; using column
vectors on the right certainly makes things look better, especially as the
dimension increases. (Compare the ungainliness of Equation (4.4) with the
sleekness of Equation (4.5).) Perhaps this is why column vectors are the
near universal standard in practically every other discipline. For most video
game programming, however, readable computer code is more important
than readable equations. For this reason, in this topic we use row vectors
 
Search WWH ::




Custom Search