Simulating atomic model of metal by Box2DFlash

Impressed by the video here, I tried to simulate the atomic model of metal in Flash using Box2DFlash.

What is done in the program is just put a lot of spheres in the area randomly, and then let the physics engine to solve all the collisions. When all the atoms stop moving, a single still of the metal structure will be formed.

The atoms are only drawn on the screen when it is sleeping (i.e.. no movement). It can save some time from not rendering them in each frame.

caution: The browser will freeze for a few seconds after “start” is pressed. And it takes several minutes to an hour to finish (when sleep count == atom count).

source

comments powered by Disqus