[Math] Find the plane a triangle lies on

collision detectiontriangles

I am trying to determine if the plane on which two triangles lie intersects for a collision-detection implementation. Unfortunately, I'm stuck at step one, which is finding the plane on which a triangle lies. I tried looking around on Google and what I can find seems to imply that I need to find the normal to the plane instead of the plane, and the direction of the normal. Can anyone explain why I just need to find those two?

Best Answer

The normal to a plane in 3-D space is the vector $\langle a,b,c \rangle$ which is the direction pointing out perpendicular to the plane. This normal, together with an "anchor point" $(x_0,y_0,z_0)$, define a plane: $$a(x-x_0)+b(y-y_0)+c(z-z_0)=0$$ You can use the cross product $\times$ of two of the sides of your triangle to find the normal. Say your triangle has endpoints $p,q,r$. Then the normal could be found as $(r-p)\times(q-p)$.

$(r-p)$ and $(q-p)$ are vectors which point along the sides of your triangle, so then the output of the crossproduct, which is perpendicular to the two inputs, will be normal the plane on which the triangle lies.

(Note: it does not matter how you choose which corner of your triangle to be $p,q,$ or $r$; the result will be the same)

Related Question