Graphics Reference
In-Depth Information
3.6.1 Multiplying a Vector by a Scalar
Given a vector
n
,2
n
means that the vectors components are doubled. For example,
given
T
T
.
n
=[
345
]
then
2
n
=[
6810
]
Similarly, dividing
n
by 2, its components are halved. Note that the vector's direction
remains unchanged - only its magnitude changes. However, the vector's direction is
reversed if the scalar is negative:
T
.
λ
=−
2
then
λ
n
=[−
6
−
8
−
10
]
In general, given
⎡
⎤
⎡
⎤
n
1
n
2
n
3
±
λn
1
±
λn
2
±
λn
3
⎣
⎦
⎣
⎦
n
=
then
±
λ
n
=
where
λ
is a scalar.
3.6.2 Vector Addition and Subtraction
Given vectors
r
and
s
,
r
±
s
is defined as
⎡
⎤
⎡
⎤
⎡
⎤
x
r
y
r
z
r
x
s
y
s
z
s
x
r
±
x
s
⎣
⎦
,
⎣
⎦
⎣
⎦
.
r
=
s
=
then
r
±
s
=
y
r
±
y
s
z
r
±
z
s
Vector addition is commutative:
a
+
b
=
b
+
a
⎡
⎤
⎡
⎤
⎡
⎤
⎡
⎤
1
2
3
4
5
6
4
5
6
1
2
3
⎣
⎦
+
⎣
⎦
=
⎣
⎦
+
⎣
⎦
.
e.g.
However, like scalar subtraction, vector subtraction is not commutative
a
−
b
=
b
−
a
⎡
⎤
⎡
⎤
⎡
⎤
⎡
⎤
4
5
6
1
2
3
1
2
3
4
5
6
⎣
⎦
−
⎣
⎦
=
⎣
⎦
−
⎣
⎦
.
e.g.
3.7 Position Vectors
Given any point
P(x,y,z)
,a
position vector
p
is created by assuming that
P
is
the vector's head and the origin is its tail. Because the tail coordinates are
(
0
,
0
,
0
)
the vector's components are
x,y,z
. Consequently, the vector's length
|
p
|
equals