Line and triangle intersection in 3D

analytic geometrygeometry

The problem states:

Find the intersection of the triangle $A(1, 0, -1), B(2, -1, 2), C(0, 0, 1)$ and the line $\frac{x+1}{2} = \frac{y}{-1} = \frac{z-1}{0}$

The method that I've tried using is first finding the equation of a plane that the triangle lies on. The normal vector I've found by taking the cross product of any two vectors from the same point of the triangle, for example:

$$\vec{AB} \times \vec{AC} = \Bigg{|} \begin{matrix}e_1 && e_2 && e_3 \\ 1 && -1 && 3 \\ -1 && 0 && 2 \end{matrix} \Bigg{|}$$

giving me the vector $\vec{n_{\alpha}} = (2,5,1)$. Then the equation of the plane becomes:

$$\alpha: 2x+5y+z-1=0$$

Now by transforming the line into parametric form and substituting the coordinates into the plane equation I've found the intersection of the line and the plane to be the point $M(-5,2,1)$

And now I'm stuck, because I don't know how to determine whether the point $M$ is inside the triangle. I remember that in 2D this can be done by checking the orientations of the triangles $AMC, ABM $ and $BCM$, and if they're the same that would mean the point lies inside the triangle $ABC$. However, since it's 3D here I can't do that.

So, any ideas?

Thanks.

Best Answer

If the point lies in the triangle it will be a convex linear combination of the vertices, i.e, $M = \lambda_1 A + \lambda_2 B + (1-\lambda_1-\lambda_2) C$, for some $\lambda_1, \lambda_2 \in [0,1]$. So you just have to solve the previous system and, if you get a solution satisfying $\lambda_i \in [0,1]$, the point $M$ lies in the triangle. This is equivalent to the solution proposed by Cesareo.

You should however review your question... The equation for the line is wrong so I cannot say if the rest of your calculations are ok. However, like Stan pointed out, Looking at the x-coordinates of $M,A,B,C$ you can immediately realize that the point you proposed is not inside the triangle.

Related Question