Game Development Reference
In-Depth Information
2
T HE M ATHEMATICS
OF P ARTICLES
dimensional mathematics. In particular it looks at vector mathematics and
vector calculus—the fundamental building blocks on which all our physics code will
be built. I'll avoid some of the harder topics we'll only need later. Matrices and quater-
nions, for example, will not be needed until chapter 9, so I'll postpone reviewing them
until that point.
Before we look at simulating the physics of particles, this chapter reviews three-
2.1
V ECTORS
Most of the mathematics we are taught at school deals with single number—numbers
to represent the number of apples we have or the time it takes for a train to make a
journey, or the numerical representation ofafraction.Wecanwritealgebraicequa-
tions that tell us the value of one number in terms of others. If x
y 2
=
and y
=
3, then
we know x
9. This kind of single number on its own is called a “scalar value.”
Mathematically a vector is an element of a vector space: a structure that displays
certain mathematical properties for addition and multiplication. For our purposes
the only vector spaces we're interested in are regular (called Euclidean) 2D and 3D
spaces. In this case the vector represents a position in those spaces.
Vectors are usually represented as an ordered list of numbers that can be treated
in a similar way to a single number in an algebraic equation. If y is a vector (let's say
it contains the numbers 2 and 3), and if x
=
2 y , then x will also be a vector of two
numbers, in this case 4 and 6. Vectors can undergo the same mathematical operations
15
=