Can't fully understand coordinate system transformation

79 Views Asked by At

I'm following a course on edX for Computer Graphics: edX and got stuck on a topic related to change of coordinate systems.

The problem proposed is this: Given a $\mathbb{R^2}$ point defined on the canonical $(x,y)$ axis, $\vec{i}=(2,2)$, what are the coordinates in a new coordinate system with the origin at $\vec{j}=(1,1)$, and axes at $45^\circ$? (The rotated first axis will be aligned to $(1,1)$ in an unrotated coordinate system, with an origin at $\vec{j}$). Denote this changed vector as $\vec{k}$

The expected response is $\vec{k}=(1.42,0)$, the explanation says:

We can shift our coordinate frame from the canonical $(x,y)$ axis to the new axis defined above by translating the origin, and rotating the axis at the new origin. We will translate our origin by $−\vec{j}$, and rotate our axes by $45^\circ$. In this representation, $\vec{i}$ lies along our new $x$ axis, so there is no component on our new $y$ axis. The $x$ component is therefore the distance between the translated point and the origin, $\left|\vec{i}-\vec{j}\right| = \left|\left( \begin{array}{c} 1 \\ 1 \end{array} \right) \right| = \sqrt{1^2 + 1^2} = \sqrt{2} = 1.414$

I thought the rotation of points was counter-clockwise and the rotation of axes was clockwise, so it would be $-45^\circ$, right?.

My approach:

Let $\vec{u}$ be a vector with same direction as $x$ and $\vec{v}$ a vector with same direction as $y$. I translated the origin of $(\vec{u}, \vec{v})$ to $(0x, 0y)$, and rotated it by $-45^\circ$ which gives me $\vec{u}=(0.71, -0.71), \vec{v}=(0.71, 0.71)$. I then constructed the transformation matrix using $\vec{u}$ and $\vec{v}$ as columns and multiplied it by $\vec{i}$, which is my understanding it should give me the coordinates of $\vec{i}$ with respect to the $(\vec{u}, \vec{v})$ coordinate frame. But my answer differs from the expected answer, and I fail to understand why the demonstration chose that approach (rotate counter-clockwise) and why I couldn't reach the same result.