Fitting a piece of furniture through a corridor 
In a few days I'm facing the task of trying to move a piece of furniture into my apartment and the situation inspired me mathematically. Above is a sketch of the situation. We are trying to slide a small box of dimensions $h'$ and $w'$ through a corridor of dimensions $h$ and $w$ with entrance and an exit of widths of $a$ and $b$. No assumptions about any variables can be made except that $a$ > $h'$ and $b$ > $h'$, even if the picture suggests some relative dimensions. The box or any other dimension cannot obviously be stretched. The box can be turned freely.
I'm looking for the simplest way to calculate if it is possible to fit the box through the corridor, and how. I have come up with some tedious ways of trigonometry but somehow a simple and elegant solution eludes me. Help will be greatly appreciated!
EDIT: As pointed out in a comment, the box can be turned freely unlike my original question implied.
EDIT2: If it simplifies things, the length $h$ can be for my specific problem be assumed be bigger than $w'$ and $h'$, although it would be interesting to know a fully general case.
 A: (The following is a partial answer at best, but too long for a comment.)
Suppose $\,a \le b\,$, otherwise flip the corridor around. If the box gets fully in through door $\,a\,$, then it will be able to get out through $\,b\,$ by symmetry, so it's enough to consider the move through $\,a\,$.
First step is to slide the box in at the maximum possible angle $\alpha$. If it can not get in the position depicted below without hitting the opposite walls first, then the move is impossible.

The angle $\alpha$ is determined by:


*

*$\,a \cos \alpha = h'\,$


Then the conditions for the inside corners of the box to fit are:


*

*$w' \cos \alpha \le w$

*$w' \sin \alpha + h' \cos \alpha \le h$
(As a side comment, the first condition is equivalent to $\,h' \cdot w' \le a \cdot w\,$ i.e. the area of the box no larger than the area from the door to the opposite wall.)
These are necessary conditions, and no solution is possible if they don't hold. They are not sufficient conditions in general, though.
The next step would be to rotate the box towards vertical position by sliding the bottom corner to the right while keeping the top side in contact with the door edge. Such rotation, however, requires additional room at the top, and possibly to the right as well. Exactly how much room reduces in the end to finding the extrema of some trig functions, to which I did not find "nice" closed solutions.
Still, there are a couple of cases where the above conditions are sufficient as well (both of which assume that the length of the corridor is larger than the diagonal of the box $\,h \ge \sqrt{w'^2+h'^2}\,$).


*

*If there is no perpendicular wall right next to $\,a\,$ i.e. if the bottom horizontal line in the drawing is missing, then the rotation can always be completed by sliding the bottom corner down and to the right, such that the box stays in contact with both edges of the door. In this case, the rightmost corner of the box never moves any closer to the right wall than it was before, so the previous condition is sufficient.

*If the horizontal'ish diagonal of the red box has an upwards slope in that position (unlike the slightly downwards one in the picture), then again the rotation can be completed without requiring additional room on the right. This is the case when $\,\varphi \ge \frac{\pi}{2} - \alpha\,$ where $\,\varphi\,$ is the angle between the diagonal of the box and its wide side, which translates to $\,a \ge \frac{h'}{\sin \varphi}=\frac{h' \sqrt{h'^2+w'^2}}{w'}\,$.
(The above leaves out some trivial cases such as $w'\le w$ when the box can be simply translated all the way, or $w' \le a, h' \le w$ when the box can be first turned sideways then translated, but in my practice of having moved large boxes around corners those cases never happen ;-))
A: I have found 3 sets of restrictions, and I believe that if they're respected, the furniture will fit through the corridor.
First two restrictions to deal with angling after fitting through the door, where if the width of the furniture is too long, it won't be able to turn after reaching the wall.
$$ w' < \frac{h'}{a}*w - a*sin(90 -cos^{-1}\frac{h}{a})  $$
$$ w' < \frac{h'}{b}*w - b*sin(90 -cos^{-1}\frac{h}{b}) $$
Edit: Dxiv pointed out that the two inequation on top are wrong. I've looked at it again and it should be $$w' < \frac{h'}{a}*w - \sqrt{a^2 - (h')^2}$$$$w' < \frac{h'}{b}*w - \sqrt{b^2 - (h')^2}$$
Edit 2 : Again it seems to go negative with small enough $h'$ so I'll leave a graph here https://www.desmos.com/calculator/p8knda1rwl
Then another one so diagonal length of the furniture doesn't surpass the height of the room
$$ (w')^2+(h')^2 < h $$
I didn't take into account the third dimension which would complicate this further and didn't seem to be implied in the question and a situation where the furniture could go from the first door straight into the second like so:
