Function VectorMath.LineCircleIntersectionFactor

LineCircleIntersectionFactor (Vector3 circleCenter, Vector3 linePoint1, Vector3 linePoint2, float radius)

Intersection of a line and a circle.

Public Static
float LineCircleIntersectionFactor (

Vector3

circleCenter

Vector3

linePoint1

Vector3

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.