Quadtree

controls

Mouse around to highlight particles.

Click to add more particles.

Description

Each particle checks if it is close to a neighbor and propels itself away from that neighbor. I use a quadtree to speed up the neighbor checking process. Instead of checking every other particle to see if its a neighbor, it queries the quadtree to see which particles are close, then does distance calculations on the particles nearby.