I want to find the intersection point on a surface of a line, where the line and the surface are both in the Z=0 plane. I would hope/expect that vtkCellLocator::IntersectWithLine always finds a point on the edge of the surface, closest to the starting point of the line, however this does not always seem to be the case. Also the behavior of the routine changed from VTK 9.1 to VTK 9.2. Is this an error or unintended use of the vtkCellLocator. If the latter is the case, is there an alternative to use for 2D situations?
I include a small script (intersect_with_line_2D.py (3.4 KB)) to demonstrate the behavior for some in-plane lines and one line (in the upper right corner) that runs in the Z-direction.
The lines are directed towards the dot, and the corresponding intersection point found by the cell locator is shown in red.
VTK 9.1
VTK 9.2
Output of VTK 9.2
sheet bounds=(0.0, 4.0, 0.0, 3.0, 0.0, 0.0)
line=((3.5, 2.5, 1), (3.5, 2.5, -1)) success=1 t=0.0 x=[3.5, 2.5, 0.0] pcoords=[0.6666666666666667, 0.75, 0.0] subId=0 cellId=0
line=((2.5, -1.0, 0), (-1, 2.5, 0)) success=1 t=0.0 x=[0.0, 1.5, 0.0] pcoords=[-0.0, -0.0, 0.0] subId=0 cellId=0
line=((-1, 3.5, 0), (3.5, -1, 0)) success=1 t=0.0 x=[2.0, 0.5, 0.0] pcoords=[0.3333333333333333, -0.0, 0.0] subId=0 cellId=0
line=((1, -1, 0), (1, 4, 0)) success=1 t=0.0 x=[1.0, 1.5, 0.0] pcoords=[0.0, 0.5, 0.0] subId=0 cellId=0
line=((-1, 1, 0), (1, 1, 0)) success=1 t=0.0 x=[0.0, 1.0, 0.0] pcoords=[0.6666666666666666, -0.0, 0.0] subId=0 cellId=0
line=((-1, 1.8, 0), (5, 1.8, 0)) success=1 t=0.0 x=[2.0, 1.8, 0.0] pcoords=[0.20000000000000004, -0.0, 0.0] subId=0 cellId=0
line=((5, 2.2, 0), (-1, 2.2, 0)) success=1 t=0.0 x=[4.0, 2.2, 0.0] pcoords=[0.4666666666666668, 1.0, 0.0] subId=0 cellId=0