Maths & numbers

Infinite line & circle intersections

Find where the line through two points crosses a circle.

Infinite line & circle intersections
Esc to restore

Your inputs

Results update as you type. Larger files run when you press Update result.

Your result

LOCAL & PRIVATE

Your result will appear here.

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Normalises the direction from A to B, projects the circle centre onto the infinite line, then offsets along the line by the remaining radius. A and B must be distinct. Returns zero, one tangent point or two crossings, without restricting them to segment AB. Positive radius and common Cartesian units are required; near tangency uses a scale-relative floating-point tolerance.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

Line point A X
-10
Line point A Y
0
Line point B X
10
Line point B Y
0
Circle centre X
0
Circle centre Y
0
Circle radius
5

Example result

Example result
PointXY
1-50
250

The line extends infinitely through A and B; this is not restricted to the AB segment.