Fitting a painting through a door Deceptively tricky - will it fit through the door?
I work in an art gallery and we regularly take delivery of large paintings housed in wooden crates. Our old building has a door measuring 180 x 234 cm (290 cm diagonal).
What is the formula for calculating whether a painting will fit through our doors diagonally?
For example, I am trying to calculate if we can receive a painting in a crate sized 281 x 347 x 23 cm. Its shortest side (281 cm) is within our diagonal dimension but I estimate that the 23 cm depth means that it will not fit. What is the formula for establishing this accurately?
Ideally I would like to refer to a formula each time I find out the dimensions of a wooden crate.
Door and Crate
 A: Let's say you have a door with sides $2a<2b$ and a painting with smaller dimensions $2\alpha<2\beta$. Of course, if $\alpha<a$ and $\beta<b$, the case is trivial, so I'll assume otherwise. The diagonal of the painting is $2d=2\sqrt{\alpha^2+\beta^2}$ and the smaller angle between those diagonals is $\varphi=2\tan^{-1}(\alpha/\beta)$. We can center the painting in the center of the door since you will remain inside the door by moving the center of the painting through to the point opposite the center of the door.

We need to make sure all four corners lie inside the door. Pick two adjacent corners. If these two corners fit, all four will fit. Orient the picture as above with $\theta$ the angle from the horizontal to the first corner. Then, $\varphi$ is the additional angle to reach the next corner.
The inequalities we need to solve are
$$d\cos\theta<a$$
$$d\sin(\theta+\varphi)<b$$
We assume the painting cannot fit at all angles, so we can find an angle where one of these conditions is equality. Thus, we have two cases
(I) $d\cos\theta = a$ so we use $sin(x+y)=\sin x\cos y+\sin y\cos x$ then ask if the following is true
$$\sqrt{d^2-a^2}\cos\varphi+a\sin\varphi<b$$
(II) $d\sin(\theta+\varphi)=b$ so we use $cos(x-y)=\cos x\cos y+\sin x\sin y$ ask if the following is true
$$\sqrt{d^2-b^2}\cos\varphi+b\sin\varphi<a$$
In your case, paintings are generally thinner than doors, so we opt for (II). In terms of dimensions, this becomes
$$\sqrt{\beta^2-p^2}+\sqrt{b^2-p^2}<a$$
where
$$p^2=\frac{b^2\beta^2}{\alpha^2+\beta^2}$$
Notice, it checks out for $\alpha=0$.
A: Imagine that in front of your door is an alleyway $180$ cm wide.
That is, it has the dimensions of your door except that it has no top frame.
Imagine that you lean the crate over in the alleyway until the bottom of the crate touches one wall and the top of the crate touches the other, like this:

The angle at which the crate leans is determined by the diagonal of the crate that touches both walls. The length of this diagonal is
$$d = \sqrt{w_C^2 + h_C^2}$$
where $w_C$ is the width of the crate and $h_C$ is its height.
For a short, wide crate there could be two solutions, but for a crate containing a painting that is taller than the door frame, I am fairly sure there will be only one, and it will be the solution shown above.
The diagonal $d$ is the hypotenuse of a right triangle; one of the triangle's legs runs along the wall and the other leg is parallel to the ground and has length $w_D$
(the width of the door frame).
The angle opposite the ground leg, which is represented in the figure by the sum
$\phi + \theta,$ can then be computed by the formula
$$ \phi + \theta = \arcsin\left(\dfrac{w_D}{d}\right). $$
Solving for $\theta,$
$$ \theta = \arcsin\left(\dfrac{w_D}{d}\right) - \phi. $$
The angle $\phi$ is easily computed by $\phi = \arctan\left(\dfrac{w_C}{h_C}\right)$,
so
$$ \theta = \arcsin\left(\dfrac{w_D}{d}\right) - \arctan\left(\dfrac{w_C}{h_C}\right). $$
As shown in the diagram, the angles $\phi$ and $\theta$ and the crate's width $w_C$ determine the height from the ground to the uppermost corner of the crate.
If this height is less than the height of the door frame, $h_D,$ the crate can pass through; otherwise it cannot. So we want to know whether
$$ 2 w_C \sin \theta + d \cos(\theta + \phi) < h_D. $$
An alternative formula, using the Pythagorean theorem rather than trigonometry to find the length of the segment $d \cos(\theta + \phi),$ is
$$ 2 w_C \sin \theta + \sqrt{d^2 - w_D^2} < h_D. $$

As a practical matter you will have to do some rounding both while measuring and while calculating. I would round the door frame dimensions down, round all other linear dimensions up (including the value of $\sqrt{d^2 - w_D^2}$, which I would use instead of  $d \cos(\theta + \phi)$), and round $\theta$ up because of the factor $\sin\theta$.

For your example, we have $w_D = 180,$ $h_D = 234,$
$w_C = 23,$ and $h_C = 281.$
Then $d = \sqrt{23^2 + 281^2} \approx 281.94$ (rounded up), and
$$ \theta = \arcsin\left(\dfrac{180}{281.94}\right)
 - \arctan\left(\dfrac{23}{281}\right) = 0.6108 $$
(in radians, rounded up). This is about $35^\circ.$
Then
$$ 2 (23 \sin (0.6108)) + \sqrt{281.94^2 - 180^2} \approx 243.385 > 234, $$
so this crate will not fit through the doorway.
