vtkImplicitPolyDataDistance calculates incorrect sign in some specific cases
In some specific cases, vtkImplicitPolyDataDistance calculates the wrong sign when calling EvaluateFunction. It appears to only occur when the query point sits directly above the edge of a face as shown in the image below.
The code to reproduce this issue is as follows.
const double length = 1.0; vtkNew<vtkCubeSource> cube; cube->SetXLength(length); cube->SetYLength(length); cube->SetZLength(length); cube->Update(); vtkNew<vtkImplicitPolyDataDistance> signed_distance; signed_distance->SetInput(cube->GetOutput()); double test_distance = signed_distance->EvaluateFunction(-0.5, 0.7, 0.);
With this code, the value of test_distance is -0.2 instead of 0.2.