3.4 Change of Coordinate Transformations
The scalar 100º C represents the temperature of boiling water relative to the Celsius scale. How do we describe the same temperature of boiling water relative to the Fahrenheit scale? In other words, what is the scalar, relative to the Fahrenheit scale, that represents the temperature of boiling water? To make this conversion (or change of frame), we need to know how the Celsius and Fahrenheit scales relate. They are related as follows:
. Therefore,
; that is, the temperature of boiling water is 212º Fahrenheit.
This example illustrates that we can convert a scalar k that describes some quantity relative to a frame A into a new scalar k′ that describes the same quantity relative to a different frame B, provided that we know how frame A and B are related. In the following subsections, we look at a similar problem, but instead of scalars, we are interested in converting the coordinates of a point/vector relative to one frame into coordinates relative to a different frame (see Figure 3.8). We call the transformation that converts coordinates from one frame into coordinates of another frame a change of coordinate transformation.

Figure 3.8: The same vector v has different coordinates when described relative to different frames.
It is worth emphasizing that in a change of coordinate transformation, we do not think of the geometry as changing; rather, we are changing the frame of reference, which thus changes the coordinate representation of the geometry. This is in contrast to how we usually think about rotations, translations, and scaling, where we think of actually physically moving or deforming the geometry.
In 3D computer graphics, since we employ multiple coordinate systems, we need to know how to convert from one to another. Because location is a property of points, but not of vectors, the change of coordinate transformation is different for points and vectors.
3.4.1 Vectors
Consider Figure 3.9 in which we have two frames, A and B, and a vector p. Suppose we are given the coordinates pA = (x, y) of p relative to frame A, and we wish to find the coordinates pB = (x′, y′) of p relative to frame B. In other words, given the coordinates identifying a vector relative to one frame, how do we find the coordinates that identify the same vector relative to a different frame?

Figure 3.9: The geometry of finding the coordinates of p relative to frame B.
From Figure 3.9, it is clear that

where u and v are unit vectors that aim, respectively, along the x- and y-axes of frame A. Expressing each vector in the above equation in frame B coordinates we get:

Thus, if we are given pA = (x, y) and we know the coordinates of the vectors u and v relative to frame B, that is if we know uB = (ux, uy) and vB = (vx, vy), then we can always find pB = (x′, y′).
Generalizing to 3D, if pA = (x, y, z), then
where u, v, and w are unit vectors that aim, respectively, along the x-, y-and z-axes of frame A.
3.4.2 Points
The change of coordinate transformation for points is slightly different from the one for vectors; this is because location is important for points, so we cannot translate points as we translated the vectors in Figure 3.9.
Figure 3.10 shows the situation, and we see that the point p can be expressed by the equation:

where u and v are unit vectors that aim, respectively, along the x- and y-axes of frame A, and Q is the origin of frame A. Expressing each vector/point in the above equation in frame B coordinates we get:

Generalizing to 3D, if pA = (x, y, z), then

where u, v, and w are unit vectors that aim, respectively, along the x-, y- and z-axes of frame A, and Q is the origin of frame A.
3.4.3 Matrix Representation
To review so far, the vector and point change of coordinate transformations are:

If we use homogeneous coordinates, then we can handle vectors and points by one equation:

If w = 0, then this equation reduces to the change of coordinate transformation for vectors; if w = 1, then this equation reduces to the change of coordinate transformation for points. The advantage of Equation 3.1 is that it works for both vectors and points, provided we set the w-coordinates correctly; we no longer need two equations (one for vectors and one for points). Equation 2.3 says that we can write Equation 3.1 in the language of matrices:

where QB = (Qx, Qy, Qz, 1), uB = (ux, uy, uz, 0), vB = (vx, vy, vz, 0), and wB = (wx, wy, wz, 0) describe the origin and axes of frame A with homogeneous coordinates relative to frame B. We call the 4×4 matrix in Equation 3.2 a change of coordinate matrix or change of frame matrix, and we say it converts (or maps) frame A coordinates into frame B coordinates.
3.4.4 Associativity and Change of Coordinate Matrices
Suppose now that we have three frames, F, G, and H. Moreover, let A be the change of frame matrix from F to G, and let B be the change of frame matrix from G to H. Suppose we have the coordinates pF of a vector relative to frame F and we want the coordinates of the same vector relative to frame H, that is, we want pH. One way to do this is step-by-step:

However, because matrix multiplication is associative, we can instead rewrite (pFA)B = p H as:

In this sense, the matrix product C = AB can be thought of as the change of frame matrix from F directly to H; it combines the effects of A and B into a net matrix. (The idea is like composition of functions.)
This has performance implications. To see this, assume that a 3D object is composed of 20,000 points and that we want to apply two successive change of frame transformations to the object. Using the step-by-step approach, we would require 20,000×2 vector-matrix multiplications. On the other hand, using the combined matrix approach requires 20,000 vector-matrix multiplications and one matrix-matrix multiplication to combine the two change of frame matrices. The one extra matrix-matrix multiplications is a cheap price to pay for the large savings in vector-matrix multiplications.

3.4.5 Inverses and Change of Coordinate Matrices
Suppose that we are given pB (the coordinates of a vector p relative to frame B), and we are given the change of coordinate matrix M from frame A to frame B; that is, pB = pAM. We want to solve for pA. In other words, instead of mapping from frame A into frame B, we want the change of coordinate matrix that maps us from B into A. To find this matrix, suppose that M is invertible (i.e., M−1 exists). We can solve for pA like so:
|
pB = pAM |
|
|
pBM−1 = pAMM−1 |
Multiply both sides of the equation by M−1. |
|
pBM−1 = pAI |
MM−1 = I, by definition of inverse. |
|
pBM−1 = pA |
pAI = pA, by definition of the identity matrix. |
Thus the matrix M−1 is the change of coordinate matrix from B into A.
Figure 3.11 illustrates the relationship between a change of coordinate matrix and its inverse. Also note that all of the change of frame mappings that we do in this book will be invertible, so we won’t have to worry about whether the inverse exists.




浙公网安备 33010602011771号