Final 2D version of the N-Body simulation using the Barnes-Hut algorithm. The blue lines show the acceleration vector times 25. The grey rectangles represent the tree structure of the particles in memory. Click to reset the sim with random particles. Runs better in Google Chrome or a Firefox 4.0 beta.
Category: Programming
Simple 2D gravity simulation
A simple 2D gravity simulation of particles with random position and momentum using verlet integration. Written with Processing and processing.js. Some particles fly away, some coalesce into a larger masses, and some form stable orbits. At least stable enough to observe for a while. Usually the 200 particles form into a little miniature solar system with a very massive center and several much smaller satellites. I think neatest case is when two large masses form that orbit each other, but it’s pretty rare.
The simulation can run slowly at first, but speeds up as the particles collide and merge together. Really best viewed with Google Chrome.
Click to see:
Continue reading “Simple 2D gravity simulation”
Red_Eat_Green
Been playing around with Processing.js some. The little red critters seek out the brightest green “food” blocks. It runs about 2x faster in Chrome than Firefox 3.6.13.
Clicks the more to see.
Continue reading “Red_Eat_Green”