/// <summary> /// This method requests the nodes in a rectangle in a node level /// </summary> /// <param name="h">The root node to be searched</param> /// <param name="rect">Rectange in which the nodes are searched</param> private void Query( Node h, Interval2D rect) { if (h == null) { return; } double xmin = rect.IntervalX.Low; double ymin = rect.IntervalY.Low; double xmax = rect.IntervalX.High; double ymax = rect.IntervalY.High; if (rect.Contains(h.X, h.Y)) { this.data.Add(h.Value); } if (this.Less(xmin, h.X) && this.Less(ymin, h.Y)) { this.Query(h.SW, rect); } if (this.Less(xmin, h.X) && !this.Less(ymax, h.Y)) { this.Query(h.NW, rect); } if (!this.Less(xmax, h.X) && this.Less(ymin, h.Y)) { this.Query(h.SE, rect); } if (!this.Less(xmax, h.X) && !this.Less(ymax, h.Y)) { this.Query(h.NE, rect); } }