How to efficiently determine whether or not there is a collision between two 3D triangles?

83 Views Asked by At

What formula can efficiently tell if two 3D triangles collide or not?

1

There are 1 best solutions below

0
On

Each triangle is determined by three points. These also determine planes. So you can write two equations for planes that look something like:

$$A x+ By +Cz = 0, \qquad Dx+Ey+Fz=0$$

These will either have no simultaneous solutions (parallel planes), in which case the triangles do not inersect; they will define the same plane, in which case you've reduced the problem to 2D geometry; or, they will have simultaneous solutions in the form of a line: $$ p(t) = p(0) + t \vec{v}$$ For some initial point $p$ and vector $v$.

Now in each plane the points inside the triangles themselves are defined by three inequalities (six total). For each of these six inequalities you can determine the range of values of $t$ such that $p(t)$ satisfies the inequalities. The intersection of these six ranges will give the intersection of the triangles along the line $p(t)$.

Hope that helps.