VTK 9.0.0: vtkStaticCellLocator::FindClosestPoint, Invalid Closest Point
Hello,
I noticed that the function FindClosestPoint
in vtkStaticCellLocator
does not yield the closest point as intended. I compared this to the functionality of the equivalent function in vtkCellLocator
, which works properly.
FindClosestPoint
in vtkStaticCellLocator
is much faster than FindClosestPoint
in vtkCellLocator
. I believe one of the reasons for this, is this discrepancy. Basically, FindClosestPoint
in vtkStaticCellLocator
looks like a hack that calls FindClosestPointWithinRadius
with an infinite radius. However, FindClosestPointWithinRadius
does not look like it works properly when searching the entire octree.
Curiously enough, if the lines (985-988) in FindClosestPointWithinRadius
, vtkStaticCellLocator
are commented out, then FindClosestPoint
works properly but is much slower than the version in vtkCellLocator
. These are the lines:
// stop if bounding box is further away than current closest point
if (binDist2 > minDist2)
{
break;
}
I have attached a screenshot showing a comparison of the results of the two locators. Vertices are given a color depending on how far away they are from the closest point on a bounding mesh. The further away they are, they more blue they are, and the less further away they are, the more red they are. As you can see, in the case of vtkStaticCellLocator
, there is a weird straight line with a very rough change in distances, which is not present in the output of vtkCellLocator
, which finds the correct closest points and results in a much better output. There are also many other issues in other parts of the mesh. The two locators are used in the exact same way.