Does anyone know if there is a way of proving if one cube fits inside another without actually having to do rotation sampling and bounds checking.(adsbygoogle = window.adsbygoogle || []).push({});

For example, box A with width = w1, height = h1, depth = d1. box B with width = w2, height = h2, depth = d2.

Both boxes may be in any orientation in space.

In cases where w1 != w2, h1 != h2, d1 != d2 - I need to find out if box B could ever fit into box A and if so, what the orientation would be. I just can't "see" what the geometry would be to find the correct orientation of box B so that it fits inside box A. So far, the plan is to move box B so that the centroids of the boxes are equal, take the surface normals to the top face of each cube, do the cross product of these vectors and use this axis and angle between both normals to rotate box B so that both boxes adopt the same orientation in y-space, and then do 90-degree rotations around x, y and z and test the new widths/heights and depths to see if the new orientation of B satisfies the dimensions of A. This is very approximate and far from ideal. I'm sure there must be a better way...

Can anyone help please?

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Cube fitting

Can you offer guidance or do you also need help?

**Physics Forums | Science Articles, Homework Help, Discussion**