/// <summary> /// brings the first leaf which rectangle was intersected /// </summary> /// <returns></returns> public RectangleNode <T, P> FirstIntersectedNode(IRectangle <P> r) { if (r.Intersects(rectangle)) { if (IsLeaf) { return(this); } return(Left.FirstIntersectedNode(r) ?? Right.FirstIntersectedNode(r)); } return(null); }