Matrix Multiplication

To show how matrix multiplication is implemented, here are two matrixes:

     ┌         ┐         ┌         ┐
     │ a  b  c │         │ j  k  l │
     │ d  e  f │    *    │ m  n  o │
     │ g  h  i │         │ p  q  r │
     └         ┘         └         ┘

The multiplication of these two matrixes produces a value for each of the nine elements of the resulting matrix:

     ┌                              ┐
     │ element1  element2  element3 │
     │ element4  element5  element6 │
     │ element7  element8  element9 │
     └                              ┘

To produce element 1 of the matrix, element a is multiplied by element j, element b is multiplied by element m, and element c is multiplied by element p. That is:

element1 = (a x j) + (b x m) + (c x p)

To produce element 2 of the matrix, element a is multiplied by element k, element b is multiplied by element n, and element c is multiplied by element q. To produce element 3 of the matrix, elements a, b, and c are multiplied by their corresponding elements (l, o, and r) in the third vertical line of the second matrix. To produce element 4 of the matrix, you move down a row in the first matrix. That is, element d is multiplied by element j, element e is multiplied by element m, and element f is multiplied by element p. You continue the multiplication in this way until each of the nine elements has a value. The complete workings for this example are as follows:

element1 = (a x j) + (b x m) + (c x p)

element2 = (a x k) + (b x n) + (c x q)

element3 = (a x l) + (b x o) + (c x r)

element4 = (d x j) + (e x m) + (f x p)

element5 = (d x k) + (e x n) + (f x q)

element6 = (d x l) + (e x o) + (f x r)

element7 = (g x j) + (h x m) + (i x p)

element8 = (g x k) + (h x n) + (i x q)

element9 = (g x l) + (h x o) + (i x r)

Note that if the order of the two matrixes is reversed, the results of the multiplication are different.

Here is a simple example in which an object is scaled by a factor of 3, and then translated by (5,4):

     ┌         ┐         ┌         ┐          ┌         ┐
     │ 3  0  0 │         │ 1  0  0 │          │ 3  0  0 │
     │ 0  3  0 │    *    │ 0  1  0 │     =    │ 0  3  0 │
     │ 0  0  1 │         │ 5  4  1 │          │ 5  4  1 │
     └         ┘         └         ┘          └         ┘

You can multiply together as many transformation matrixes as you require.


[Back: Changing the Marker Color]
[Next: Metafiles]