Exemplo n.º 1
0
 /// 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);
 }
Exemplo n.º 2
0
 /// <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];
 }
Exemplo n.º 3
0
 /// 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);
 }