public static Tuple <double, double> GetOptimalRange([CanBeNull] Lut lut) { if (lut == null) { return(null); } lut.UpdateBoundingBox(); var threshold = Math.Min(lut.MaxY, 1d) * (1d - OptionRangeThreshold); double?fromX = null, toX = null; lut.ForEach((x, y) => { if (y >= threshold) { if (!fromX.HasValue) { fromX = x; } toX = x; } }); return(fromX.HasValue && toX.HasValue ? new Tuple <double, double>(fromX ?? 0d, toX ?? 0d) : null); }