Implementation Can be found on GitHub. Search the username MonkeyToiletLadder for the repository. It has passed all test cases I have given it. It's pretty fast with the most expensive function being a sqrt no trig. Please let me know what you think of it.
There is plenty of information on how to detect if a circle collides with a line segment, but I have found little information on how to do this over a time step. For example we have a circle that has accelerated through a line segment BE over a indivisible time step. This is just a test case. I would like to test against any line segment. I have thought of two ways of detecting this type of collision . . .
Either Calculate the swept circle and test if points are within or . . .
Find a point on the line segment which is closest to the circle.
Then create a line that goes through this point and points in the direction of the circles velocity.
Find the intersection points of this line and the circle at both time points.
Form a line segment with the intersection points.
If this line segment contains the closest point to the circle than the circle has collided with the line segment at that point.
I prefer not to use the first.
Is there a formula that calculates a point on a line segment that is closest to a circle? Could I use the parametric equation of a circle?
I think the closest point should either be one of the end points or the intersection point of the segments perpendicular bisector that contains the center of the circle.