Check to see if box fits in another box

℡╲_俬逩灬. 提交于 2019-12-12 09:29:36

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/16839489/how-to-check-if-item-lxwxh-fits-in-box-lxwxh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!