calculating dimensions of rotated rectangle for it to to mask original I have two identical rectangles.
I'm wanting to rotate one rectangle by either + or - $30^\circ$ about its center point. Then calculate the dimensions required to stretch the rotated rectangle out equally from its center point to cover the other rectangle completely.
I can calculate the width of rotated rectangle using a square root
I was hoping someone could help with calculating the height required.
I hope the following will help illustrate what I mean; essentially I can't figure out how to calculate the red line.
The length will change dependent on angle and the dimensions of the original rectangle.


There are corresponences between rotation angle and angles between base and rotated rectangles:

Larger version
We can use definitions of sinus and cosinus to find lengths of s, t, u and v segments, assuming that $\alpha\in[0,\frac{\pi}{2}]$, $w>0$ and $h>0$:
$$
\cos\alpha=\frac{s}{w}\Rightarrow s=w\cos\alpha\\
\sin\alpha=\frac{t}{w}\Rightarrow t=w\sin\alpha\\
\cos\alpha=\frac{u}{h}\Rightarrow u=h\cos\alpha\\
\sin\alpha=\frac{v}{h}\Rightarrow v=h\sin\alpha
$$
Finally, lenghts of sides of a rotated rectangle:
$$
w'=v+s=h\sin\alpha+w\cos\alpha\\
h'=t+u=w\sin\alpha+h\cos\alpha
$$
