Exemple #1
0
        /// <summary>
        /// Recursively finds all content in this node and subnodes within the given bounds.
        /// </summary>
        /// <param name="bounds">The bounds.</param>
        /// <returns>An enumerable list of content.</returns>
        public IEnumerable <TContent> FindContentIn(Bounds bounds)
        {
            if (!Boundaries.Intersects(bounds))
            {
                return(Enumerable.Empty <TContent> ());
            }

            return(Content ?? (Children != null ? Children.SelectMany(c => c.FindContentIn(bounds)) : Enumerable.Empty <TContent> ()));
        }
Exemple #2
0
        public IEnumerable <QuadNode <TContent> > FindNodesIntersecting(Bounds bounds)
        {
            if (!Boundaries.Intersects(bounds))
            {
                return(Enumerable.Empty <QuadNode <TContent> > ());
            }

            if (Children != null)
            {
                return(Children.SelectMany(c => c.FindNodesIntersecting(bounds)));
            }
            else
            {
                return(Yield(this));
            }
        }
Exemple #3
0
        /// <summary>
        /// Recursively finds all nodes whose bounds intersect with a given bounding box.
        /// </summary>
        /// <param name="bounds">The bounds.</param>
        /// <returns>An enumerable list of nodes.</returns>
        public void FindNodesIntersecting(Bounds bounds, List <QuadNode <TContent> > content)
        {
            if (!Boundaries.Intersects(bounds))
            {
                return;
            }

            if (Children != null)
            {
                for (int i = 0; i < Children.Length; i++)
                {
                    Children[i].FindNodesIntersecting(bounds, content);
                }
            }
            else
            {
                content.Add(this);
            }
        }