/// Creates a new spectrum, applying Clamp for each coefficient. public static Spectrum Clamp(Spectrum spectrum, float low = 0, float high = Single.PositiveInfinity) { var coefficients = new float[3]; for (var i = 0; i < NumSamples; i++) coefficients[i] = MathUtility.Clamp(spectrum._coefficients[i], low, high); return new Spectrum(coefficients); }
/// <summary> /// Adds the values in a given spectrum to this spectrum. /// </summary> public void Add(Spectrum other) { for (var i = 0; i < NumSamples; i++) _coefficients[i] += other._coefficients[i]; }
/// Creates a new spectrum, applying Exp for each coefficient. public static Spectrum Exp(Spectrum spectrum) { var coefficients = new float[3]; for (var i = 0; i < NumSamples; i++) coefficients[i] = MathUtility.Exp(spectrum._coefficients[i]); return new Spectrum(coefficients); }