Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I want to rotate a 2D rectangle using a rotation matrix. After the rotation, I want the points (x, y) of the rectangle to be:

(625.49939, 632.40015) top left
(636.49939, 632.40015) top right
(636.49939, 672.40015) bottom right
(625.49939, 672.40015) bottom left

Before the rectangle is rotated, it appears 40 units wide and 11 units tall. After the rotation, it will appear 11 units wide and 40 units tall.

I know that I have to rotate it 90 degrees, but how can I find exactly where to place the rectangle before the rotation so that it ends up in my desired position?

  1. The rectangle starts in position ??? so that it appears 40 units wide and 11 units tall
  2. The rectangle will be rotated 90 degrees clockwise (at its center point).
  3. The rectangle ends with the coordinates listed above.

How do I find the starting coordinates?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

One way for you to do this would be to center in on the fact that the center point doesn't change in a rotation. So find the center of the rectangle. Let's call it $(x,y)$ (although it's very easy to find).

Then, make it so that you can pretend your rectangle is at the origin. That is, subtract the center coordinates from each of the corners, so that you get for instance $(625.49939 - x,632.40015 - y) $ as one of the corners.

Then you can apply the standard rotation matrices to these coordinates. Since you have the coordinates after the rotation, you would use the rotation matrix that rotates by $-90^\circ$. This will rotate the rectangle.

All that's left is to translate the rectangle back to where it should be. You do this by adding the center back to each of the coordinates.

Does that make sense? I can furnish more details if this isn't clear.

share|improve this answer
Thanks for the tip about the center point! I think this solved my problem but I won't be sure until I experiment with it some more. It seems to be working for now, though! Thanks a lot! –  Rick Apr 2 '12 at 0:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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