



 
Hi, I am going to change your points $A, B, C, D$ and $E$ to $A(0,1,2), B(1,0,1), C(2,1,1), D(0,1/2,0)$ and $E(1,1,2)$ to make the problem slightly more interesting. With these coordinated a vector in the direction from $D$ to $E$ is $(1, 1/2, 2)$. Thus the equation of the line containing $D$ and $E$ is \[x = t, y = \frac12 + \frac12 t, z = 2t\] Notice that a point on the line is on the line segment from $D$ to $E$ if and only if $0 \leq t \leq 1.$ Now I need the equation of the plane containing the triangle $ABC.$ The vector from $A$ to $B$ is $\vec{u} = (1,1,1)$ and the vector from $A$ to $C$ is $\vec{v} = (2,1,0).$ The cross product of $\vec{u}$ and $\vec{v}$ is a vector $\vec{n} = (1,1,2)$ which is normal to the plane containing $A, B,$ and $C.$ Hence the equation of the plane containing $A,B$ and $C$ is \[1(x0) +1(y1) + 2(z2) = 0 \mbox{ or } x +y +2z = 5.\] To determine the point $P$ where the line meets the plane substitute the equation of the line into the equation of the plane and solve for $t.$ I got $t = \large \frac{9}{10}$ and the point $P$ has coordinates $(\large \frac{18}{20}, \frac{19}{20}, \frac{36}{20}\normalsize ).$ Since $t$ satisfies $0 \leq t \leq 1$ the line segment intersect the plane containing the triangle. Finally let's determine if $P$ is in the triangle. To accomplish this I am going to use the vectors $\vec{u}, \vec{v}$ and $\vec{n}$ again. Use these three vectors for a base and write the point $P$ in this basis. That is find $p, q$ and $r$ so that \[p \vec{u} + q \vec{v} + r \vec{n} = P.\] The point $P$ is inside or on the boundary of the triangle if $p,q \geq 0$ and $p+q \leq1.$ (See Wolfram Math World.) The linear system \[p \vec{u} + q \vec{v} + r \vec{n} = P.\] is \begin{eqnarray*} Solving this system yields \[p = \frac{1}{10} \mbox{ and } q = \frac{7}{40}.\] Since $q < 0$ the point $P$ is not inside or on the perimeter of the triangle. Write back if you need more help, RJ wrote back
The code you sent didn't arrive in a readable form and it doesn't matter since I am not a coder. I do have a suggestion however. On the stackoverflow page you use a technique in two dimensions involving the areas of four triangles to decide if $P$ is inside the triangle $ABC.$ You can use a similar technique in three dimensions if you know the coordinates of $A, B, C$ and $P,$ and $P$ is in the plane containing triangle $ABC.$ First use the formula for the distance $d$ between two points $(x_0, y_0, z_0)$ and $(x_1, y_1, z_1)$ in 3space \[d = \sqrt{(x_1  x_0)^2 + (y_1  y_0)^2 + (z_1  z_0)^2)}\] to find the lengths of $AB, BC, CA, AP, BP$ and $CP.$ Then use Heron's Formula to calculate the areas triangles $ABC, APB, APC,$ and $BPC$ and check to see if the area of triangle $ABC$ is the sum of the areas of the other three. The challenge here is to determine if $P$ is on the plane containing the triangle and if so to determine the coordinates of $P.$ The technique I described earlier does work. The question you originally asked is a geometric problem in three space and you are going to have to use some three dimensional geometry to solve it. Harley 



Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences. 