| |
|
|
||||
![]() |
||||||
| |
|
|||||
|
Complex Matrix Transformations A Naming Scheme for Transform Matrices In the first section we defined a matrix transform (figures 2 and 3) from reference frame 1 to reference frame 0 by expressing the vectors of frame 1 in frame 0. Let's name it M1to0 to make the reference frames it transforms between explicit. When we start to introduce new reference frames, as in figure 5, this name will be very handy.
These frames could represent the successive joints of a robot arm or an animation skeleton. Suppose the problem is to find P2 in the space of the zero frame. We'll call this point P0. We can now write out the answer to this problem using our naming scheme for matrices, keeping in mind the order of multiplication between row vectors and matrices and column vectors and matrices.
Substituting P1 into the equation for P0:
We have been consistent with the way column vectors are multiplied with matrices by keeping the column vectors to the right of the transform matrices.
We have been consistent with the way row vectors are multiplied with matrices by keeping the row vectors to the left of the transform matrices. So the problem has been reduced to finding the transform matrices, and already we have accomplished a lot. We established a convention for naming points in space by the reference frame that they are in (P0, P1). We named matrices for the reference frames that they transform between (M1to0, M2to1). And finally, we leveraged the naming scheme to write out a mathematical expression for the correct answer. There is no ambiguity regarding the order of the matrices or which matrices we need to find.
Figure 6 shows the translation vectors between the frames. With the new information in the figure, we can plug into the matrices from figures 1 and 2 to get the needed transform matrices.
P0
= M1to0 * M2to1 * P2
P0
= P2 * M2to1 * M1to0
If we reversed the problem and needed to find point P2 given point P0 we could solve it using the same method. We would quickly find that we need the matrices M0to1 and M1to2 and we can get them using matrix inversion.
Again, we write the equation for P2 given P0, M1to0, and M2to1 by allowing the naming scheme to guide the order of the matrix concatenation.
And group the matrices together to illustrate the naming scheme for concatenated matrices.
So when multiplying matrices together using this naming scheme you just chain the reference frame names together.
These matrix derivations make excellent comments in the code that can save the person who reads your code lots of time.
|
||||||||||||||
|
|