检查盒子是否适合另一个盒子 [英] Check to see if box fits in another box

查看:121
本文介绍了检查盒子是否适合另一个盒子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定盒子A的LxWxH和盒子B的LxWxH,如何简单检查A是否适合B(必要时旋转90度)?我试图避免检查所有可能的排列.谢谢.

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.

推荐答案

我会检查是否

minimum dimension of A < minimum dimension of B &&
median dimension of A < median dimension of B  &&
maximum dimension of A < maximum dimension of B 

如果满足这3个条件,则A符合B.

If those 3 conditions are met, A fits in B.

这篇关于检查盒子是否适合另一个盒子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆