Game Development Reference

In-Depth Information

F
IGURE
2.3

A vector as a movement in space.

vector is the change along each axis. So

⎡

⎣

⎤

⎦

x

y

z

a

=

where
x
is the change in the position along the X axis from
a
0
to
a
1
,givenby

x

=

x
1
−

x
0

where
x
0
is the X coordinate of
a
0
and
x
1
is the X coordinate of
a
1
. Similarly for
y

and
z
.

Position and change in position are really two sides of the same coin. We can

think of any position as a change of position from the origin (written as
0
,where

each component of the vector is zero) to the target location.

If we think in terms of the geometry of a vector being a movement from the ori-

gin to a point in space, then many of the mathematical operations we'll meet in this

chapter have obvious and intuitive geometric interpretations. Vector addition and

subtraction, multiplication by a scalar, and different types of multiplication can all be

understood in terms of how these movements relate. When drawn as in figure 2.3, the

visual representation of an operation is often much more intuitive than the mathe-

matical explanation. We'll consider this for each operation we meet.