Check to see if box fits in another box

后端 未结 1 1484
醉话见心
醉话见心 2021-01-16 11:12

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

相关标签:
1条回答
  • 2021-01-16 11:48

    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.

    0 讨论(0)
提交回复
热议问题