vtkCellLocator's FindCellsAlongLine Method on elements oriented at an angle in a plane.

Hello Everyone,

I have been using the FindCellsAlongLine method to find any cells which intersect my given line. But this method fails for geometries which are oriented at an angle.

For example, I have a geometry which is oriented at an angle in the XZ plane. I have point P1 which is before the geometry and point P2 which is behind the geometry. Note that the line connecting P1 and P2 doesn’t touch the geometry anywhere as shown in the following figures. But the result I have shows there are some cells along line.


I understood from the documentation and source code that the check for the intersect with line is done for cell bounds and those cells bounds are big too because of my geometry orientation and those bounds act as a virtual wall.

Is there any method where we cannot have this issue?

Before your opinion, I would like to share you what I tried to do.

I tried to use vtkLoopSubDivisionFilter to increase my triangles. And it did work with this geometry and I have better results with the vtkCellLocator. But I have geometries where this vtkLoopSubdivisionFilter fails because of non-Manifold Edges.

Thank You,
RC

Found My Mistake!!

After Getting the results from FindCellsAlongLine method. I am supposed to do the check for the intersection with cells using vtkGenericCell’s Intersect with line method. I have found a reference for this in the vtkSelectEnclosedPoints.cxx. It is located in IsInsideSurface method.

Let me paste the code:

// Retrieve the candidate cells from the locator to limit the
    // intersections to be attempted.
    locator->FindCellsAlongLine(x, xray, tol, cellIds);
    numCells = cellIds->GetNumberOfIds();

    counter.Reset();
    for (idx = 0; idx < numCells; idx++)
    {
      surface->GetCell(cellIds->GetId(idx), genCell);
      if (genCell->IntersectWithLine(x, xray, tol, t, xint, pcoords, subId))
      {
        counter.AddIntersection(t);
      }
    }