Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a rectangle defined by four (x, y) points. It is angled and not aligned with the (x, y) axes.

For example, say I have this rectangle:

lowerLeft   {x=178.77817 y=213.27817 }
lowerRight  {x=207.06244 y=184.99390 }
upperLeft   {x=171.00000 y=205.50000 }
upperRight  {x=199.28426 y=177.21573 }

I want to set its center point to another position, say (419.0, 671.0). How can I determine the new (x, y) points for this rectangle based on its new center position?

I know that I can make an axis aligned rectangle with the same center point and rotate it, but how can I determine the number of degrees to rotate?

share|cite|improve this question
up vote 0 down vote accepted

Determine the original center point (intersection of diagonals). Use that to determine the translation needed to move it to the new position. Then apply the translation to your 4 other points.

share|cite|improve this answer
I think that may have solved my problem. Thanks a lot! – user59032 Jan 20 '13 at 21:05

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.