4
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ @S.C.B. whoever edited it, is that the right answer? $\endgroup$
    – lol
    Feb 10, 2017 at 16:25
  • $\begingroup$ No, I just reformatted yours. $\endgroup$
    – S.C.B.
    Feb 10, 2017 at 16:25
  • $\begingroup$ got it. thanks. $\endgroup$
    – lol
    Feb 10, 2017 at 16:25

2 Answers 2

7
$\begingroup$

Subtract the point, rotate around origin, add the point back:

$$(-(y-b)+a, (x-a) + b)$$

$\endgroup$
2
$\begingroup$

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]$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.