There are N red balls and a white ball, all with the same radius. The white ball moves from position p1 to p2.
My objective is to predict all red balls the white ball will hit in its path and turn them yellow.
I tried iterating through all balls and taking the distance to the line formed by p1 and p2, but the balls that are behind the white turned yellow too, but they shouldn't. How should I approach this task? Is there a fast way to do it?
You can suppose that the white follows its path ignoring all collisions, the only objective is to predict what balls are in its way.