/// <summary> /// Compute the intersection of two ranges. /// /// The intersection of two ranges is the largest range that is contained by both ranges. /// </summary> /// <param name="x">The first range.</param> /// <param name="y">The second range.</param> /// <returns>The intersection, or an empty range if the ranges do not overlap.</returns> public static FFloatRange Intersection(FFloatRange x, FFloatRange y) { if (x.IsEmpty()) { return(FFloatRange.Empty()); } if (y.IsEmpty()) { return(FFloatRange.Empty()); } return(new FFloatRange( FFloatRangeBound.MaxLower(x.LowerBound, y.LowerBound), FFloatRangeBound.MinUpper(x.UpperBound, y.UpperBound))); }