CPKit
v1.6.1

Line Intersection

GeometryMedium

Verify slope intersections of segments and infinite lines.

Alt+Shift+I

Segment Intersection Grid (Drag A, B, C, or D)

A (-4, 3)B (4, -1)C (-2, -4)D (2, 4)Intersect (0.4, 0.8)
Determinant slope check:80
Lines Status:Intersecting
Intersection Point:(0.40, 0.80)
Lies Within Finite Segments:Yes (Segments intersect)

Time Complexity

O(1) direct equation

Space Complexity

O(1) auxiliary
Conceptual Overview

Line Intersection determines if two lines (infinite or finite segments) meet at a common coordinate, detecting parallel/coincident states.

Mathematical Formula
a_1 x + b_1 y = c_1 \\ a_2 x + b_2 y = c_2 \\ x = \frac{b_2 c_1 - b_1 c_2}{a_1 b_2 - a_2 b_1}, \ y = \frac{a_1 c_2 - a_2 c_1}{a_1 b_2 - a_2 b_1}
Source: CP-Algorithms geometry reference