Game Development Reference
In-Depth Information
Let's look at a vector. Figure 2.1 shows an illustration of a vector in 2D.
It looks like an arrow, right? This is the standard way to represent a vector
graphically, since the two defining characteristics of a vector are captured:
its magnitude and direction.
We sometimes refer to the head and tail of a vector. As shown in
Figure 2.2, the head is the end of the vector with the arrowhead on it
(where the vector “ends”), and the tail is the other end (where the vector
“starts”).
Figure 2.1
A 2D vector
Figure 2.2
A vector has a head and a tail
Where is this vector? Actually, that is not an appropriate question.
Vectors do not have position, only magnitude and direction. This may
sound impossible, but many quantities we deal with on a daily basis have
magnitude and direction, but no position. Consider how the two statements
below could make sense, regardless of the location where they are applied.
Displacement. “Take three steps forward.” This sentence seems to
be all about positions, but the actual quantity used in the sentence is
a relative displacement and does not have an absolute position. This
relative displacement consists of a magnitude (3 steps) and a direction
(forward), so it could be represented by a vector.
Velocity. “I am traveling northeast at 50 mph.” This sentence de-
scribes a quantity that has magnitude (50 mph) and direction (north-
east), but no position. The concept of “northeast at 50 mph” can be
represented by a vector.
Notice that displacement and velocity are technically different from the
terms distance and speed. Displacement and velocity are vector quantities
and therefore entail a direction, whereas distance and speed are scalar quan-
tities that do not specify a direction. More specifically, the scalar quantity
distance is the magnitude of the vector quantity displacement, and the
scalar quantity speed is the magnitude of the vector quantity velocity.
Because vectors are used to express displacements and relative differ-
ences between things, they can describe relative positions. (“My house is
3 blocks east of here.”) However, you should not think of a vector as hav-
ing an absolute position itself, instead, remember that it is describing the
displacement from one position to another, in this case from “here” to “my
Search WWH ::




Custom Search