Expressing Points in Different Coordinate Systems

(Note:  This page is best viewed in colour!)

Consider Figure 1 with two coordinate frames shown below.  You want to transform a point in coordinate frame B to a point in coordinate frame A.

Figure 1

The two coordinate frames have aligned axes with the same scale, so the transformation between the two frames is a translation.  To get some intuition, consider point P.  P_B (P in frame B) is (-1,4).  P_A is (4,2).  The translation between the two points is (5,-2).  Notice that this is the same translation that would align frame A with frame B.  Indeed, the transformation that aligns the target frame with the initial frame is the same transformation that will transform a point in the initial frame to a point in the target frame.  The necessary transformation is M_BtoA is trans(5,-2).  Confirm this with the test point:  P_A = M_BtoA * P_B     Let's look at another example:

Figure 2:  Frame A is shown in black and Frame B is shown in red.  The scale of the two frames is the same.  The length of the axes has been varied simply to make them visible.

The problem is the same:  What is the transformation M_BtoA that will map a point from frame B into a point represented in frame A.  The same approach can be applied.  How is frame A transformed into frame B?  The transformation rot(z, -90) does the job.  This same transformation can be applied to map a point in frame B to a point in frame A.  So M_BtoA is:

 0   1   0

-1  0  0

  0  0  1

Point P_B is (1,2).  Applying the transformation gives P_A (2,-1).

Lets look at a more complicated example in Figure 3.

Figure 3

The problem statement is the same, compute M_BtoA that will map a point represented in frame B to a point represented in frame A.  The two axes differ by both a rotation and a translation.  There are two different ways to break down the problem.  They will bet you the same answer in the end, but the actual transformation used to generate the complete transformation matrix may be different.  Lets start by looking at the first method.

Method 1

The same approach applies, but we break the procedure into two steps.  We will introduce an intermediate frame C.  This frame is a translation away from frame B and a rotation away from frame A.  We chose the intermediate frame so that it is one basic operation away from our initial frame and brings us closer to our final target  (In this case, by aligning the origins of the two frames.) We first solve M_BtoC.  This is equivalent to asking if B is our reference frame, what transformation of C will align it with B?  The answer is trans(1,4).  The next step is how to determine the transformation M_CtoA.  This is the same as asking how to align frame A with frame C (C is your reference frame.  One answer is rot(z,180).  Combining these two results gives M_BtoA = M_CtoA * M_BtoC or:

-1  0  -1              -1   0  0           1  0  1

 0  -1  -4    =        0  -1  0      *   0  1  4

 0   0   1               0   0   1           0  0  1

Method 2

There is another way of looking at this which I find a little simpler, but if you are happy with the above, and worried about getting confused, skip to the problem below!  In this approach, we are thinking of things in exactly the same way we were when were simply positioning an object in world space.  Here the reference frame is A (you can think of this in the same way you think of the world space frame).  This is the frame in which you do all your operations. This frame does not move.  Now, think of the axes of A as an object in frame A (like we did with the house) that you want to move to line up with the axes of B (also represented in frame A coords).  To align A with B in A's frame, you first need to rot(z,180).  This brings the axes to where C is, but remember, we are just dealing with the axes as an object.  Frame A remains unchanged.  Now we have to trans(-1,-4) to move our object C to align with B. This gives: trans(-1,-4)*rot(z,180), which will yield the same final matrix as Method 1 above. Confirm this as an exercise.


OK, to see that you have followed the above, try the following example.  Find M_BtoA:

Figure 4


Calculate your answer.  Test it with some well chosen points to confirm that you trust your answer.  Once that is done, check that your answer is:  rot(z,90)trans(-2,-5)  This can also be arrived at as trans(5,-2)rot(z,90) and gives the matrix, in rows, 0 -1 5, 1 0 -2, 0 0 1.  What happens if you add in scale?

Good luck with the assignment!