Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

given 2 boxes (in 3-space) determine if one of the boxes resides within the other, or if a third box must be constructed that holds them both?

given that a box is defined by its center($x,y,z$), and its dimensions($W, H, D$).

consider that

  • the boxes are immovable,
  • can not have their properties altered,
  • and all tests must be done with fundamental logic.
share|improve this question
    
What is the question? –  Gerry Myerson Apr 12 '12 at 3:40
    
@GerryMyerson edited. –  gardian06 Apr 12 '12 at 3:45

1 Answer 1

up vote 1 down vote accepted

Presumably the boxes are aligned with the axes and you have a definition that $W$ is the width in $x, H$ in $Y$, and $L$ in $z$. Call the centers $(x_1, y_1, z_1)$ and $(x_2, y_2, z_2)$. Then box $1$ is inside box $2$ if $x_1-W_1/2 \gt x_2-W_2/2, x_1+W_1/2 \lt x_2+W_2/2$ and so on.

share|improve this answer
    
are these conjoined tests (both must be true), or are they separate. I can somewhat see that the tests would need to be reversed in order to determine if box2 resides in box box1, but what would be the characteristics of box3 if it is needed –  gardian06 Apr 12 '12 at 4:10
    
@gardian06: There are two tests in each dimension for box 1 inside box 2. I gave the two in $x$. You need all six to pass for box 1 to be in 2. Then there are six more to see if 2 is in 1, which you should be able to figure out by symmetry. If you are going to build a single box, it needs to have the minimum $x$ coordinate equal to the minimum $x$ of either box and so on-again the same logic I used. –  Ross Millikan Apr 12 '12 at 4:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.