vtkTriangle::PointInTriangle returns true if on extended line of line segment
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The method vtkTriangle::PointInTriangle returns true if the point is on the full line of one of the line segments, and thus NOT in the triangle. This is not an edge problem, but a serious error. In the following code, all points are in the triangle according to vtkTriangle::PointInTriangle(...), while only the second should be: void vtkTriangleTest(){ double p1[3] = {0,7,0}; double p2[3] = {0,10,0}; double p3[3] = {5,7,0}; double x1[3] = {0,11,0}; double x2[3] = {0.0001,8,0}; double x3[3] = {0,1,0};
if (vtkTriangle::PointInTriangle(x1, p1, p2, p3, 0.01)){
std::cout << "1: " << "Point in triangle" << std::endl;
}
else std::cout << "1: " << "Point NOT in triangle" << std::endl;
if (vtkTriangle::PointInTriangle(x2, p1, p2, p3, 0.01)){
std::cout << "2: " << "Point in triangle" << std::endl;
}
else std::cout << "2: " << "Point NOT in triangle" << std::endl;
if (vtkTriangle::PointInTriangle(x3, p1, p2, p3, 0.01)){
std::cout << "3: " << "Point in triangle" << std::endl;
}
else std::cout << "3: " << "Point NOT in triangle" << std::endl;
}