Game Development Reference
In-Depth Information
house.” (More on relative versus absolute position in Section 2.4.1.) To
help enforce this, when you imagine a vector, picture an arrow. Remem-
ber that the length and direction of this arrow are significant, but not the
position.
Since vectors do not have a position, we can represent them on a diagram
anywhere we choose, provided that the length and direction of the vector
are represented correctly. We often use this fact to our advantage by sliding
the vector around into a meaningful location on a diagram.
Now that we have the big picture about vectors from a mathematical and
geometric perspective, let's learn how to work with vectors in the Cartesian
coordinate system.
2.3
Specifying Vectors with Cartesian Coordinates
When we use Cartesian coordinates to describe vectors, each coordinate
measures a signed displacement in the corresponding dimension. For ex-
ample, in 2D, we list the displacement parallel to the x-axis, and the dis-
placement parallel to the y-axis, as illustrated in Figure 2.3.
Figure 2.3
Vectors are specified by giving the signed displacement in
each dimension.
Figure 2.4 shows several 2D vectors and their values. Notice that the
position of each vector on the diagram is irrelevant. (The axes are conspic-
uously absent to emphasize this fact, although we do assume the standard
convention of +x pointing to the right and +y pointing up.) For example,
two of the vectors in Figure 2.4 have the value [1.5,1], but they are not in
the same place on the diagram.
3D vectors are a simple extension of 2D vectors. A 3D vector contains
three numbers, which measure the signed displacements in the x, y, and z
directions, just as you'd expect.
We are focusing on Cartesian coordinates for now, but they are not the
only way to describe vectors mathematically. Polar coordinates are also
common, especially in physics textbooks. Polar coordinates are the subject
of Chapter 7.
 
Search WWH ::




Custom Search