search method

List<T> search(
  1. Rect rect
)

Implementation

List<T> search(Rect rect) {
  List<T> results = [];
  double rL = rect.left, rT = rect.top, rR = rect.right, rB = rect.bottom;

  visit((node, x0, y0, x1, y1) {
    if (x0 >= rR || x1 < rL || y0 >= rB || y1 < rT) {
      return VisitResult.skipChildren;
    }

    if (!node.isInternal) {
      QuadNode<T>? leaf = node;
      while (leaf != null) {
        if (leaf.x >= rL && leaf.x < rR && leaf.y >= rT && leaf.y < rB) {
          results.add(leaf.data as T);
        }
        leaf = leaf.next;
      }
    }
    return VisitResult.continueVisit;
  });
  return results;
}