Beispiel #1
0
        private SphereTreeNode CombineLeafNodes(SphereTreeNode s)
        {
            // Remember my own parent, and remove me from that parent
            if (MO.DoLog)
            {
                MO.Log(" Combined {0} with {1}", this, s);
            }
            SphereTreeNode myparent = parent;

            Debug.Assert(myparent != null, "parent was null!");
            parent.RemoveChild(this);
            // Make a new non-leaf node node to hold both
            SphereTreeNode n = new SphereTreeNode(center, radius, sphereTree);

            myparent.AddChild(n);
            n.AddChild(this);
            n.AddChild(s);
            n.RecalculateCenterAndRadius();
            if (MO.DoLog)
            {
                MO.Log(" Made combined node {0} child of {1}", n, myparent);
            }
            return(n);
        }