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.
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.