Maths & numbers
Line segment intersection
Find a crossing point or collinear overlap between two finite segments.
A clear answer. Here’s how.
Checks finite segments AB and CD, including point-like degenerate segments, endpoint contact and collinear overlap. Returns zero, one point, or the two endpoints of an overlapping segment. Uses length-relative geometric tolerances around 10⁻¹⁰ and clamps tiny endpoint overshoots. The segments are not extended as infinite lines. Inputs use a common Cartesian unit.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- A X
- 0
- A Y
- 0
- B X
- 4
- B Y
- 4
- C X
- 0
- C Y
- 4
- D X
- 4
- D Y
- 0
Example result
| Point | X | Y |
|---|---|---|
| 1 | 2 | 2 |
Point