1
$\begingroup$

This question is an exact duplicate of:

We have a rectangle that is rotating by its center from $0$ to $360$ degrees. This rectangle rotation starts in $0$ degrees when we know all four rectangle points. We also know the angle we want to rotate the rectangle.

What I need is a formula for these points when rectangle is rotated.

Picture

$\endgroup$

marked as duplicate by amd, Namaste, GNUSupporter 8964民主女神 地下教會, Rohan, zz20s Dec 27 '17 at 4:50

This question was marked as an exact duplicate of an existing question.

  • 3
    $\begingroup$ Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. $\endgroup$ – José Carlos Santos Dec 26 '17 at 19:09
  • $\begingroup$ For example, you might explain how you can accomplish this for rectangles centered on the origin. Readers can then show you how to relate that to rectangles centered on arbitrary points. $\endgroup$ – hardmath Dec 26 '17 at 20:10
2
$\begingroup$

When you rotate the point $(x,y)$ through an angle of $\theta$ (radians, not degrees) about the origin the new position is $$ (x \cos\theta - y \sin\theta\ , \quad x\sin\theta + y\cos\theta). $$

(https://en.wikipedia.org/wiki/Rotation_matrix)

If the center of the rectangle is not at the origin, translate the center to move it there, rotate, then translate back.

$\endgroup$

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