/// <summary>
 /// Collects every content attached to this BspSearchTreeNode inside the given rectangular area.
 /// </summary>
 /// <param name="area">The rectangular area.</param>
 /// <param name="outputList">
 /// A list that contains every content attached to this BspSearchTreeNode inside the given rectangular area.
 /// </param>
 public void CollectContents(RCNumRectangle area, ref RCSet <T> outputList)
 {
     if (this.isLeaf)
     {
         /// Leaf node -> collect the contents inside the given selection box.
         foreach (T content in this.contents)
         {
             if (content.BoundingBox.IntersectsWith(area))
             {
                 outputList.Add(content);
             }
         }
     }
     else
     {
         /// Not a leaf node -> propagate the call to the appropriate child(ren).
         if (this.firstChild.area.IntersectsWith(area))
         {
             this.firstChild.CollectContents(area, ref outputList);
         }
         if (this.secondChild.area.IntersectsWith(area))
         {
             this.secondChild.CollectContents(area, ref outputList);
         }
     }
 }
 /// <summary>
 /// Collects every content attached to this BspSearchTreeNode at the given position.
 /// </summary>
 /// <param name="position">The position to check.</param>
 /// <param name="outputList">
 /// A list the contains every content attached to this BspSearchTreeNode at the given position.
 /// </param>
 public void CollectContents(RCNumVector position, ref RCSet <T> outputList)
 {
     if (this.isLeaf)
     {
         /// Leaf node -> collect the contents at the given position
         foreach (T content in this.contents)
         {
             if (content.BoundingBox.Contains(position))
             {
                 outputList.Add(content);
             }
         }
     }
     else
     {
         /// Not a leaf node -> propagate the call to the appropriate child.
         if (this.firstChild.area.Contains(position))
         {
             this.firstChild.CollectContents(position, ref outputList);
         }
         else if (this.secondChild.area.Contains(position))
         {
             this.secondChild.CollectContents(position, ref outputList);
         }
     }
 }
Beispiel #3
0
        /// <see cref="ISearchTree<T>.GetContents"/>
        public RCSet <T> GetContents(RCNumRectangle area)
        {
            if (area == RCNumRectangle.Undefined)
            {
                throw new ArgumentNullException("area");
            }

            RCSet <T> retList = new RCSet <T>();

            this.rootNode.CollectContents(area, ref retList);
            return(retList);
        }
Beispiel #4
0
        /// <see cref="ISearchTree<T>.GetContents"/>
        public RCSet <T> GetContents(RCNumVector position)
        {
            if (position == RCNumVector.Undefined)
            {
                throw new ArgumentNullException("position");
            }

            RCSet <T> retList = new RCSet <T>();

            this.rootNode.CollectContents(position, ref retList);
            return(retList);
        }