Skip to content
  • Spiros Tsalikis's avatar
    CellLocators: Unify IntersectWithLine/FindCellAlongLine · 5af0b700
    Spiros Tsalikis authored
    vtkCellLocator(CL), vtkStaticCellLocator(SCL), vtkCellTreeLocator(CTL)
    vtkModifiedBSPTree(BSP) now all have a similar implementation with regard
    to their IntersectWithLine and FindCellAlongLine functions. FindCellAlongLine
    is actually a special case of a more general IntersectWithLine that returns
    points/cellIds which now all cell locators implement, and therefore they also
    support FindCellAlongLine (new for CTL, BSP).
    
    Inside those functions the given tolerance is now also used not only for the cell's
    intersectWithLine function but also for checking for intersection with the bounds
    of the cell itself which happens before that. This is needed because if we don't use
    the tolerance in the bounds check, for a line that passes right next to the bounds of
    a quad, the cell's IntersectWithLine using the tolerance can return that there was an
    intersection, but the intersection with the bounds of cell could say return no intersection,
    if the tolerance is not used. This way we could have a false-negative.
    
    In the past SCL had issues with not intersecting with cells in the functions
    IntersectWithLine/FindCellsAlongALine. For that reason Tolerance was introduced to
    ameliorate this issue by padding the bins by the Locator's Tolerance. Tolerance needed
    to be removed because nobody was using it except 1-2 classes that had the
    problem of intersection, and it would lead to really slow performance
    if the dataset was small bounds-wise, because the default Tolerance was 0.001.
    
    The intersection issues have actually been resolved thanks to the double
    tolerance that Will Schroeder introduced in FindCellsAlongALine and I copied
    in IntersectWithLine as well. This way, we get more accurate and faster, results
    with a smaller memory foot-print. Since Tolerance is no longer used,
    vtkStaticCellLocator's UseDiagonalLengthTolerance has also been deprecated.
    
    CTL's and BSP's IntersectWithLine have become thread-safe, while the none thread-safe
    functions can still be called through the functions of the vtkAbstractCellLocator.
    
    BSP has now the option of not caching cell bounds.
    
    Finally, vtkAbstractCellLocator now clearly states which functions are
    thread-safe or not and the documentation has been unified throughout
    all the cell locators.
    5af0b700