src/Colourful/Utils/ClampHelper.cs
/// <summary>
/// If any value is less than the corresponding minimum, replace it with the minimum value.
/// If any value is greater than the corresponding maximum, replace it with the maximum value.
/// Otherwise, copy the value.
/// </summary>
If any value is less than the corresponding minimum, replace it with the minimum value.
If any value is greater than the corresponding maximum, replace it with the maximum value.
Otherwise, copy the value.
If any value is less than the corresponding minimum replace it with the minimum value . If any value is greater than the corresponding maximum replace it with the maximum value . Otherwise copy the value .
public static double[] Clamp(this double[] vector, double[] minVector, double[] maxVector)
        {
            var croppedVector = vector.Select((x, index) => x.Clamp(minVector[index], maxVector[index])).ToArray();
            return croppedVector;
        }
public static double [ ] Clamp ( this double [ ] vector , double [ ] minVector , double [ ] maxVector ) { var croppedVector = vector . Select ( ( x , index ) => x . Clamp ( minVector [ index ] , maxVector [ index ] ) ) . ToArray ( ) ; return croppedVector ; }
If any value is less than the corresponding minimum, replace it with the minimum value.
If any value is less than the corresponding minimum replace it with the minimum value .
double[]
this
minVector
double[]
maxVector
double[]