Rotation and Translation of Axes
Introduction
In my previous blog post “2D Plane Transformation”, we have discussed how to do 2D plane transformation in a Cartesian coordinate system, i.e., how to convert one point from one plane to the other in a Cartesian coordinate system. In some other situations, the points are fixed, and we would like to compute the coordinates of the same point in different Cartesian coordinate systems whose relationships are rotation and translation.
In this blog post, I would like to quickly discuss the rotation and translation of axes primarily focused on the 2D Cartesian coordinate systems.
Rotation and Translation of 2D Axes
Rotation of Axes
Suppose the $xy$ coordinate system rotates around the origin counterclockwise through an angle $\theta$, resulting in the $x^{\prime}y^{\prime}$ coordinate system.
In the $xy$ coordinate system, let the point $P$ have polar coordinates $(\gamma, \alpha)$. Then, in the $x^{\prime}y^{\prime}$ coordinate system, let the point $P$ have polar coordinates $(\gamma, \alpha - \theta)$.
$$
\begin{align}
x &= r \cos \alpha \\
y &= r \sin \alpha \\
\end{align}
$$
$$
\begin{align}
x^{\prime} &= r \cos (\alpha - \theta) = r \cos \alpha \cos \theta + r \sin \alpha \sin \theta \\
y^{\prime} &= r \sin (\alpha - \theta) = r \sin \alpha \cos \theta - r \cos \alpha \sin \theta \\
\end{align}
$$
Therefore, the coordinate transformation from the $xy$ coordinate system to the $x^{\prime}y^{\prime}$ coordinate system is
$$
\begin{align}
x^{\prime} &= x \cos \theta + y \sin \theta \\
y^{\prime} &= y \cos \theta - x \sin \theta \\
\end{align}
$$
or
$$
\begin{align}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & \sin \theta \\
-\sin \theta & \cos \theta \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
\end{bmatrix} \\
\end{align}
$$
To get the inverse transformation from the $x^{\prime}y^{\prime}$ coordinate system to the $xy$ coordinate system, we could compute the inverse transformation matrix which happens to be the transpose of the transformation matrix.
$$
\begin{align}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
\end{align}
$$
Alternatively, the inverse transformation could also be derived as follows.
$$
\begin{align}
x^{\prime} \sin \theta &= x \cos \theta \sin \theta + y \sin \theta \sin \theta \\
y^{\prime} \cos \theta &= y \cos \theta \cos \theta - x \sin \theta \cos \theta \\
\end{align}
$$
$$
\begin{align}
x^{\prime} \cos \theta &= x \cos \theta \cos \theta + y \sin \theta \cos \theta \\
y^{\prime} \sin \theta &= y \cos \theta \sin \theta - x \sin \theta \sin \theta \\
\end{align}
$$
Add or subtract the two equations, we have
$$
\begin{align}
x^{\prime} \sin \theta + y^{\prime} \cos \theta = y \cos \theta \cos \theta + y \sin \theta \sin \theta = y \\
x^{\prime} \cos \theta - y^{\prime} \sin \theta = x \cos \theta \cos \theta + x \sin \theta \sin \theta = x \\
\end{align}
$$
Therefore,
$$
\begin{align}
y = x^{\prime} \sin \theta + y^{\prime} \cos \theta \\
x = x^{\prime} \cos \theta - y^{\prime} \sin \theta \\
\end{align}
$$
Translation of Axes
Suppose the $xy$ coordinate system origin translates along a vector $(h, k)$, resulting in the $x^{\prime}y^{\prime}$ coordinate system.
The coordinate transformation from the $xy$ coordinate system to the $x^{\prime}y^{\prime}$ coordinate system is
$$
\begin{align}
x^{\prime} &= x - h \\
y^{\prime} &= y - k \\
\end{align}
$$
or
$$
\begin{align}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
&=
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
-
\begin{bmatrix}
h \\
k \\
\end{bmatrix}
\end{align}
$$
The inverse coordinate transformation from the $x^{\prime}y^{\prime}$ coordinate system to the $xy$ coordinate system is
$$
\begin{align}
x &= x^{\prime} + h \\
y &= y^{\prime} + k \\
\end{align}
$$
or
$$
\begin{align}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
&=
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
+
\begin{bmatrix}
h \\
k \\
\end{bmatrix}
\end{align}
$$
Rotation and Translation of Axes
The rotation of axes counterclockwise around the origin through an angle $\theta$ and translation of axes through an vector $(h, k)$ can be combined together into one transformation matrix.
The coordinate transformation from the $xy$ coordinate system to the $x^{\prime}y^{\prime}$ coordinate system is
$$
\begin{align}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & \sin \theta \\
-\sin \theta & \cos \theta \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
-
\begin{bmatrix}
h \\
k \\
\end{bmatrix} \\
&=
\begin{bmatrix}
\cos \theta & \sin \theta & -h \\
-\sin \theta & \cos \theta & -k \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
1 \\
\end{bmatrix} \\
\end{align}
$$
or
$$
\begin{align}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
1 \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & \sin \theta & -h \\
-\sin \theta & \cos \theta & -k \\
0 & 0 & 1 \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
1 \\
\end{bmatrix} \\
\end{align}
$$
The inverse coordinate transformation from the $x^{\prime}y^{\prime}$ coordinate system to the $xy$ coordinate system is
$$
\begin{align}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
+
\begin{bmatrix}
h \\
k \\
\end{bmatrix} \\
&=
\begin{bmatrix}
\cos \theta & -\sin \theta & h \\
\sin \theta & \cos \theta & k \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
1 \\
\end{bmatrix} \\
\end{align}
$$
or
$$
\begin{align}
\begin{bmatrix}
x \\
y \\
1 \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & -\sin \theta & h \\
\sin \theta & \cos \theta & k \\
0 & 0 & 1 \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
1 \\
\end{bmatrix} \\
\end{align}
$$
Relationship with 2D Coordinate Mapping
From my previous blog post “2D Plane Transformation”, we learned that in a Cartesian coordinate system the rotation of a point $(x, y)$ counterclockwise around the origin through an angle $-\theta$ and translation of the same point through an vector $(-h, -k)$ can be combined together into one transformation matrix. The resulting point $(x^{\prime}, y^{\prime})$ has the relationship with $(x, y)$ as follows.
The mapping from the point $(x, y)$ to the point $(x^{\prime}, y^{\prime})$ is
$$
\begin{align}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos (-\theta) & -\sin (-\theta) \\
\sin (-\theta) & \cos (-\theta) \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
+
\begin{bmatrix}
-h \\
-k \\
\end{bmatrix} \\
&=
\begin{bmatrix}
\cos \theta & \sin \theta \\
-\sin \theta & \cos \theta \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
-
\begin{bmatrix}
h \\
k \\
\end{bmatrix} \\
&=
\begin{bmatrix}
\cos \theta & \sin \theta & -h \\
-\sin \theta & \cos \theta & -k \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
1 \\
\end{bmatrix} \\
\end{align}
$$
or
$$
\begin{align}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
1 \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & \sin \theta & -h \\
-\sin \theta & \cos \theta & -k \\
0 & 0 & 1 \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
1 \\
\end{bmatrix} \\
\end{align}
$$
The inverse mapping from the point $(x^{\prime}, y^{\prime})$ to the point $(x, y)$ is
$$
\begin{align}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos (-\theta) & \sin (-\theta) \\
-\sin (-\theta) & \cos (-\theta) \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
-
\begin{bmatrix}
-h \\
-k \\
\end{bmatrix} \\
&=
\begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
\end{bmatrix}
+
\begin{bmatrix}
h \\
k \\
\end{bmatrix} \\
&=
\begin{bmatrix}
\cos \theta & -\sin \theta & h \\
\sin \theta & \cos \theta & k \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
1 \\
\end{bmatrix} \\
\end{align}
$$
or
$$
\begin{align}
\begin{bmatrix}
x \\
y \\
1 \\
\end{bmatrix}
&=
\begin{bmatrix}
\cos \theta & -\sin \theta & h \\
\sin \theta & \cos \theta & k \\
0 & 0 & 1 \\
\end{bmatrix}
\begin{bmatrix}
x^{\prime} \\
y^{\prime} \\
1 \\
\end{bmatrix} \\
\end{align}
$$
Therefore, the point coordinates transformation from one Cartesian coordinate system to another Cartesian coordinate system that is rotated counterclockwise around the origin through an angle $\theta$ and translated through an vector $(h, k)$ is equivalent as the point is rotated counterclockwise around the origin in the original Cartesian coordinate system through an angle $-\theta$ and translated through an vector $(-h, -k)$.
References
Rotation and Translation of Axes