Game Development Reference
In-Depth Information
Subtraction is the same, except the components are subtracted. Both of these op-
erations rarely see use in games.
Scalar Multiplication
As can be done with vectors, it is possible to multiply a matrix by a scalar.
Multiplication
Matrix multiplication is an operation that sees widespread use in games. The easi-
est way to visualize matrix multiplication between two matrices with the same
dimensions is to think in terms of vectors and dot products. Suppose you have
matrices A and B , as shown here:
To calculate C = A×B , take the first row of A and dot product it with the first
column of B . The result of this dot product is the top-left value in C . Then dot
product the first row of A with the second column of B , which gives the top-right
value in C . Repeat this process for the second row of A to complete the multiplic-
ation.
Matrix multiplication does not require matrices to have identical dimensions, but
it does require that the number of columns in A be equal to the number of rows in
B . For instance, the following multiplication is also valid:
Multiplying two4×4matrices followsthesameprinciple assmaller ones;thereare
just more elements to calculate:
Search WWH ::




Custom Search