So a Stack O’ Cans…. uhm, that’s great, but why exactly?   Well, hopefully this will be the first in a series of small graphic projects done for fun, learning, and experimentation purposes. Also, who doesn’t have the desire to knock over a bunch of neatly stacked virtual cans? Click here view…

The idea for the cans themselves originated with Richard who had in his possession a real life version of the cans.

About the stacking algorithm:

The cans are stacked in a stair step fashion. This means that to total number of cans in each\r\nrow is the series of n + (n+1) + (n+2) + (n+3) … (n+total). This can be simplified to . Which although is a common enough formula, never really made sense to me until I saw this simple geometric proof:

Can we prove it? Yes we CAN!

The stacks pretty obviously are half of each grid - however, because the cans are discrete units, it is slightly more than half - that is where the +n comes from.

Development:

The can was modeled using blender.  Care was taken to try to maintain the correct aspect ratio for the can model. After measuring a can, I learned that the ratio of height to diameter is about 1.8 to 1.

The model was then imported into three.js, and the physijs library was used to add the physics effects.

Some miscellaneous pictures:

For those who are interested, the full source code can be viewed here.

Well, enough of that - Now I think it’s time to enjoy the classic taste of a refreshing ice-cold coke….