Intersecting Lines Example

Define Lines via Point + Direction

Define line L1 using the given point & direction:

p1={1,-2,3};u1={3,1,-2};

r1[t_]:=p1+u1*t;

Graph line L1 as a blue and thick line:

L1=ParametricPlot3D[r1[t],{t,-5,5},PlotStyle->{Thick,Blue},AxesLabel->{"X","Y","Z"}]

r1[-2]

Define line L2 using the given point & direction:

p2={-6,-2,8};
u2={-1,2,1};
r2[t_]:=p2+u2*t;

Graph line L2 as a red, dashed, and thick line:

L2=ParametricPlot3D[r2[t],{t,-5,5},PlotStyle->{Thick,Dashed,Red},AxesLabel->{"X","Y","Z"}]

Show lines L1 & L2 on a single plot:

Show[L1,L2]

Find point of intersection between lines L1 & L2:

Solve[r1[t]==r2[s],{s,t}]

Skew Lines Plotting Example

Define lines L3 & L4 using base points p3 & p4 and direction vectors u3 & u4:

p3 = {4, -5, 1};
p4 = {2, -1, 0};
u3 = {2, 4, -3};
u4 = {1, 3, 2};

r3[t_]:=p3 + u3*t;
r4[t_]:=p4+u4*t;

Plot lines together, adding a plot label, a different aspect ratio, dot-dashed & dotted lines,  as well as changing the font and size of the labels.

L3 = ParametricPlot3D[r3[t],{t,-5,5}, PlotStyle->{Thick,Red,DotDashed} , AxesLabel->{"X","Y","Z"}, PlotLabel->"Line #3", BaseStyle->Directive[Larger, FontFamily->"Times"], BoxRatios->{1,1,1}]

L4 = ParametricPlot3D[r4[t],{t,-5,5}, PlotStyle->{Thick,Blue,Dotted}, AxesLabel->{"X","Y","Z"}, PlotLabel->"Line #4", BaseStyle->Directive[Larger, FontFamily->"Times"], BoxRatios->{1,1,1} ]

Plot both lines on the same graph using the “Show” command.  Note that the character “\n” in the PlotLabel command inserts a line break in the plot label text, making the text easier to read.

Show[L3,L4, PlotLabel->"The skew lines r3(t) = (4,-5,1)+(2,4,-3)t \n and \n r4(t) = (2,-1,0)+(1,3,2)t", AxesLabel->{"X","Y","Z"}, BaseStyle->Directive[Larger, FontFamily->"Times"], BoxRatios->{1,1,1} ]