Get unrotated position of a rectangle.

68 Views Asked by At

I'm struggeling with the following problem.

Rotated rectangle

I have a rotated rectangular. The following values are known. The size of the rect, the angle the rect is rotated by and the position of point A. The given angle will always be positive.

enter image description here

How can i obtain the unrotated position of point A?

1

There are 1 best solutions below

4
On BEST ANSWER

Fix the line between the A and the orange (x) to have length $ L $, and angle $ \theta $ with respect to the horizontal. Let the position of A be the coordinates $ (a_x,a_y) $. Let the other dimension be $ W $.

The center of the rectangle has coordinates $ ( c_x, c_y) = (a_x,a_y) + \frac{L}{2} (-\cos\theta, \sin\theta) + \frac{W}{2} (\sin \theta, \cos \theta) $. Then the position of A after rotation is then $ (a_x',a_y') = (c_x,c_y) + \frac{L}{2} (-1,0) + \frac{W}{2} (0,1) $.