Game Development Reference
In-Depth Information
Matrices
If your work is a system of equations, you work primarily with the coefficients of
the terms of the equations. If you organize the terms of an equation so that their
variables are in a standard order, then you arrive at the representation of systems
of equations you have worked with so far in this chapter. Consider, for example, a
system along the lines of the following:
3 x 4 y ¼ 1
5 x þ 2 y ¼ 19
You can proceed to solve the systemof equations for the x and y values by using the
approach given in the previous section. At the same time, you can use an approach
that involves using matrices. A matrix consists of an array or collection of num-
bers. In a matrix, you organize the numbers in a rectangular fashion, in rows and
columns. Matrices are always identified according to their rows and columns. If a
matrix contains 2 rows and 3 columns, then it is said to be a 2 3 matrix. If a
matrix contains 2 rows and 2 columns, then it is said to be a 2 2 matrix.
Mathematicians usually identify matrices by enclosing them in square brackets.
They identify the elements within by using letters with subscripts or by providing
the numbers themselves. A 3 3 matrix might be represented this way:
a 1 b 1 c 1
a 2 b 2 c 2
a 3 b 3 c 3
2
3
4
5
A2 2 matrix might be represented this way:
a 1 b 1
a 2 b 2
A vast and interesting field of study investigates the behavior of matrices, and the
use of matrices in programming related to the graphics for computer game
development and the logic of games involves matrices extensively. In this con-
text, matrices provide an alternative approach to solving the system of equations.
If you examine the coefficients of the system of equations given above, you see
that you can create a 2 3 matrix. In other words, the matrix consists of 2 rows
and 3 columns. You can write it as follows:
34 1
5219
Search WWH ::




Custom Search