I am trying to understand the idea behind rotating in quaternions, but first I want to understand the math for 2d rotation. I saw some youtube videos, and I know that for 2D, a point in 2D can be represented like
$a + bi$ which maps to the $(x,y)$ coordinate $(a,b)$. Then lets say I want to rotate it 90 degrees. I would multiply $a + bi$ by $i$. So for example, if I had the point (3,3) so that's $3+3i$ then rotate it 90 degrees, I do
$(3+3i)i = 3i+3i^2 = 3i-3$ (since $i^2=-1$)
so that's $-3+3i$ giving the point $(-3,3)$ which is a $90$ degree rotation of the original point $(3,3)$.
But what was not explained and what I don't get is, how to rotate by an arbitrary angle from 0 to 360? Like lets say I want to rotate by 20 or 45 degrees, what would I multiply the $a + bi$ with?
Can anyone explain?
Thanks
Consider the complex number $r=\cos \theta + i \sin \theta$, such that $|r|=1$.
For a complex number $z=x+iy$ we have:
$$ rz=(\cos \theta + i \sin \theta)(x+iy)=x\cos \theta -y\sin \theta+i(x \sin \theta+ y \cos \theta) $$
If we interpret $z$ as the vector ${\bf z}=(x,y)^T$ we can write this result as: $$ {\bf z'}= r\begin{bmatrix} \cos \theta & -\sin \theta\\ \sin \theta& \cos \theta \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix} $$ and we can see that the matrix represents a rotation of angle $\theta$, because the first column is the rotation of ${\bf i}=(1,0)$ and the second is the rotation of ${\bf j}=(0,1)$, that are the standard basis of the vectors in a plane.