src/Quadtree.cs
/// <summary>Removes all items and nodes from the tree.</summary>
Removes all items and nodes from the tree.
Removes all items and nodes from the tree .
public void Clear() {
            if (_root.NW != null) {
                _toProcess.Push(_root.NE);
                _toProcess.Push(_root.SE);
                _toProcess.Push(_root.SW);
                _toProcess.Push(_root.NW);
                _root.NE = null;
                _root.SE = null;
                _root.SW = null;
                _root.NW = null;
                Node n;
                do {
                    n = _toProcess.Pop();
                    n.Clear();
                    n.Bounds = Rectangle.Empty;
                    Pool<Node>.Free(n);
                    if (n.NW == null)
                        continue;
                    _toProcess.Push(n.NE);
                    _toProcess.Push(n.SE);
                    _toProcess.Push(n.SW);
                    _toProcess.Push(n.NW);
                    n.NE = null;
                    n.SE = null;
                    n.SW = null;
                    n.NW = null;
                } while (_toProcess.Count > 0);
            }
            _root.Clear();
            _item.Clear();
            _safeItem.Clear();
            _bounds = Rectangle.Empty;
        }
public void Clear ( ) { if ( _root . NW != null ) { _toProcess . Push ( _root . NE ) ; _toProcess . Push ( _root . SE ) ; _toProcess . Push ( _root . SW ) ; _toProcess . Push ( _root . NW ) ; _root . NE = null ; _root . SE = null ; _root . SW = null ; _root . NW = null ; Node n ; do { n = _toProcess . Pop ( ) ; n . Clear ( ) ; n . Bounds = Rectangle . Empty ; Pool < Node > . Free ( n ) ; if ( n . NW == null ) continue ; _toProcess . Push ( n . NE ) ; _toProcess . Push ( n . SE ) ; _toProcess . Push ( n . SW ) ; _toProcess . Push ( n . NW ) ; n . NE = null ; n . SE = null ; n . SW = null ; n . NW = null ; } while ( _toProcess . Count > 0 ) ; } _root . Clear ( ) ; _item . Clear ( ) ; _safeItem . Clear ( ) ; _bounds = Rectangle . Empty ; }
Removes all items and nodes from the tree.
Removes all items and nodes from the tree .