Example #1
0
        //Private Methods

        private void createChildren()
        {
            HasChildren = true;

            //Divide the Node's bounding box into 4 quadrants
            int    sizeX  = _boundingBox.Width / 2;
            int    sizeY  = _boundingBox.Height / 2;
            AABB2D nwRect = new AABB2D(_boundingBox.X, _boundingBox.Y, sizeX, sizeY);
            AABB2D neRect = new AABB2D(_boundingBox.CenterX, _boundingBox.Y, sizeX, sizeY);
            AABB2D swRect = new AABB2D(_boundingBox.X, _boundingBox.CenterY, sizeX, sizeY);
            AABB2D seRect = new AABB2D(_boundingBox.CenterX, _boundingBox.CenterY, sizeX, sizeY);

            _children[0] = new QuadNode <T>(nwRect, this);
            _children[1] = new QuadNode <T>(neRect, this);
            _children[2] = new QuadNode <T>(swRect, this);
            _children[3] = new QuadNode <T>(seRect, this);
        }