Calculate width and height to give to rectangle to achieve required size after rotation

1.5k Views Asked by At

My goal is to create a rotated rectangle with a size to my specification. I begin with a regular rectangle which gets rotated 45 degrees.

Now I know I have succeeded to calculate the width and height after the rotation using;

rotatedSize = (sin(0.785398163) * originalSize) * 2;

So when I want a rotated rectangle of 100x100 my formula is;

100 = (sin(0.785398163) * originalSize) * 2;

Now I am not very good at math but I know there is a way to solve this formula, can anyone assist me in solving it?

2

There are 2 best solutions below

0
On BEST ANSWER

You need $\sin \frac{\pi}{4}=\frac{\sqrt{2}}{2}\approx 0.707\ $, so originalsize$=\frac{100}{\sqrt{2}}\approx 70.71$

4
On

Solving for $\text{originalSize}$ can be done by division: $$\text{originalSize}=\frac{100}{2*\sin(0.785398163)}.$$

This is because your formula really says that $$100=(\text{originalSize})*(2*\sin(0.785398163))$$ (I gathered together the two numbers that $\text{originalSize}$ was multiplied by to get $100$.)

For the particular angle $\pi/4$ that we are looking at, the sine is exactly $1/\sqrt{2}$, so the bottom simplifies to $\sqrt{2}$. And then a little further manipulation (multiply top and bottom by $\sqrt{2}$) yields $50\sqrt{2}$. To the limit of precision of my calculator, this is $70.710678$.