1
$\begingroup$

I'm studying coordinate transformations from the book Fundamentals Of Computer Graphics - Peter Shirley, Steve Marschner

The book first shows enter image description here

enter image description here

It then says: "We call this matrix the frame-to-canonical matrix for the (u, v) frame. It takes points expressed in the (u,v) frame and converts them to the same points ex- pressed in the canonical frame."

Really confused by this since enter image description here

and it seems like we get a contradiction if we let the shift be 0 for the images above.

Is something really wrong or am I missing something?

Thank you.

$\endgroup$
1
  • $\begingroup$ Can you explain more what is the contradiction you see? I'm not quite following what the problem is. BTW, note that the second excerpt is considering a 3D linear transformation (i.e. no translation), and the first excerpt is a 2D affine transformation (3rd column of the matrix is translation), so these two matrices have different interpretations even though they are both 3×3. $\endgroup$ Commented Mar 29, 2022 at 17:26

1 Answer 1

1
$\begingroup$

I think that I see what you mean. For me, the correct "change of basis", going from $(x,y)$ to $(u,v)$ does not take into account a "translation" of the basis into another: the origin of the basis is ignored (it is not even in the definition of what a basis is). So the second paragraph is the most accurate mathematically speaking: the only thing that matters is the rotation between the basis vectors (assuming all basis vectors have the same length).

However, in practice in Graphics, it is more convenient to attach different basis to different origins points. To account for that, you now need the first formula, which is a change of basis plus a translation: $$\begin{bmatrix} x_p\\ y_p \end{bmatrix} = \begin{bmatrix} x_u& x_v \\ y_u& y_v \\ \end{bmatrix} \begin{bmatrix} u_p\\v_p \end{bmatrix} + \begin{bmatrix} x_e\\y_e \end{bmatrix} = R \begin{bmatrix} u_p\\v_p \end{bmatrix} + \begin{bmatrix} x_e\\y_e \end{bmatrix}$$

This writting is quite heavy, so an additional component is usually used to add translation transformations, and that leads to the formula that is in the book: $$\begin{bmatrix} x_p\\ y_p\\ 1 \end{bmatrix} = \begin{bmatrix} x_u& x_v&x_e \\ y_u& y_v&y_e \\ 0&0&1\\ \end{bmatrix} \begin{bmatrix} u_p\\v_p\\1 \end{bmatrix}$$ (For 3D basis, it would lead to matrices with 4x4 components.)

I hope that it helps?

[edit] Also, the confustion can come from the fact that the matrix R can be seen in two ways: a tool to express the coordinates in another basis, or a transformation matrix (a rotation). Therefore, if you use this time the transpose of the $R$ matrix that I have written earlier: $$R_{uv}=\begin{bmatrix} x_u&y_u \\ x_v& y_v \\ \end{bmatrix} $$ this matrix can express the coordinates from (xy) frame to the (uv) frame: $$\begin{bmatrix} u_u\\ v_u\end{bmatrix}= \begin{bmatrix} x_u&y_u \\ x_v& y_v \\ \end{bmatrix}\begin{bmatrix} x_u\\y_u\end{bmatrix} =\begin{bmatrix} 1\\0 \end{bmatrix}$$ but it can also be used as a tranformation in the (xy) frame that would rotate the vector u to the vector x, and the vector v to the vector y $$\begin{bmatrix} x_{x}\\ y_{x}\end{bmatrix}= \begin{bmatrix} x_u&y_u \\ x_v& y_v \\ \end{bmatrix}\begin{bmatrix} x_u\\y_u\end{bmatrix}$$ $$ \mathbf{x}=R\,\mathbf{u} $$

$\endgroup$
3
  • $\begingroup$ I think your first equation contradicts what I have highlighted in yellow. (By comparing the R matrices and assuming that the origins coincide i.e. shift is zero.) That is, the R you proposed is the transpose of the R highlighted in yellow but both seem to takes from uv frame to xy frame and that is my problem. $\endgroup$
    – Essam
    Commented Mar 29, 2022 at 17:17
  • $\begingroup$ I don't think so, the R highlighted (indeed the transpose of mine) goes from the xy frame to the uv frame. As you can see in your example, u=(x_u,y_u) is written in the (xy) frame, and it becomes (1,0), so u in the uv frame. However, another way of seeing R matrices is to say that instead of being used to "translate" the coordinate in a different basis, it can also be seen as a real tranformation. If you had a vector u (in xy frame), and you apply this matrix, it would rotate the vector to (1 0), so it would rotate the vectore u to the vector x, all of their coordinates being in the xy frame. $\endgroup$
    – hdupont
    Commented Mar 29, 2022 at 18:07
  • $\begingroup$ Okay. I think it's getting better will make sure I'm understanding your explanation and may come back in case of a question. Thank you. $\endgroup$
    – Essam
    Commented Mar 29, 2022 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.