Line and triangle intersection in 3D

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.

• The $x$ coordinate lies on the left of all $x$ coordinates of the corners. May 13, 2019 at 8:33
• Is the line seriously given as $\frac{x+1}{2} = \frac{y}{-1} = \frac{z-1}{\color{red}{0}}$...?! May 13, 2019 at 8:42
• Why can’t you check the triangles’ orientation?
– amd
May 13, 2019 at 19:48

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.

• The equation for the line is given as a part of the problem, so how is it wrong exactly?
– Koy
May 13, 2019 at 11:12
• Problems can also be wrong... the term $\frac{z-1}{0}$ does not make any sense. May 13, 2019 at 13:54
• It's a convention that is used at our faculty. It simply means that the third component of the direction vector is $0$ and that the $z$ coordinate expressed by some parameter is $z-1 = 0t$ or $z = 1$
– Koy
May 13, 2019 at 13:56
• @Koy Ok but let me tell it is a really bad convention... An equal sign should stand for something. Anyway, this does not affect my answer. If you computed the intersection point correctly, you juist need to solve the linear system I mentioned and if both components of the solution $\lambda_1, \lambda_2$ belong to $[0,1]$ the point is in the triangle, otherwise it is not. May 13, 2019 at 14:02

Hint.

If $$M$$ is interior to $$ABC$$ then the two linear systems

$$M-A = \alpha_1(B-A)+\beta_1(C-A)\\ M-B = \alpha_2(A-B)+\beta_2(C-B)$$

have a solution with $$\alpha_i \ge 0$$ and $$\beta_i \ge 0$$