Math formulas and cheat sheets for Lines in three dimensions

Lines in three dimensions

Line forms

Point direction form:

x−x1a=y−y1b=z−z1c

Two point form:

x−x1x2−x1=y−y1y2−y1=z−z1z2−z1

Parametric form:

xyz=x1+tcosα=y1+tcosβ=z1+tcosγ

Distance between two lines in 3 dimensions

The distance from P2(x2,y2,z2) to the line through P1(x1,y1,z1) in the direction (a,b,c) is

d=[c(y2−y1)−b(z2−z1)]2+[a(z2−z1)−c(x2−x1)]2+[b(x2−x1)−a(y2−y1)]2a2+b2+c2−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−√

The distance between two lines. First one through P1(x1,y1,z1) in direction (a1,b1,c1), Second one: through P2(x2,y2,z2) in direction (a2,b2,c2) is:

d=∣∣∣∣x2−x1a1a2y2−y1b1b2z2−z1c1c2∣∣∣∣∣∣∣b1b2c1c2∣∣∣2+∣∣∣c1c2a1a2∣∣∣2+∣∣∣a1a2b1b2∣∣∣2−−−−−−−−−−−−−−−−−−−−−−−−−−−√

The two lines intersect if:

∣∣∣∣x2−x1a1a2y2−y1b1b2z2−z1c1c2∣∣∣∣=0