Scale a square rotated by an arbitrary angle so it covers the original square

43 Views Asked by At

I have square images which I want to rotate by some random angle $a\in [0, 2\pi[$ radians. After rotating, I want to scale them, so they cover the entire area of the original image. In a last step, I will crop them to the original size. Which function describes the scale factor $x$ required to resize the rotated image? I think it should look something looking like $\frac{\sqrt{2}}{2}*|\sin{x}|$, but it is long ago, since I last had to actually solve a mathematical problem. enter image description here Here, the red square indicates the boundaries of the original image for comparison.

2

There are 2 best solutions below

0
On

Let's assume the original blue square to be of length 1. This would mean that the four right-angled triangles have a hypotenuse of length 1 with the smaller angle equal to a. Thus, the two other sides of these triangles are equal to $\sin(a)$ and $\cos(a).$ The total area of the four surrounding triangles would then be equal to $2\sin(a)\cos(a) = \sin(2a).$ Thus, the area of the scaled red square (step 3) would be equal to $1+2\sin(a).$

Equating the above expression to $x^2,$ you would get $x = \sqrt{1+2\sin(a)}$

Hope this helps!

1
On

enter image description here

As shown in the figure above the upright square is scaled and rotated such that the vertices of the original square lie on the sides of the rotated/scaled square. Applying the law of sines to $\triangle OAA' $,

$x=\dfrac{r'}{r} = \dfrac{ \sin(45^\circ + a ) }{ \sin 45^\circ } = \cos(a) + \sin(a) = \sqrt{1 + \sin(2a)} $