Inputs
Example Data
| # | (x1,y1) | (x2,y2) | (x3,y3) | (x4,y4) | Scenario | |
|---|---|---|---|---|---|---|
| 1 | (0,0) | (6,6) | (0,6) | (6,0) | Proper segment intersection | |
| 2 | (0,0) | (4,0) | (0,2) | (4,2) | Parallel distinct lines | |
| 3 | (0,0) | (6,0) | (2,0) | (8,0) | Collinear overlapping segments | |
| 4 | (0,0) | (1,1) | (3,0) | (4,1) | Lines intersect outside both segments | |
| 5 | (2,-2) | (2,4) | (-1,1) | (4,1) | Vertical with horizontal |
Results
Formula Used
Represent each line in general form: A x + B y = C with A = y₂ − y₁, B = x₁ − x₂, C = A x₁ + B y₁. For the second line, A′ = y₄ − y₃, B′ = x₃ − x₄, C′ = A′ x₃ + B′ y₃.
The determinant Δ = A B′ − A′ B. If |Δ| ≈ 0, the lines are parallel or collinear. Otherwise, the intersection point is
x = (B′ C − B C′)/Δ, y = (A C′ − A′ C)/Δ.
Segment inclusion: compute parameters t and u along each segment. For segment 1, use t = ((x − x₁)/(x₂ − x₁)) if |x₂ − x₁| ≥ |y₂ − y₁|, else t = ((y − y₁)/(y₂ − y₁)). Similarly compute u for segment 2. If 0 ≤ t ≤ 1 and 0 ≤ u ≤ 1, the intersection lies on both segments.
How to Use
- Enter coordinates for P₁(x₁,y₁), P₂(x₂,y₂) to define the first line.
- Enter coordinates for P₃(x₃,y₃), P₄(x₄,y₄) to define the second line.
- Select Compute to see classification, intersection coordinates, and algebraic details.
- Use the Download CSV or Download PDF buttons to export results.
- Try Example Data rows to quickly explore different scenarios.