find method

NodeBase find(
  1. Envelope searchEnv
)

Returns the smallest existing node containing the envelope.

Implementation

NodeBase find(Envelope searchEnv) {
  int subnodeIndex = NodeBase.getSubnodeIndex(searchEnv, centrex, centrey);
  if (subnodeIndex == -1) return this;
  if (subnode[subnodeIndex] != null) {
    // query lies in subquad, so search it
    NodeNode? node = subnode[subnodeIndex];
    return node!.find(searchEnv);
  }
  // no existing subquad, so return this one anyway
  return this;
}