Knowing the dimensions of the rectangle ABCD, how can we calculate the distances OE and OF after a rotation with an angle=α?
Asked
Active
Viewed 194 times
0

Mahfoud B.
- 51
- 1
- 5
-
1It is not the convex hull, but the AABB. – Feb 25 '22 at 15:48
-
Roughly: Compute all rotated points A', B', C', D'. Compute an axis aligned bounding box that contains those points. Return half of the width and height of this bounding box. – jsb Feb 25 '22 at 15:56
-
Does this answer your question? [Calculate Bounding box coordinates from a rotated rectangle](https://stackoverflow.com/questions/622140/calculate-bounding-box-coordinates-from-a-rotated-rectangle) – jsb Feb 25 '22 at 16:00
-
The size is W |cosΘ| + H |sinΘ|, W |sinΘ| + H |cosΘ|. – Feb 25 '22 at 19:23
-
Sorry I have made a mistake in the image I attached, now I corrected it. – Mahfoud B. Feb 25 '22 at 22:30
-
Yes @YvesDaoust it is as you said : W |cosΘ| + H |sinΘ|, W |sinΘ| + H |cosΘ but how to calculate this Θ angle – Mahfoud B. Feb 28 '22 at 01:27
-
@MahfoudB.: read alpha. – Feb 28 '22 at 07:40
-
@YvesDaoust thank you. Is it in radian or degree? – Mahfoud B. Feb 28 '22 at 09:31
-
@MahfoudB.: that's irrelevant. – Feb 28 '22 at 09:31
1 Answers
0
I have fine the answer of my question in a response to this question: Find the Bounding Rectangle of Rotated Rectangle [duplicate]
It was written by @MBo like this:
Old_Width = X2_Old - X1_Old, Old_Height = Y2_Old - Y1_Old
New_Height = Old_Width * Abs(Sin(Fi)) + Old_Height * Abs(Cos(Fi))
New_Width = Old_Width * Abs(Cos(Fi)) + Old_Height * Abs(Sin(Fi))
X1_New = X1_Old - (New_Width - OldWidth) / 2 =
(X1_Old + X2_Old - New_Width) / 2

Mahfoud B.
- 51
- 1
- 5