Collision detection of huge number of circles
What is the best way to check collision of huge number of circles? It's very easy to detect collision between two circles, but if we check every combination then it is O(n 2 ) which definitely not an optimal solution. We can assume that circle object has following properties: Coordinates Radius Velocity Direction Velocity is constant, but direction can change. I've come up with two solutions, but maybe there are some better solutions. Solution 1 Divide whole space into overlapping squares and check for collision only with circles that are in the same square. Squares need to overlap so there