示例#1
0
    public void Attempt_ReduceSubdivisions(OctreeItem escapedItem)
    {
        if (!ReferenceEquals(this, OctreeRoot) && !Siblings_ChildrenNodesPresent_TooManyItems())
        {
            //iterate thorugh this node and its 7 siblings then kill them
            foreach (OctreeNode item in Parent.ChildrenNodes)
            {
                item.KillNode(Parent.ChildrenNodes.Where(i => !ReferenceEquals(i, this)).ToArray());
            }

            Parent.EreaseChildrennodes();
        }
        else//otherwise if there are children in siblings or there are too many items for the parent to potentially hold them
        {  //remove the item from the contained items of this particuar node
            ContainedItems.Remove(escapedItem);
            escapedItem.MyOwnerNodes.Remove(this);
        }
    }