Game Development Reference
In-Depth Information
Specifying the orientation of a coordinate space in 3D is only slightly
more complicated. The axes are vectors (directions), and can be specified
like any other direction vector. Going back to our robot example, we could
describe her orientation by telling what directions the green vectors labeled
+x and +y were pointing—these are the axes of the robot's object space.
(Actually, we would use vectors with unit length. The axes in the diagrams
were drawn as large as possible, but, as we see in just a moment, unit vectors
are usually used to describe the axes.) Just as with position, we do not
use the object space itself to describe the object-space axis directions, since
those coordinates are [1,0] and [0,1] by definition. Instead, the coordinates
are specified in upright space. In this example, unit vectors in the +x and
+y object-space directions have upright-space coordinates of [0.87,0.50] and
[−0.50,0.87], respectively.
What we have just described is one way to specify the orientation of
a coordinate space, but there are others. For example, in 2D, rather than
listing two 2D vectors, we could give a single angle. (The robot's object axes
are rotated clockwise 30 o relative to the upright axes.) In 3D, describing
orientation is considerably more complicated, and in fact we have devoted
all of Chapter 8 to the subject.
We specify a coordinate space by describing its origin and axes. The origin
is a point that defines the position of the space and can be described just
like any other point. The axes are vectors and describe the orientation of
the space (and possibly other information such as scale), and the usual tools
for describing vectors can be used. The coordinates we use to measure the
origin and axes must be relative to some other coordinate space.
3.3.3
Basis Vectors
Now we are ready to actually compute some coordinate space transforms.
We start with a concrete 2D example. Let's say that we need to know the
world-space coordinates of the light that is attached to the robot's right
shoulder. We start with the object-space coordinates, which are (−1,5).
How do we get the world-space coordinates? To do this, we must go back to
the beginning and poke deeper into some ideas that are so fundamental as
to be taken for granted. How do we locate a point indicated by a given set of
Cartesian coordinates? Let's say we needed to give step-by-step directions
for how to locate the light to somebody who didn't know how Cartesian
coordinates worked. We would say:
 
Search WWH ::




Custom Search