# Find the point of intersection of a plane

I would like to determine the point of intersection of a line which crosses a plane. If I were to do it by hand, I would proceed as follows:

1. Find the parametric representation for line $r(t) = (x_0,y_0,z_0)$ $t(x_1-x_0, y_1-y_0,z_1-z_0)$
2. Sub into the plane equation
3. Solve for (t)
4. Find point of intersection

How can I do this in Mathematica?

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Apr 8 '15 at 14:05
• Please add working code to make reproduction of your problem possible. Otherwise answering will be difficult. – user9660 Apr 8 '15 at 14:06

Example:

   planeEqn = 2 x - 3 y + 7 == 0;
pt = {-1, 4, 2};
dir = {3, 3, -1};
r[t_] := pt + t dir

t1 = t /. First@Solve[planeEqn /. Thread[{x, y, z} -> r[t]], t]
(* -7/3 *)
r[t1]
(* {-8, -3, 13/3} *)

int[n_, pip_, p1_, p2_] :=
p1 t + (1 - t) p2 /. First@Solve[(t p1 + (1 - t) p2).n == pip.n, t];
int2[{p1_, p2_, p3_}, {p4_, p5_}] :=
int[Cross[p2 - p1, p3 - p1], p1, p4, p5]


With int, n is normal to plane and pip is point in plane, p1 and p2 define line. int2uses {p1,p2,p3} as three points in plane and {p4,p5} points defining the line. A line in the plane will return the line. When there is no intersection an error will be thrown. I leave it to interested party to correct (and clean to deal with degenerate specifications).

For fun (and to illustrate use of InfinitePlane,InfiniteLine,RegionIntersection):

DynamicModule[{r = RandomReal[{0, 5}, {2, 3}],
s = RandomReal[{0, 5}, {3, 3}]},
Grid[{{Dynamic@Button["Line", r = RandomReal[{-5, 5}, {2, 3}]],
Dynamic@Row[{"r[t]=", Simplify[t r[] + (1 - t) r[] ]}]},
{Dynamic@Button["Plane", s = RandomReal[{-5, 5}, {3, 3}]],
Dynamic[Simplify[
Cross[s[] - s[], s[] - s[]].({x, y, z} - s[]) ==
0]]}, {Dynamic@
Graphics3D[{InfinitePlane[s], {Blue, Thick,
InfiniteLine[r]}, {Red, PointSize[0.04], Point[int2[s, r]]}},
PlotRange -> All, Boxed -> False, ImageSize -> Medium],
Dynamic[int2[s, r]]}
, {"Region Intersection",
Dynamic@RegionIntersection[InfinitePlane[s], InfiniteLine[r]]}},
Frame -> All]] 