Game Development Reference
In-Depth Information
1.2L INEAR A LGEBRA
When it comes to game development, a powerful tool at our disposal is a good understand-
ing of a few concepts in linear algebra. We will discuss linear algebra in a way in which
is applicable to game development, but in particular with an emphasis towards user inter-
faces.
1.2.1 Vectors
For computer graphics, we are interested in a vector as a geometrical object that contains
both a direction and a magnitude (length). Vectors are of great importance in games, you
can imagine that every object in every game, whether 2D or 3D has an arrow that starts
from its center and points in the direction it is traveling. This arrow, is a vector, and the
lengthofthisvectormeanshowfastthisobjectistraveling. Thisisperhapstheeasiest way
to picture what a vector is, vectors and the mathematical operations we can perform on
them are useful in a very large number of situations.
Figure 2- A vector denoted by the letter ā€œvā€
Vectors have anumber ofmathematical operations that can beperformed onthem, here we
will discuss the most common uses and the meaning behind them.
An essential part of any game engine is a comprehensive vector class that offers all the
facilities and often used functions in an intuitive way. The goal of this topic is to present
concepts in a straightforward manner and avoid adding complexity by presenting highly
optimized code. We will use different classes vector2 , vector3 and vector4 to explicitly
statethekindofvectoraproblemrequires,andwewillforegosomeoptimizations (suchas
Search WWH ::




Custom Search