2D colliding n-body simulation (fast Collision Detection for large number of balls)

Posted by osgx on Stack Overflow See other posts from Stack Overflow or by osgx
Published on 2010-03-20T01:11:23Z Indexed on 2010/03/20 1:31 UTC
Read the original article Hit count: 630

Hello

I want to write a program for simulating a motion of high number (N = 1000 - 10^5 and more) of bodies (circles) on 2D plane. All bodies have equal size and the only force between them is elastic collision.

I want to get something like Crazy Balls but in larger scale, with more balls and more dense filling of the plane (not a gas model as here, but smth like boiling water model).

So I want a fast method of detection that ball number i does have any other ball on its path within 2*radius+V*delta_t distance. I don't want to do a full search of collision with N balls for each of i ball. (This search will be N^2.)

PS Sorry for loop-animated GIF. Just press Esc to stop it. (Will not work in Chrome).

© Stack Overflow or respective owner

Related posts about modeling

Related posts about ball