Intersection Between a Plane and a Segment



\begin{tikzpicture}
  % grid
  \draw[help lines] (-4,-3) grid (5,4);
  
  % origin
  %\draw[red, line width=.1mm] (-0.1,-0.1) -- (0.1,0.1)
  %  (0.1,-0.1) -- (-0.1,0.1);
  %\coordinate[label={[red]above:$O$}] (O) at (0,0);
  
  %\draw[black,line width=5mm] (-3, {3 * sqrt(3) - sqrt(3)}) -- ((-3,0);
  %\node [square,rotate={30},minimum size=10mm] at (-3, {3 * sqrt(3) - sqrt(3)}) [draw] (d2) [orange,fill,text=white] {$d_{2}$};
  %\draw[orange,line width=.1mm] (-3, {3 * sqrt(3) - sqrt(3)}) -- (-2,0); 
  %\draw[orange,line width=.1mm] (-3, {3 * sqrt(3) - sqrt(3)}) -- (0,2);
  
  % coordinates
  \coordinate[label={[black]left:$A$}] (A) at (-1,1.5);
  \coordinate[label={[black]left:$B$}] (B) at (-2,-1);
  \coordinate[label={[black]right:$C$}] (C) at (2,-1);
  \coordinate[label={[black]right:$D$}] (D) at (3,1.5);
  \coordinate[label={[black]left:$P_{0}$}] (P0) at (-.5,-2);
  \coordinate[label={[black]right:$P_{1}$}] (P1) at (1,2.5);
  \coordinate (R) at (-.15,-1);
  \coordinate[label={[black]right:$I$}] (I) at (.35,.5);
  \coordinate (N) at (.35, 3);
  
  % plane 
  \draw[black, line width=.1mm] (A) -- (B) -- (C) -- (D) -- cycle;
  % mark points
  \drawpoint{P0}{.5mm}{black};
  \drawpoint{I}{.5mm}{black};
  \drawpoint{P1}{.5mm}{black};
  
  % line
  \draw[black, line width=.1mm] (P0) -- (R);
  \draw[dotted, black, line width=.1mm] (R) -- (I);
  \draw[black, line width=.1mm] (I) -- (P1);
  
  % normal
  \draw[->, black, line width=.1mm] (I) -- (N);
  % brace normal
  \drawbrace{I}{N}{2mm}{cyan}{$\vec{n}$}{-6mm}{2mm}{}
  
\end{tikzpicture}

The segment may $P_{0}, P_{1}$ intersect the plane formed by $ABCD$ with the normal $\vec{n}$ in any (or all) generic point $I$ on the segment.

The line equation in parametric form can be expressed as:

\begin{eqnarray*}
P &=& P_{0} + t(P_{1} - P_{0})
\end{eqnarray*}

where $P$ is the intersection between the segment $P_{0}, P_{1}$ and the plane $ABCD$ and values of $t$ will yield points on that segment.

The equation of the plane can be expressed as:

\begin{eqnarray*}
\vec{n} \cdot P &=& \vec{n} \cdot P_{2}
\end{eqnarray*}

where $P_{2}$ can be any known point in the plane $ABCD$.

We plug the line equation into the equation of the plane:

\begin{eqnarray*}
\vec{n} \cdot (P_{0} + t(P_{1} - P_{0})) &=& \vec{n} \cdot P_{2}
\end{eqnarray*}

and distribute the normal vector $\vec{n}$:

\begin{eqnarray*}
\vec{n} \cdot P_{0} + \vec{n}\cdot t(P_{1} - P_{0}) &=& \vec{n} \cdot P_{2}
\end{eqnarray*}

then collect for $t$:

\begin{eqnarray*}
\vec{n} \cdot t(P_{1} - P_{0}) &=& \vec{n} \cdot P_{2} - \vec{n} \cdot P_{0}
\end{eqnarray*}

then group on the right-hand side of the equation:

\begin{eqnarray*}
\vec{n} \cdot t(P_{1} - P_{0}) &=& \vec{n} \cdot (P_{2} - \cdot P_{0})
\end{eqnarray*}

and collect again for $t$ we obtain the equation for $t$:

\begin{eqnarray*}
t &=& \frac{\vec{n} \cdot (P_{2} - \cdot P_{0})}{\vec{n} \cdot (P_{1} - P_{0})}
\end{eqnarray*}

Now, based on the equation, we can make the following judgments: