Function VectorMath.SegmentCircleIntersectionFactors

SegmentCircleIntersectionFactors (float2 point1, float2 point2, float radiusSq, out float t1, out float t2)

Calculates the two intersection points (lerp(point1, point2, t)) on the segment where it intersects with a circle at the origin.

Public Static
bool SegmentCircleIntersectionFactors (

float2

point1

Start of the segment

float2

point2

End of the segment

float

radiusSq

The squared radius of the circle at the origin.

out float

t1

The first intersection (if any). Between 0 and 1.

out float

t2

The second intersection (if any). Between 0 and 1.

)

Calculates the two intersection points (lerp(point1, point2, t)) on the segment where it intersects with a circle at the origin.

t1 will always be less than or equal to t2 if there are intersections.

Returns false if there are no intersections.