I noticed that the collision detection algorithm currently implemented is inefficient. Under our current system, the algorithm will check if particle A has collided with particle B. Then, during the same frame, it will check if particle B has collided with particle A.
In short, we should record the pairs of collisions we have checked. If n is the number of particles, it will reduce the number of checks from n(n-1) to n(n-1)/2, doubling the efficiency of our algorithm.
I noticed that the collision detection algorithm currently implemented is inefficient. Under our current system, the algorithm will check if particle A has collided with particle B. Then, during the same frame, it will check if particle B has collided with particle A.
In short, we should record the pairs of collisions we have checked. If n is the number of particles, it will reduce the number of checks from n(n-1) to n(n-1)/2, doubling the efficiency of our algorithm.