Graphics Reference
In-Depth Information
to get a new point, and more generally, affine combinations of points, that is,
combinations of the form
α
1
P
1
+
α
2
P
2
+
...
+
α
k
P
k
,
(10.61)
were allowed if and only if
α
k
=
1.
We now have a situation in which these distinctions make sense in terms of
familiar mathematics: We can regard
points
of the plane as being elements of
R
3
whose third coordinate is 1, and
vectors
as being elements of
R
3
whose third
coordinate is 0.
With this convention, it's clear that the difference of points is a vector, the sum
of a vector and a point is a point, and combinations like the one in Equation 10.61
yield a point if and only if the sum of the coefficients is 1 (because the third
coordinate of the result will be exactly the sum of the coefficients; for the sum to
be a
point,
this third coordinate is required to be 1).
You may ask, “Why, when we're already familiar with vectors in 3-space,
should we bother calling some of them 'points in the Euclidean plane' and others
'two-dimensional vectors'?” The answer is that the distinctions have geometric
significance when we're using this subset of 3-space as a model for 2D transfor-
mations. Adding vectors in 3-space is defined in linear algebra, but adding together
two of our “points” gives a location in 3-space that's not on the
w
=
1 plane or
the
w
=
0 plane, so we don't have a name for it at all.
Henceforth we'll use
E
2
(for “Euclidean two-dimensional space”) to denote
this
w
=
1 plane in
xyw
-space, and we'll write
(
x
,
y
)
to mean the point of
E
2
α
1
+
α
2
+
...
+
⎡
⎣
⎤
x
y
1
⎦
. It's conventional to speak of an affine
corresponding to the 3-space vector
transformation as acting on
E
2
, even though it's defined by a 3
×
3 matrix.
10.6 Why Use 3
3 Matrices Instead
of a Matrix and a Vector?
×
Students sometimes wonder why they can't just represent a linear transformation
plus translation in the form
T
(
x
)=
Mx
+
b
,
(10.62)
where the matrix
M
represents the linear part (rotating, scaling, and shearing) and
b
represents the translation.
First, you
can
do that, and it works just fine. You might save a tiny bit of
storage (four numbers for the matrix and two for the vector, so six numbers instead
of nine), but since our matrices always have two 0s and a 1 in the third column, we
don't really need to store that column anyhow, so it's the same. Otherwise, there's
no important difference.
Second, the reason to unify the transformations into a single matrix is that it's
then very easy to take multiple transformations (each represented by a matrix)
and
compose
them (perform one after another): We just multiply their matrices
together in the right order to get the matrix for the composed transformation. You
can do this in the matrix-and-vector formulation as well, but the programming is
slightly messier and more error-prone.