IntersectWithLine pure 2D

Hi,

I’ve used various trees within the vtk api for quite sometime and many of the FindCell* and IntersectWith* type functions to great success for 3D meshes. I have a pure 2D mesh now, quads only. Produced from vtkCellTypeSource with zero in the z direction.
I have a line (with a zeroed z-component just to ensure it’s planar with the mesh) and I’m trying to intersect the line with the quad mesh and get back the intersection points (and the cell ids of the intersections) as per the method that returns the cells and points that are intersected in order for a finite length line.
As I note, works in 3D in the past when I’ve used it, but oddly appears not to work in pure 2D. Is that to be expected? Are there any work arounds to have this functionality for a 2D mesh and obtain all the intersection points that a line makes?
As an aside I’ve tried to extract the edges of the quads with vtkExtractEdges, and pass this mesh to the locator to work with. That doesn’t seem to have any more success either. No code to post at present as this is all wrapped up in quite a large code base.

Any thoughts?
Cheers,
Andy

I had a very similar issue with probe filter, trying to sample a 2D image plane with a line.

I’ve found that extents of the objects must intersect. In that check in the probe filter, no tolerance value is used, so I ended up perturbing the two ends of the line to make sure that it actually crosses the plane.

A more generic, robust solution would be to use some tolerance during intersection computation: if extents are closer than the tolerance then they would be considered as intersecting.