-
This commit fixes an issue that has been inconveniencing VTK users for many years. vtkSelectPolyData allows extraction of a surface patch from a larger surface that is inside (or outside) of a closed curve on the surface. This filter preserves the original mesh geometry and provides smooth edges, so it is most often the best cutting filter. However, it was known to randomly fail for clean, flawless meshes. The problem was reported in the issue tracker (#17309) and many times on the VTK mailing list and forum, such as: - https://discourse.vtk.org/t/spline-to-clip-a-polydata/1542 - https://discourse.vtk.org/t/clippolydata-with-points-that-are-all-around-the-polydata/5337 - https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315 - https://discourse.vtk.org/t/extracting-triangles-from-polydata-while-keeping-geometry-and-topology/1557 We investigated the issue and found that the error is due to using a heuristic greedy path search algorithm to find edge between the input loop points. This method only works well if there is always an edge from the current point in the direction of the next loop point, which is of course not always the case. We fixed the issue by adding an option to use proper Dijkstra shortest path search between the loop points, which is guaranteed to find the shortest path. Added a test that verifies that a loop that causes "Can't follow edge" error with the greedy method successfully completes with the Dijkstra method. The default method is still the greedy method to preserve backward compatibility. fixes #17309 Co-authored-by: Andras Lasso <lasso@queensu.ca>
763fff4a