A sphere is the most efficient shape to enclose a volume. The least amount of metal is needed and pressure is equally distributed. However it’s not efficient in “stacking” – a cube has the least wasted space outside the container but with many weaknesses and high pressure points.
The cylinder is a compromise, with better than a sphere in optimization for space and the better than the cube for pressure and material use.
The engineering guy has an excellent you tube video on the creation of the aluminum soda can that discusses the cylinder as a compromise shape.
Latest Answers