I have the task of fitting a rotated rectangle into another rectangle. Inner rectangle shall touch outer rectangle on each side with one edge of inner rectangle.
Given values
$a,b$ : Size of outer rectangle.
$w$ : width of inner rectangle near side a. $w < \sqrt{a^2+b^2}$, so we know it will fit
Unknown values
$x,y$ : section of side $a$ and side $b$, where inner rectangle touches outer rectangle
$z$ : length of inner rectangle (but can easily be calculated, when $x$ and $y$ is known)
What I have tried:
$x^2 + y^2 = w^2$ [pythagoras]
$\frac{x}{y} = \frac{b − y}{a − x}$ [congruent triangles]
Solve equations for $y$
$y = \sqrt{w^2 − x^2}$
$y = b/2 + \sqrt{x^2 + b^2/4 − ax}$
Now I can eliminate $y$
$\sqrt{w^2 − x^2} = b/2 + \sqrt{x^2 + b^2/4 − ax}$
But I am not able to transform this into
$x = f(a,b,w)$