Find the coordinates of a rectangle rotated with angle $α$

442 Views Asked by At

I would like to find the coordinates of the points $A, B, C, D$ that represent the coordinates of the rectangle drown on the line that starts from $(c_x, c_y)$ and its lenght is $w$. I know rectangle dimensions $(w, h)$ and the angle $α$.

To be honest, I don't know how to start. Can you suggest me something? Thanks a lot!

2

There are 2 best solutions below

0
On BEST ANSWER

While I agree with @user's answer, there are some details that can be added. Firstly, according to the picture, the sign convention for the rotation is opposite of that of the normal convention. Therefore, we must replace $\alpha$ with $-\alpha$. Now, for any point described by coordinates $(x,y)$, the rotated point $(x', y')$ is $$ \left( \begin{array}{c} x' \\ y' \end{array} \right) = \left[ \begin{array}{cc} \cos \alpha & \sin \alpha \\ -\sin {\alpha} & \cos \alpha \end{array} \right] \left( \begin{array}{c} x \\ y \end{array} \right) = \left( \begin{array}{c} \cos \alpha \cdot x + \sin \alpha \cdot y \\ -\sin \alpha \cdot x + \cos \alpha \cdot y \end{array} \right) $$ The last part is figuring out the coordinates $(x,y)$ for each of the four corner points. We know the width $w$ and height $h$, so the unrotated points are (just interpreting from the picture)

  • $A = (-w/2, 0)$
  • $B = (-w/2, h)$
  • $C = (w/2, h)$
  • $D = (w/w, 0)$

And there you have it! You can now use the formula to calculate the points.

0
On

Hint:

The transformation of the coordinates $(x,y)\mapsto(x',y')$ upon rotation is determined by: $$ \begin{pmatrix}x'\\y' \end{pmatrix}= \begin{pmatrix} \cos\alpha&-\sin\alpha\\ \sin\alpha&\cos\alpha \end{pmatrix} \begin{pmatrix}x\\y \end{pmatrix}, $$ where it is assumed that the counterclockwise rotation is positive and $(x,y)$ coordinates are given for $\alpha=0$.