Maths & numbers
Infinite line & circle intersections
Find where the line through two points crosses a circle.
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
| Point | X | Y |
|---|---|---|
| 1 | -5 | 0 |
| 2 | 5 | 0 |
The line extends infinitely through A and B; this is not restricted to the AB segment.