Intersects() public static method

public static Intersects ( Rect r1, Rect r2 ) : bool
r1 UnityEngine.Rect
r2 UnityEngine.Rect
return bool
Ejemplo n.º 1
0
        public List <T> IntersectsWith(Rect queryArea)
        {
            List <T> results = new List <T>();

            foreach (T item in m_Elements)
            {
                if (RectUtils.Intersects(item.boundingRect, queryArea))
                {
                    results.Add(item);
                }
            }

            foreach (QuadTreeNode <T> node in m_ChildrenNodes)
            {
                if (node.IsEmpty)
                {
                    continue;
                }

                if (RectUtils.Intersects(node.BoundingRect, queryArea))
                {
                    // the node completely contains the queryArea
                    // recurse down and stop
                    results.AddRange(node.IntersectsWith(queryArea));
                    break;
                }
            }

            return(results);
        }
Ejemplo n.º 2
0
        public List <T> IntersectsWith(Rect queryArea)
        {
            List <T> objList = new List <T>();

            using (List <T> .Enumerator enumerator = this.m_Elements.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    T current = enumerator.Current;
                    if (RectUtils.Intersects(current.boundingRect, queryArea))
                    {
                        objList.Add(current);
                    }
                }
            }
            using (List <QuadTreeNode <T> > .Enumerator enumerator = this.m_ChildrenNodes.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    QuadTreeNode <T> current = enumerator.Current;
                    if (!current.IsEmpty && RectUtils.Intersects(current.BoundingRect, queryArea))
                    {
                        objList.AddRange((IEnumerable <T>)current.IntersectsWith(queryArea));
                        break;
                    }
                }
            }
            return(objList);
        }
Ejemplo n.º 3
0
        public List <T> IntersectsWith(Rect queryArea)
        {
            List <T> list = new List <T>();

            foreach (T local in this.m_Elements)
            {
                if (RectUtils.Intersects(local.boundingRect, queryArea))
                {
                    list.Add(local);
                }
            }
            foreach (QuadTreeNode <T> node in this.m_ChildrenNodes)
            {
                if (!node.IsEmpty && RectUtils.Intersects(node.BoundingRect, queryArea))
                {
                    list.AddRange(node.IntersectsWith(queryArea));
                    return(list);
                }
            }
            return(list);
        }
Ejemplo n.º 4
0
        public List <T> IntersectsWith(Rect queryArea)
        {
            List <T> list = new List <T>();

            foreach (T current in this.m_Elements)
            {
                if (RectUtils.Intersects(current.boundingRect, queryArea))
                {
                    list.Add(current);
                }
            }
            foreach (QuadTreeNode <T> current2 in this.m_ChildrenNodes)
            {
                if (!current2.IsEmpty)
                {
                    if (RectUtils.Intersects(current2.BoundingRect, queryArea))
                    {
                        list.AddRange(current2.IntersectsWith(queryArea));
                        break;
                    }
                }
            }
            return(list);
        }