Hi everyone, today i saw this problem, and since i'm usually not good with 3D geometry, i tried to turn it into a linear algebra problem using barycentric coordinates. So if the vertices of the first triangle are A1, B1, C1 and the vertices of the second triangle are A2, B2, C2, we can represent points inside the first triangle like: A1*w1 + B1*w2 + C1*w3, such that w1+w2+w3 = 1, and we can get a similar equation for points inside the second one: A2*w4 + B2*w5 + C2*w6, such that w4+w5+w6 = 1. We also need 0 <= wi <= 1, for every 1 <= i <= 6. Now we can make an equation for the common points:
A1*w1 + B1*w2 + C1*w3 = A2*w4 + B2*w5 + C2*w6
which is actually two equations, one for X's and another for Y's.
Now we could work with 4 equations and maybe reach some conclusion by looking at the rank of the system of equations. But I don't have and idea about how to deal with the inequalities 0 <= wi <= 1.
Can the problem be solved this way? Anyways I would also be interested in another way to solve, or other problems where barycentric coordinates can be used.
Hey dude, I'm the geometry guy of the team xD
Then there's no need for ternary search, for each of the sides find the instersection between the line that contains the edge and the plane that contains the other triangle, you do this three times, for each of the points check if any of them is inside the triangle.
Yeah, but there should be an if somewhere to check if they actually intersect.