Given LxWxH of a box A, and LxWxH of a box B, how can I do a simple check to see if A fits in B (with 90 degrees rotations if necessary)? I'm trying to avoid checking all the possible permutations. Thanks.
Asked
Active
Viewed 2,615 times
1 Answers
9
I would check to see if
minimum dimension of A < minimum dimension of B &&
median dimension of A < median dimension of B &&
maximum dimension of A < maximum dimension of B
If those 3 conditions are met, A fits in B.

Dr.Tower
- 985
- 5
- 11
-
The comparison would be <= so boxes with equal dims are not dismissed. This is assuming that we are comparing the internal dims of B and the external dims of A. In real life we have to account for the thickness of the material the boxes are made with. – luenib Mar 21 '21 at 18:41