Function VectorMath.LineCircleIntersectionFactor
LineCircleIntersectionFactor
(Vector3 circleCenter, Vector3 linePoint1, Vector3 linePoint2, float radius)
Intersection of a line and a circle.
Public
Static
float LineCircleIntersectionFactor (
circleCenter | ||
linePoint1 | ||
linePoint2 | ||
float | radius |
Intersection of a line and a circle.
Returns the greatest t such that segmentStart+t*(segmentEnd-segmentStart) lies on the circle.
In case the line does not intersect with the circle, the closest point on the line to the circle will be returned.
Note
Works for line and sphere in 3D space as well.
See
http://mathworld.wolfram.com/Circle-LineIntersection.html
https://en.wikipedia.org/wiki/Intersection_(Euclidean_geometry)#A_line_and_a_circle