Line–line intersection

Consider the two lines defined by

r=r0+tm and s=s0+pn.

These lines may or may not intersect. In 2, their are three cases:

collinear ()
The two lines are equal. Formally, t p such that r=s. This implies that m=kn, meaning the direction vectors are scalar multiples of each other. The initial points need not be equal, but each must lie on the other line: there must exist values of t and s such that s0=r and r0=s. There are points of intersection.
parallel (0)
The two lines are parallel, so m=kn, but they are not collinear. For all combinations of values of t and p, rs. The lines never intersect.
nonparallel (1)
All other systems fall into this category. The lines are nonparallel, so mkn. There is exactly one point of intersection.
Collinear, parallel, and nonparallel pairs of lines in two-space

In 3, there is one more possibility: skew lines. These are lines that are nonparallel but do not intersect. To see how this is possible, simply point your arms in different directions. Unless you deliberately put them on the same plane, they will not intersect even when extended to infinity.

Finding the point of intersection for two lines in two-space in y=mx+b form is easy: all you have to do is solve a linear system. With these new types of equations, it’s a bit more work. To find the point(s) of intersection of two lines in 3, follow these steps:

  1. Express both lines with parametric equations using different variables for the free parameters, such as t and p.
  2. Set the right-hand sides of the x equations equal. Do the same for y and z. Now you have a system of three equations.
  3. Choose two of the equations and solve the system for t and p. You will be unable to do this if the lines are collinear or parallel.
  4. Perform an LS/RS verification of the as yet unused equation with the values of t and p that you just found.
  5. If LS=RS, the system is consistent. If not, the system is inconsistent and the line are skew.
  6. If the system was consistent, substitute the value of t or p into the parametric equations of its line to find the point of intersection.
  7. For extra verification, substitute the other free parameter into the other line equations and make sure you get the same point.