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.

Let say I have these rectangles,

enter image description here

All the rectangles are in same shape. I know all the co-ordinates of all inner rectangles. I know the width and height of outer rectangle, which contain all inner rectangles. So, I know the center also. I need to rotate all these inner rectangle from center. After rotating I need the co-ordinates of all inner rectangles.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Simply transform the coordinates into coordinates relative to the center, and then apply the rotation matrix to each of the coordinates.

share|improve this answer
    
Can you please show me a simple example? –  user960567 Apr 10 '12 at 10:53
    
Say the center is at (1,5), and one of the coordinates of the inner rectangle was at (6,8), then the transformed coordinates would be (5,3). To rotate you would multiply the vector (5,3) by the rotation matrix. –  nbubis Apr 10 '12 at 11:08
    
Thanks. I will check that. If I rotate first then transform it. Then it will effect or not –  user960567 Apr 10 '12 at 11:26
    
Thanks your solution perfectly works for me. I am very very thankful to you. –  user960567 Apr 10 '12 at 11:45

Your Answer

 
discard

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.