Game Development Reference
In-Depth Information
in almost all cases where the distinction is relevant. Our limited use of
column vectors is for aesthetic purposes, when either there are no matrices
involved or those matrices are not transformation matrices and the left-to-
right reading order is not helpful.
As expected, different authors use different conventions. Many graphics
topics and application programming interfaces (APIs), such as DirectX, use
row vectors. But other APIs, such as OpenGL and the customized ports of
OpenGL onto various consoles, use column vectors. And, as we have said,
nearly every other science that uses linear algebra prefers column vectors.
So be very careful when using someone else's equation or source code that
you know whether it assumes row or column vectors.
If a book uses column vectors, its equations for matrices will be trans-
posed compared to the equations we present in this topic. Also, when col-
umn vectors are used, vectors are pre-multiplied by a matrix, as opposed
to the convention chosen in this topic, to multiply row vectors by a matrix
on the right. This causes the order of multiplication to be reversed between
the two styles when multiple matrices and vectors are multiplied together.
For example, the multiplication vABC is valid only with row vectors. The
corresponding multiplication would be written CBAv if column vectors
were used. (Again, note that in this case A , B , and C would be transposed
as compared to these matrices in the row vector case.)
Mistakes like this involving transposition can be a common source of
frustration when programming 3D math. Luckily, with properly designed
C++ classes, direct access to the individual matrix elements is seldom
needed, and these types of errors can be minimized.
4.2
Geometric Interpretation of Matrix
In general, a square matrix can describe any linear transformation. In
Section 5.7.1, we provide a complete definition of linear transformation, but
for now, it su ces to say that a linear transformation preserves straight and
parallel lines, and that there is no translation—that is, the origin does not
move. However, other properties of the geometry, however, such as lengths,
angles, areas, and volumes, are possibly altered by the transformation. In
a nontechnical sense, a linear transformation may “stretch” the coordinate
space, but it doesn't “curve” or “warp” it. This is a very useful set of
transformations, including
rotation
scale
orthographic projection
 
Search WWH ::




Custom Search