insert method
Inserts a node into the QuadTree
Returns true if the node was successfully inserted, false otherwise
Implementation
bool insert(Node<E> node, Size nodeSize) {
if (!_isNodeInBounds(node, nodeSize)) {
return false;
}
_totalNodeCount++;
// If we can hold more nodes and haven't subdivided, add to this quadrant
if (isLeaf && _shouldAcceptNode()) {
_nodes!.add(node);
return true;
}
// If we haven't subdivided yet, do it now
if (isLeaf) {
_subdivide();
}
// Try to insert into appropriate child quadrant
return _insertIntoChild(node, nodeSize);
}