I have two rectangles: red and green. For each of them, I have the following information:
- Center point (
x
andy
coords). - Rotation angle
- Width and height
The rectangles will always be moving in positive coordinates. Edit: No coordinate can ever be negative: the rectangles are always located in positive coordinates. Therefore, the center will never be (0,0).
Problem
I have an starting position. To simplify the example, let's say that my red and green rectangles are located as follows:
Now, I rotate the red rectangle using an angle phi
which goes between 0º and 90º. However, the green rectangles needs to rotate and keep its position regarding the red rectangle. The green rectangle is not only rotating but also moving.
Let see an image (please excuse the sketch-quality):
My Question:
How can I obtain the new center coords for the green rectangle?