How do you do a 90 degree counter-clockwise rotation around a point? I know around the origin it's $(-y,x)$, but what would it be around a point?
$$(-y - a,x - b)$$ Where $(a,b)$ is the rotation point.
How do you do a 90 degree counter-clockwise rotation around a point? I know around the origin it's $(-y,x)$, but what would it be around a point?
$$(-y - a,x - b)$$ Where $(a,b)$ is the rotation point.
Subtract the point, rotate around origin, add the point back:
$$(-(y-b)+a, (x-a) + b)$$
Given any point $p=\left[ \begin{array}{ccc} x \\ y \end{array} \right]$ and a center of rotation $c=\left[ \begin{array}{ccc} a \\ b \end{array} \right]$ we can construct the vector $\vec{d}=p-c$ which is the vector that goes from $p$ to $c$.
Then we can create a rotation matrix $T=\left[ \begin{array}{ccc} \cos{\theta} & -\sin{\theta} \\ \sin{\theta} & \cos{\theta} \end{array} \right] $ where $\theta$ is the counter-clockwise rotation angle.
Then the rotated point $p'$ is given by
$$p'=T\vec{d}+c$$
For your example, $\vec{d}=\left[\begin{matrix} x-a\\ y-b \end{matrix}\right]$, $T=\left[\begin{matrix} 0 & -1 \\ 1 & 0 \end{matrix}\right]$ and $c=\left[\begin{matrix} a\\ b \end{matrix}\right]$, so
$$p'= \left[\begin{matrix} b-y\\ x-a \end{matrix}\right]+\left[\begin{matrix} a\\ b \end{matrix}\right]=\left[\begin{matrix} a+b-y\\ x+b-a \end{matrix}\right]$$