/// <summary> /// Retrieves the <see cref="Quadrant"/> containing the given bounds /// </summary> public Quadrant GetContainingQuadrant(Rect bounds) { if (TopRight?.Extent.Contains(bounds) ?? false) { return(TopRight.GetContainingQuadrant(bounds)); } else if (TopLeft?.Extent.Contains(bounds) ?? false) { return(TopLeft.GetContainingQuadrant(bounds)); } else if (BottomRight?.Extent.Contains(bounds) ?? false) { return(BottomRight.GetContainingQuadrant(bounds)); } else if (BottomLeft?.Extent.Contains(bounds) ?? false) { return(BottomLeft.GetContainingQuadrant(bounds)); } else if (Extent.Contains(bounds)) { return(this); } return(null); }