News for hackers. Stuff that matters.
Re:Ask HN: How to calculate if a box will fit through a hall... by noonespecial on Thursday May 21, 2009 @12:35AM (#619906)
You can find out with a piece of string. Make the string as long as the mid-point of the box on one edge to one of its corners on the other side. Hold the string at the inside corner of the hall. If you can sweep the arc without touching any walls it will fit.

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.

Re:Ask HN: How to calculate if a box will fit through a hall... by NoBSWebDesign on Thursday May 21, 2009 @10:52AM (#620522)
I believe this is technically incorrect, but it errs on safe side. I.e. if the string sweeps through the arc, the box will fit, if it doesn't swing through the arc, there is still a chance that the box will fit. I'm assuming this is what you are referring to by "edge cases".

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.

Re:Ask HN: How to calculate if a box will fit through a hall... by noonespecial on Thursday May 21, 2009 @03:33PM (#620998)
but I don't have my trusty TI-89 calculator to help out

You speak with knowledge, worthy adversary, but with my HP-48g, I would defeat you! </bad overdub due to RPN>

Re:Ask HN: How to calculate if a box will fit through a hall... by Anon84 on Thursday May 21, 2009 @01:50AM (#619965)
It's not quite that simple. Don't forget the third dimension.

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.

Re:Ask HN: How to calculate if a box will fit through a hall... by noonespecial on Thursday May 21, 2009 @02:16AM (#619982)
Edge cases! I actually learned the trick from an immigrant worker with an 8th grade education during a summer job moving furniture into a hotel thing. He had a couple of other neat string tricks to find fits as well. Books, covers etc.