Improve vtkTriangle intersection with coplanar line
Currently the function vtkTriangle::IntersectWithLine returns 0 (no intersection) if the line is coplanar to the triangle, even if there is intersection.
// Build triangle
double pt0[3] = { 0, 0, 0 };
double pt1[3] = { 0, 10, 0 };
double pt2[3] = { 0, 0, 10 };
vtkNew<vtkTriangle> coplanarTriangle;
coplanarTriangle->GetPoints()->SetPoint(0, pt0);
coplanarTriangle->GetPoints()->SetPoint(1, pt1);
coplanarTriangle->GetPoints()->SetPoint(2, pt2);
// Define line extremities with first extremity inside
double ext1[3] = { 0, 1, 5 };
double ext2[3] = { 0, 11, 5 };
double t;
double x[3];
double pcoords[3];
int subId;
// Function returns 0
int result = coplanarTriangle->IntersectWithLine(ext1, ext2, dEpsilon, t, x, pcoords, subId);
A suggestion could be that instead, if there is coplanarity, the function should first verify whether there is intersection to return the correct output, and the intersecting point should be defined as the point on the triangle closest to the first extremity of the line.