Circle line-segment collision detection algorithm?
问题 I have a line from A to B and a circle positioned at C with the radius R. What is a good algorithm to use to check whether the line intersects the circle? And at what coordinate along the circles edge it occurred? 回答1: Taking E is the starting point of the ray, L is the end point of the ray, C is the center of sphere you're testing against r is the radius of that sphere Compute: d = L - E ( Direction vector of ray, from start to end ) f = E - C ( Vector from center sphere to ray start ) Then