2
$\begingroup$

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 Answers 2

1

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

1

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$.

  • 0
    @Simon Harris: And, as promised, I have posted an answer. Naturally, I was not first to post an answer. But on seeing the other answer, I decided that mine was different enough (though roughly equivalent) to be worth posting.2011-08-30