/// <summary>
 /// Remove element from this node
 /// </summary>
 public void RemoveElement(CollisionTreeElem e)
 {
     if (elems != null)
     {
         elems.Remove(e);
     }
 }
        /// <summary>
        /// Recursive function to add an element to the tree
        /// </summary>
        public void AddElement(CollisionTreeElem e)
        {
            // if element do not intersect node, return
            if (e.box.BoxIntersect(box) == false)
            {
                return;
            }

            // if leaf  node (no children)
            if (children == null)
            {
                // if no elements list, add one
                if (elems == null)
                {
                    elems = new List <CollisionTreeElem>();
                }

                // add element to list
                elems.Add(e);
                e.AddToNode(this);
            }
            else
            {
                // if not a leaf recurse to all its children
                foreach (CollisionTreeNode n in children)
                {
                    n.AddElement(e);
                }
            }
        }
        public void AddElement(CollisionTreeElem e)
        {
            if (e.box.BoxIntersect(box) == false)
                return;

            if (childs == null)
            {
                if (elems == null)
                    elems = new List<CollisionTreeElem>();
                elems.Add(e);
                e.AddToNode(this);
            }
            else
            {
                foreach(CollisionTreeNode n in childs)
                    n.AddElement(e);
            }
        }
Example #4
0
        /// <summary>
        /// Recursive function to add an element to the tree
        /// </summary>
        public void AddElement(CollisionTreeElem e)
        {
            // if element do not intersect node, return
            if (e.box.BoxIntersect(box) == false)
                return;

            // if leaf  node (no children)
            if (children == null)
            {
                // if no elements list, add one
                if (elems == null)
                    elems = new List<CollisionTreeElem>();

                // add element to list
                elems.Add(e);
                e.AddToNode(this);
            }
            else
            {
                // if not a leaf recurse to all its children
                foreach (CollisionTreeNode n in children)
                    n.AddElement(e);
            }
        }
Example #5
0
 /// <summary>
 /// Remove element from this node
 /// </summary>
 public void RemoveElement(CollisionTreeElem e)
 {
     if (elems != null)
         elems.Remove(e);
 }
Example #6
0
 public void AddElement(CollisionTreeElem elem)
 {
     root.AddElement(elem);
 }
Example #7
0
 public void AddElement(CollisionTreeElem elem)
 {
     root.AddElement(elem);
 }
 public void AddElement(CollisionTreeElem e)
 {
     tree.AddElement(e);
 }
 public void AddElement(CollisionTreeElem e)
 {
     tree.AddElement(e);
 }