Advertisement

Intersection of two lines calculator

Choose an equation form. Parametric directions must be nonzero, and 3D lines may be skew.

Calculator

Relationship
Unique intersection
Intersection x
3.00000000
Intersection y
2.00000000
Intersection point
(3, 2)

Advertisement

How this calculator works

All input forms are converted to points and direction vectors. Parallel directions give either coincident or disjoint lines. Otherwise a cross-product test checks whether the point displacement lies in the plane of both directions. Noncoplanar spatial lines are skew. Coplanar nonparallel lines have one intersection. Direction and displacement tests use a relative tolerance of 1e-12, so extremely close or nearly parallel lines may need exact methods.

Formula

For P + t U and Q + s V, let D = Q-P and C = U cross V. If C is nonzero and D dot C = 0, t = ((D cross V) dot C)/|C|^2.

Worked example

The equations x + y = 5 and x - y = 1 meet at (3, 2). In 3D, (t, 0, 0) and (0, s, 1) are skew because their z coordinates can never agree.

Advertisement

Frequently asked questions

Does this intersect segments or full lines?

It intersects the full infinite lines. A point outside either finite segment remains a valid line intersection.

Can vertical lines be entered?

Yes. Use standard or parametric form; slope form cannot express a vertical line.

What does coincident mean?

Both inputs describe the same infinite line, so there is no unique intersection point.

Sources

Advertisement