search method

List<RTreeDatum<E>> search(
  1. Rectangle<num> searchRect, {
  2. bool shouldInclude(
    1. E item
    )?,
})

Returns all items whose rectangles overlap searchRect If shouldInclude is specified, each item will be passed to the method and excluded if shouldInclude evaluates to false.

Note: Rectangles that share only a border are not considered to overlap

Implementation

List<RTreeDatum<E>> search(Rectangle searchRect, {bool Function(E item)? shouldInclude}) {
  shouldInclude ??= (_) => true;

  if (_root is LeafNode<E>) {
    return _root.search(searchRect, shouldInclude);
  }

  return _root.search(searchRect, shouldInclude);
}