2024-10-12 --- https://www.thingiverse.com/thing:6776791 i saw these cute stackable boxes on thingiverse and it got me thinking. we want to stack some straight sided (right parallelepiped) milk-crate-like boxes neatly, but also nest them for compactness when not in use. let's think through this step-by-step: We have two types of boxes: a smaller box and a larger box. The smaller box should be able to sit perfectly on top of the larger box when in use, but also fit inside the larger box when rotated. This means the long dimension of the smaller box is the same as the short dimension of the larger box. And the height of the smaller box is less than the interior height of the larger box. We want the two boxes to have the same aspect ratio so that we can continue the scheme indefinitely with larger or smaller boxes. What should the sizes of the boxes be? 12 x 5 x 4 works but it's inelegant and the scaling factor is off use a consistent aspect ratio, such as 2:1:0.5 Large box: 12 x 6 x 3 inches Medium box: 6 x 3 x 1.5 inches Small box: 3 x 1.5 x 0.75 inches 3:1:1 configuration: The larger box dimensions are 12 x 6 x 6 inches The smaller box dimensions are 6 x 4 x 4 inches 3 of the smaller boxes (6 x 4 x 4 inches) can stack perfectly on top of the larger box (12 x 6 x 6 inches) however, all of the above is crap because you can't fit the small boxes side by side in the large box because 6 + 6 = 12 exactly and there needs to be a wall thickness there must be a better way. i did some abstract math to find the answer, which turned out to be more involved than i expected: (transcript) scaling factors: B = Big box (large box) T = Tiny box (small box) L = Long dimension S = Short dimension N = number of divisions W = maximum wall thickness E = slop the entire system of box ratios also needs to be scaled by an arbitrary constant value like 100mm or whatever. this should probably be sized to fit your preferred shelf system. i use 48"x18" wire rack shelves. it's too bad we don't have globally standard sized books or paper. (at least) two small boxes should fit in the large box: 1. BL > 2TL really, BL = 2TL + E + W N small boxes must stack sideways on the large box: 2. BS = TL 3. BL = NTS the aspect ratios should be the same so that we can indefinitely scale up or scale down the stacking system: 4. BL/BS = TL/TS from 4 and 2: 5. BL/BS = BS/TS 6. BL = (BS)^2/TS from 3 and 6: 7. NTS = (BS)^2/TS 8. N(TS)^2 = (BS)^2 9. sqrt(N)TS = BS = TL 10. sqrt(N) = TL/TS i started out calling the variable B_L (B subscript L) for the large box long dimension but later i realized that they are separate factors B and L. from 5, cancel out numerator and denominator: 11. L/S = B/T from 10 and 11: 12: L/S = B/T = sqrt(N) multiplying all three together: 13. BL/TS = N which matches equation 3. good. based on your choice of N, there are different possibilities: N = 2 if N = 2 you get a sqrt(2) = 1.414:1 box ratio this fits in the larger box, and is a nice shape. if N = 3 you get a sqrt(3) = 1.73:1 box ratio this fits in the larger box with a lot of extra space left over, but you can stack 3 of them. if N = 4 you get a sqrt(4) = 2:1 box ratio this case is interesting because if we double up two small boxes we can get an intermediate sized square box, however it doesn't fit in the larger box. if N = 5 you get a sqrt(5) = 2.23:1 box ratio since the box ratio > 2 now we can fit 2 small boxes side by side in the larger box. we can also double up the small boxes to make a square-ish 1.12:1 box, and two of them will fit nicely in the large box without much wasted space, since BL > 2TL. however, there must always be a long skinny box to stack perfectly on the entire larger box. i cut out some paper pieces to check the results: http://fennetic.net/irc/nesting_box3.jpg if N = 6 you get a sqrt(6) = 2.45:1 box ratio with 6 small boxes per large box, we can fit 2 small boxes side by side AND double up the long skinny boxes to make a square-ish 1.22:1 box AND not have any long skinny boxes left over, so we can decide to have only square-ish boxes at a given stacking level, if we so desire. http://fennetic.net/irc/nesting_box4.jpg at this point i realized that if N = 10 then sqrt(10) = 3.16 which is greater than 3, so there could be 3 different ratios for the boxes at each scale. this is an interesting option, but probably too much choice. it's not good to have that many different sizes of boxes, you'll go mad with all the possibilities while trying to play tetris. we'd prefer to keep integer ratios because it makes planning and measuring much easier when the numbers are round, and there is some slop to work with. so i think **2.5:1 IS THE IDEAL BOX RATIO**. ahem. so, naturally, i spent four hours modeling this in blender. here it is with 2.45:1 ratio boxes: https://fennetic.net/irc/nesting_box_solution_sqrt_6.png not much difference with 2.5:1 and realistic thicknesses: https://fennetic.net/irc/nesting_box_solution_2.5_thicknesses.png you can fit in one more skinny box in a large fat box if you rotate two of the small fat boxes: https://fennetic.net/irc/nesting_box_solution_2.5_thicknesses_detail.png just if you want to see how i modeled it, for visualization only, not actually manufacturable: https://fennetic.net/irc/nesting_box.blend some errata: there's enough room left over for a pull handle if you wanted to turn these into drawers. how do i keep the box from becoming entirely round if the corner radius is the same at very small box sizes? if the corner radius changes with each scale, the whole system looks kinda bad and incohesive. if you don't have a giant 3d printer, you could build the larger boxes out of plywood, optional stainless hammer-in sheet metal joint at the corner for strength and beauty. on the square-ish boxes, the positioning ledge at the bottom should have a notch taken out so you can set them down on top of two narrow boxes. it should NOT be just the corners, because that will not sit flat on uneven surfaces like a bike rack or a wire rack shelf. the feet will catch and be annoying. this document can be found at https://fennetic.net/irc/nesting_box_problem.txt