Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...