In the context of a game program, I have a moving circle and a fixed line segment. The segment can have an arbitrary size and orientation.
- I know the radius of the circle: r
- I know the coordinates of the circle before the move: (xC1, yC1)
- I know the coordinates of the circle after the move: (xC2, yC2)
- I know the coordinates of the extremities of the line segment: (xL1, yL1) - (xL2, yL2)
I am having difficulties trying to compute:
- A boolean: If any part of the circle hits the line segment while moving from (xC1, yC1) to (xC2, yC2)
- If the boolean is true, the coordinates (x, y) of the center of the circle when it hits the line segment (I mean when circle is tangent to segment for the first time)