Graphics Reference
In-Depth Information
B.1.1
Addition and Subtraction
Vectors add the way we expect displacements to. If we “walk 10 steps in direction
A
” and then “walk 5 steps in direction
B
,” we can achieve the same instructions by
walking toward the two displacements tail to head (see
Figure B.1
)
Subtraction
works by “unwalking” and has the expected behavior (see
Figure B.2
)
.
V
b
V
b
B.1.2
Cartesian Coordinates
Figure B.1.
Vector addi-
We often organize directions in the world according to three “special” directions.
These are sometimes east/west, north/south, and up/down. Or with respect to one-
self, left/right, front/back, and up/down. We usually call these special directions
the
x
-,
y
-, and
z
-axes. These can be represented as unit-length vectors
V
x
,
V
y
,
and
V
z
that are mutually perpendicular. Their ordering by convention follows the
right-handed coordinate system (see Figure 13.5).
tion.
V
a
-
V
b
We can uniquely identify a vector by its length measured along the
x
-,
y
-, and
z
-axes. For example, a vector
V
a
is just a weighted sum of the Cartesian vectors
and the origin
(
Figure B.3
)
:
V
a
=(
V
b
+(
V
a
-
V
b
))
Figure B.2.
Vector sub-
traction.
V
a
=
x
a
V
x
+
y
a
V
x
+
z
a
V
z
.
Y-axis
(2.2, 3)
As discussed in Section 8.5.1, we can view the Cartesian vectors as implicit and
shared between all vectors and just use a triple of numbers to represent
V
a
:
V
a
=
x
a
y
a
z
a
.
3
V
y
V
y
2.2
V
x
X-axis
A point can also be represented by a vector, but it means interpreting the vector
as a displacement from an origin point
O
. Note that if we have a vector
V
c
=
V
a
+
V
x
Figure B.3.
Cartesian
V
b
, then we can derive its components by just adding them:
coordinates.
x
c
=
x
a
+
x
b
,
y
c
=
y
a
+
y
b
,
z
c
=
z
a
+
z
b
.
Similarly, subtraction of components corresponds to subtraction of vectors:
x
a
=
x
c
−
x
b
,
y
a
=
y
c
−
y
b
,
z
a
=
z
c
−
z
b
.
(B.1)
or
x
a
y
a
z
a
=
x
c
y
c
z
c
−
x
b
y
b
z
b
,
or
=
−
V
b
.
V
a
V
c
Search WWH ::
Custom Search