Ask HN: How to calculate if a box will fit through a hallway with a 90 degree turn
It seems like it should be simple geometry but I'm stumped.
Will my box:
--
I I
I I
--
Fit through my hallway: I I
I I
I ------
I
----------
31 comments
[ 1.5 ms ] story [ 72.6 ms ] threadNote that we're still being possibly inefficient, as we are not using our third available dimension; however, this is only relevant if the box is much longer in one direction than the other two (for example, if you were trying to carry a 2x4 around this corner).
http://archives.math.utk.edu/visual.calculus/3/applications....
I feel much better now knowing I wasn't missing something obvious, and I can finally move onto my actual work for the morning after seeing the solutions. Thanks!
If you don't know the size of the box in advance, hold the string at the corner and make the string the longest possible length that can sweep this arc. Take the sting with you to the box.
What you are really doing is measuring the distance to the corner from the closest wall and then making sure the line from the box's midpoint to one of its corners is not longer. There are edge cases (ha!), but this generally works.
Sometimes you can get around it by leaning the box at a vertical angle, thus reducing the length that actually needs to get around the corner.
Mathematically this "string theory" (sorry, couldn't help myself) is saying the following:
sqrt[ (l/2)^2 + b^2 ] < min(x,y)
where l = length of box, b = base of box, and x and y are the respective widths of the two hallways.
However, this ignores the fact that the pivot point on the box around the corner can slide as you push the box around the corner. So the pivot point could essentially slide from one end of the box to the other (at some point sliding through the midpoint you are measuring for), which allows a lot more leeway for the box's acceptable dimensions.
I worked on this problem a bit this morning, but I don't have my trusty TI-89 calculator to help out. This is actually a calculus problem that I have a difficult time explaining without posting some sketches. Maybe I'll do that in the near future.
You speak with knowledge, worthy adversary, but with my HP-48g, I would defeat you! </bad overdub due to RPN>
Assumed the hallways size is symetrical and your object cannot be tilted to achive a smaller length. For example, an object of little height in a high to ceiling room will be possible to tilt with the same measurements are presented above (pythagoras). But if the box has any substancial height you wont get any help from a tilt. A soffa would tilt, a dish washer does not.
This gives you two equations for determining the point on the box to rotate around. If you can solve them, the box will fit through the hallway.
Btw., voted up for reminding me of that classic Douglas Adams story where the hero ends up writing a program to calculate how his sofa could have gotten stuck in the hallway.
If you really want to turn the box, make sure the hallway is wider then 3/4 * sqrt(2) * lengthBox If you turn the box 45 degrees, that's when the box will use the most space. The hallway will have to be 3/4 of the diagonal of the box.
Personally I reckon you should keep it closed.
let x = width of one corridor.
let y = width of the perpendicular corridor.
We will disregard the height of the box here since I assume that you can find out the correct way to orient the box.
The box will fit throught the hallway if:
(sqrt(x^2+y^2) - l/2) >= b
I will post the reasoning after I get out of my office.
BTW, thanks for posting this intersting problem.
The equation I came up with is as follows:
y1 = [l/(2b(1/tan(a)^2 - cos(a))] * [x - l/cos(a) + b/sin(a)] + l/cos(a) + b/sin(a)
where you plugin b, l, and x based on your parameters, and find the maximum value for y1 when a goes from 0 to 90 degrees. That maximum value should be less than y for the box to be able to fit around the corner.
If it helps, it's an elliptical machine I was thinking of buying (I was using a rectangular box shape as an abstraction.)
I'm not sure how easily it can be disassembled.
The dimensions are 22" x 57" x 66" and the hallway is 31" in the first corridor and 32" in the next, with a height of 82".
sqrt[ (57/2)^2 + 22^2 ] = 36", which is greater than 31"
Here let us take h=66 since it will fit only that way in the corridor.
x = 31, y = 32
b = 22, l = 57, h =66
So (sqrt(x^2+y^2) - l/2) = 44.55 - 28.5 = 16.05
Now 16.05 is less than b(=22), so the box will not fit through.