Game Development Reference
In-Depth Information
A few examples are
4
−5
=
−4
5
,
=
,
−1
0
3
1
0
3
1.34
−3/4
−5 π
−1.34
3/4
5
−π
=
.
2.5.2 Geometric Interpretation
Negating a vector results in a vector of the same magnitude but opposite
direction, as shown in Figure 2.8.
Remember, the position of a vector on a diagram is irrelevant—only the
magnitude and direction are important.
2.6
Vector Multiplication by a Scalar
Although we cannot add a vector and a scalar, we can multiply a vector by
a scalar. The result is a vector that is parallel to the original vector, with
a different length and possibly opposite direction.
2.6.1 Official Linear Algebra Rules
Vector-times-scalar multiplication is straightforward; we simply multiply
each component of the vector by the scalar. Stated formally,
2
3
2
3
2
3
a 1
a 2
.
a n−1
a n
a 1
a 2
.
a n−1
a n
ka 1
ka 2
.
ka n−1
ka n
Multiplying a vector by
a scalar
4
5 =
4
5 k =
4
5 .
k
Applying this rule to 3D vectors, as an example, we get
2
3
2
3
2
3
x
y
z
x
y
z
kx
ky
kz
Multiplying a 3D vector
by a scalar
4
5
4
5
4
5
k
=
k =
.
Although the scalar and vector may be written in either order, most people
choose to put the scalar on the left, preferring k v to v k.
A vector may also be divided by a nonzero scalar. This is equivalent to
multiplying by the reciprocal of the scalar:
2
3
v x /k
v y /k
v z /k
v
k =
1
k
Dividing a 3D vector by
a scalar
4
5
v =
for 3D vector v and nonzero scalar k.
 
Search WWH ::




Custom Search