I am looking for an efficient way to determine the intersection point of two lines which go through a triangle (face) of a 3D triangular surface mesh.
For both lines I know the two points at which they intersect with the edges of a triangle (face). Denoted $P_A^1, P_B^1$ for the first line and $P_A^2, P_B^2$ for the second line (See illustrative example figure).
Based on my investigations my preferred approach would be to:
- Transform the the points of intersection for both lines ($P_A^1, P_B^1$ and $P_A^2, P_B^2$) into barycentric coordinates resulting in $B_A^1, B_B^1$ and $B_A^2, B_B^2$.
- Define two lines: $L_1$ which goes through $B_A^1, B_B^1$ and $L_2$ going through $B_A^2, B_B^2$ based on the two-point form defined in section 4.1.1. of this document
- Determine the point $B_I$ as the barycentric coordinates where $L_1$ and $L_2$ intersect based on the equations in section 4.3 of this document.
- Transform $B_I$ back into the cartesian coordinate system to have its 3D coordinates, denoted as $P_I$.
Unfortunately steps 2 and 3 do not lead to meaningful results (i.e., the intersection points fall outside the triangle) and I have doubts that I am applying equations in section 4.1.1. and section 4.3 properly.
Even when using a simple example based on the upper illustration in this figure here by defining $B^1_A=(1,0,0), B^1_B=(0,1/2,1/2)$ and $B^2_A=(0,1,0), B^2_B=(1/2,0,1/2)$ I cannot determine $B_I$ correctly as $B_I=(1/3,1/3,1/3)$ with the above procedure.