13.2: Transformation Matrix
- Page ID
- 65483
Consider the following set of points:
We can rotate these points around the origin by using the following simple set of equations:
\[ x \cos(\theta) - y \sin(\theta) = x_{rotated} \nonumber \]
\[ x \sin(\theta) + y \cos(\theta) = y_{rotated} \nonumber \]
This can be rewritten as the following system of matrices:
\[\begin{split}
\left[
\begin{matrix}
\cos(\theta) & -\sin(\theta) \\
\sin(\theta) & \cos(\theta)
\end{matrix}
\right]
\left[
\begin{matrix}
x \\
y
\end{matrix}
\right]
=
\left[
\begin{matrix}
x_{rotated}\\
y_{rotated}
\end{matrix}
\right]
\end{split} \nonumber \]
We can rotate the points around the origin by \(\pi/4\) (i.e. \(45^o\)) as follows:
We can even have a little fun and keep applying the same rotation over and over again.
In the above code what does the T
call in p[0].T
do?