Collision detection of huge number of circles
There are “spatial index” data-structures for storing your circles for quick comparison later; Quadtree, r-tree and kd-tree are examples. Solution 1 seems to be a spatial index, and solution 2 would benefit from a spatial index every time you recalculate your pairs. To complicate matters, your objects are moving – they have velocity. It is … Read more