示例#1
0
        /// <summary>
        /// Splits the current node into 4 child nodes
        /// </summary>
        public void Split()
        {
            int idEnd = 0;

            for (int y = 0; y < 2; y++)
            {
                for (int x = 0; x < 2; x++)
                {
                    Rectangle newBounds = new Rectangle(mBounds.Left + (x * (mBounds.Width / 2)), mBounds.Top + (y * (mBounds.Height / 2)), mBounds.Width / 2, mBounds.Height / 2);
                    IQuadNode newNode   = new QuadNode(newBounds);

                    idEnd++;
                    newNode.getSetID = Convert.ToInt32(nodeID + "" + idEnd);

                    mChildNodes.Add(newNode.getSetID, newNode);
                }
            }
        }