public List <SpatialObj <T> > WindowQuery(Rectangle window) { // Finds objects within a Rectangular range (window) List <SpatialObj <T> > answer = new List <SpatialObj <T> >(); Queue <CoverNode <T> > searching_nodes = new Queue <CoverNode <T> >(); searching_nodes.Enqueue(rootNode); while (searching_nodes.Count > 0) { CoverNode <T> current_node = searching_nodes.Dequeue(); if (current_node.IntersectsWith(window)) { answer.AddRange(current_node.GetRangeQueryObj(window)); if (current_node.HasChildren()) { foreach (CoverNode <T> child in current_node.GetChildren()) { if (!searching_nodes.Contains(child)) { searching_nodes.Enqueue(child); } } } } } return(answer); }