How can I rotate a point 45 degrees counterclockwise around any point?

28.2k Views Asked by At

What is a formula (in terms of $x$ and $y$ coordinates) for rotating one point about another by $45$ degrees counterclockwise?

I've tried using: $$x'=x\cos(-45^{\circ})-y\cos(-45^{\circ})$$ $$y'=x\sin(-45^{\circ})+y\cos(-45^{\circ})$$

(I would, for instance, like to rotate rotate $(2, 1)$ by $-45^{\circ}$ degrees about $(2, 2)$)

3

There are 3 best solutions below

0
On
  1. Translate so that you are rotating about the origin. In your case, subtract (2,2) from both what you are rotating and what you are rotating about.
  2. Perform the rotation about the origin.
  3. Add the original translation back.
0
On

This can also be achieved nicely with complex numbers, using the fact that in multiplying complex numbers you multiply the lengths and add the angles. This means that to rotate a complex number $z$ by an angle $\theta$ about the origin you take $z\cdot(\cos\theta+i\sin\theta)$

To rotate $z$ by an angle $\theta$ about $w$, you would do $(z-w)\cdot(\cos\theta+i\sin\theta)+w$. (The subtracting and adding $w$ translates to and from the origin.)

In your example: $[(2+i)-(2+2i)]\cdot (-\frac{\sqrt{2}}{2}+i\frac{\sqrt{2}}{2})+(2+2i)$

0
On
  1. Translate the rotation center to the origin: $x'=x-x_c, y'=y-y_c$.

  2. Rotate around the origin: $x''=(x'-y')/\sqrt2, y''=(x'+y')/\sqrt2$.

  3. Translate back from the origin: $x'''=x''+x_c,y'''=y''+y_c$.