예제 #1
0
            public IQuadTreeNode AddItem(T item)
            {
                var bounding = _getBounding(item);

                if (_topLeft.Rect.Intersects(bounding))
                {
                    _topLeft = _topLeft.AddItem(item);
                }

                if (_topRight.Rect.Intersects(bounding))
                {
                    _topRight = _topRight.AddItem(item);
                }

                if (_bottomLeft.Rect.Intersects(bounding))
                {
                    _bottomLeft = _bottomLeft.AddItem(item);
                }

                if (_bottomRight.Rect.Intersects(bounding))
                {
                    _bottomRight = _bottomRight.AddItem(item);
                }

                return(this);
            }
예제 #2
0
파일: QuadTree`1.cs 프로젝트: ixmilia/bcad
 public void AddItem(T item)
 {
     _root = _root.AddItem(item);
 }