pjt33


«
Reply #1  Posted
20121107 20:32:55 » 

Find a normal N to the quad (as robustly as possible!)
Pick a point P in the quad. In the interests of robustness, my intuition says that you want the corner nearest the centroid of the triangle.
For each vertex V_i of the triangle, compute d_i = (V_i  P) . N.
If all three vertices have the same sign dot product, there is no intersection. Otherwise they will split 12. [1] Wlog say that V_0 is positive and V_1 and V_2 are negative.
The intersection between the triangle and the plane of the quad runs from (d_0 V_1  d_1 V_0) / (d_0  d_1) to (d_0 V_2 + d_2 V_0) / (d_0  d_2). Then clip that against the quad.
[1] Ignoring the special case where one of them is 0.
