src/Quadtree.cs
/// <summary>Shrinks the tree to the smallest possible size.</summary>
Shrinks the tree to the smallest possible size.
Shrinks the tree to the smallest possible size .
public void Shrink() {
            if (_item.Count == 0)
                return;
            Point min = new Point(int.MaxValue),
                max = new Point(int.MinValue);
            foreach (var i in _safeItem) {
                var xy = i.Bounds.AABB.Center;
                if (xy.X < min.X)
                    min.X = xy.X;
                if (xy.X > max.X)
                    max.X = xy.X;
                if (xy.Y < min.Y)
                    min.Y = xy.Y;
                if (xy.Y > max.Y)
                    max.Y = xy.Y;
            }
            if (Bounds.X != min.X || Bounds.Y != min.Y || Bounds.Width != max.X - min.X + 1 || Bounds.Height != max.Y - min.Y + 1)
                Bounds = new Rectangle(min.X, min.Y, max.X - min.X + 1, max.Y - min.Y + 1);
        }
public void Shrink ( ) { if ( _item . Count == 0 ) return ; Point min = new Point ( int . MaxValue ) , max = new Point ( int . MinValue ) ; foreach ( var i in _safeItem ) { var xy = i . Bounds . AABB . Center ; if ( xy . X < min . X ) min . X = xy . X ; if ( xy . X > max . X ) max . X = xy . X ; if ( xy . Y < min . Y ) min . Y = xy . Y ; if ( xy . Y > max . Y ) max . Y = xy . Y ; } if ( Bounds . X != min . X || Bounds . Y != min . Y || Bounds . Width != max . X - min . X + 1 || Bounds . Height != max . Y - min . Y + 1 ) Bounds = new Rectangle ( min . X , min . Y , max . X - min . X + 1 , max . Y - min . Y + 1 ) ; }
Shrinks the tree to the smallest possible size.
Shrinks the tree to the smallest possible size .