Once
we have both coordinate systems, we will do the transformation. In order to do
the transformation, let’s start with some basic math. We already know about
points can be represented as its coordinate, now we introduce vector. A vector
is simply an arrow (i.e. its direction) with a length (i.e. its magnitude). It
is floating in the space so we can move it around. Given two points, we can have
a vector, represented as this simple equation:
Point – Point =
Vector
So
vector is also just an ordered list of numbers with the same dimension as
points do.
It
also make sense to play with the vector’s length by scaling it, in particular,
we have this, meaning the length is scaled by s
Vector = s (as a
Positive Real Number) * Vector
As
well as reversing direction
Vector = -1 * Vector
For
anyone who knew about vector in their math course, this would sound trivial,
now let’s add some new convention here that is particularly useful. Since
vector and point are both represented as an ordered list of numbers, there is
no way to distinguish points from vectors, which could be a problem, so let’s
add 1 dimension to the list at the end of the list of numbers, with points ends
with 1 and vector ends with 0. Note that if we treat the last dimension just
like any other dimensions, we have a nice type checking property – if the last
dimension is 0 or 1, the operation is valid, otherwise, it isn’t. For example,
it make no sense to add two points by coordinates, so it ends up with a list of
numbers ending with 2. We call this new representation homogeneous coordinates and we’ll see this is particularly useful
later on.
No comments :
Post a Comment