<p>I think that I see what you mean. For me, the correct &quot;change of basis&quot;, going from <span class="math-container">$(x,y)$</span> to <span class="math-container">$(u,v)$</span> does not take into account a &quot;translation&quot; 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).</p>
<p>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:
<span class="math-container">$$\begin{bmatrix}
 x_p\\
 y_p
\end{bmatrix}
=  \begin{bmatrix}
 x_u&amp; x_v \\
 y_u&amp; 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}$$</span></p>
<p>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:
<span class="math-container">$$\begin{bmatrix}
 x_p\\
 y_p\\
1
\end{bmatrix}
=  \begin{bmatrix}
 x_u&amp; x_v&amp;x_e \\
 y_u&amp; y_v&amp;y_e \\
0&amp;0&amp;1\\
\end{bmatrix}
\begin{bmatrix}
 u_p\\v_p\\1
\end{bmatrix}$$</span>
(For 3D basis, it would lead to matrices with 4x4 components.)</p>
<p>I hope that it helps?</p>
<p>[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 <span class="math-container">$R$</span> matrix that I have written earlier:
<span class="math-container">$$R_{uv}=\begin{bmatrix}
 x_u&amp;y_u \\
 x_v&amp; y_v \\
\end{bmatrix}  $$</span> this matrix can express the coordinates from (xy) frame to the (uv) frame:
<span class="math-container">$$\begin{bmatrix} u_u\\ v_u\end{bmatrix}=  \begin{bmatrix} x_u&amp;y_u \\
 x_v&amp; y_v \\  \end{bmatrix}\begin{bmatrix} x_u\\y_u\end{bmatrix} =\begin{bmatrix}
 1\\0
\end{bmatrix}$$</span>
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
<span class="math-container">$$\begin{bmatrix} x_{x}\\ y_{x}\end{bmatrix}=  \begin{bmatrix} x_u&amp;y_u \\
 x_v&amp; y_v \\  \end{bmatrix}\begin{bmatrix} x_u\\y_u\end{bmatrix}$$</span>
<span class="math-container">$$
\mathbf{x}=R\,\mathbf{u}
$$</span></p>

CC BY-SA 4.0
2022-03-29T17:17:35.743Z
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.
Essam
CC BY-SA 4.0
2022-03-29T18:07:56.490Z
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.
hdupont
CC BY-SA 4.0
2022-03-29T19:49:36.380Z
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.
Essam
CC BY-SA 4.0
2022-03-28T21:55:24.547Z
2022-03-29T21:22:58.673Z
2022-03-29T21:22:58.673Z
hdupont
<p>I'm studying coordinate transformations from the book Fundamentals Of Computer Graphics - Peter Shirley, Steve Marschner</p>
<p>The book first shows
<a href="https://i.sstatic.net/c7Rdh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c7Rdh.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/F0yMx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/F0yMx.png" alt="enter image description here" /></a></p>
<p>It then says: &quot;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.&quot;</p>
<p>Really confused by this since
<a href="https://i.sstatic.net/kStgf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kStgf.png" alt="enter image description here" /></a></p>
<p>and it seems like we get a contradiction if we let the shift be 0 for the images above.</p>
<p>Is something really wrong or am I missing something?</p>
<p>Thank you.</p>

CC BY-SA 4.0
2022-03-29T17:26:43.313Z
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.
Nathan Reed
<transformations>
Confused with Coordinate Transformations
Essam
# Confused with Coordinate Transformations

(Asked by: username_0 on 2022-03-28)

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

The book first shows
[![enter image description here](https://i.sstatic.net/c7Rdh.png)](https://i.sstatic.net/c7Rdh.png)

[![enter image description here](https://i.sstatic.net/F0yMx.png)](https://i.sstatic.net/F0yMx.png)

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](https://i.sstatic.net/kStgf.png)](https://i.sstatic.net/kStgf.png)

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.

**Tags:** transformations

> **Comments:**
> **username_1**: 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.  

---

## 1 answers

### Answer by username_2 on 2022-03-28. Score: 1 | Accepted answer

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}
$$

> **Comments:**
> **username_0**: 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.  
> **username_2**: 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.  
> **username_0**: 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.  

---

