예제 #1
0
    public void should_correctly_calculate_polynomial_curve_value(float slope, float xShift, float yShift, float verticalSize, float inputValue, float expectedValue)
    {
        var curve       = new PolynomialCurveFunction(slope, xShift, yShift, verticalSize);
        var actualValue = curve.Plot(inputValue);

        Assert.Equal(expectedValue.ToString("F"), actualValue.ToString("F"));
    }
예제 #2
0
 public static PolynomialCurveFunction Alter(this PolynomialCurveFunction curve, float?slope = null, float?xShift = null, float?yShift = null, float?exponent = null)
 {
     return(new PolynomialCurveFunction(
                slope.HasValue ? slope.Value : curve.Slope,
                xShift.HasValue ? xShift.Value : curve.XShift,
                yShift.HasValue ? yShift.Value : curve.YShift,
                exponent.HasValue ? exponent.Value : curve.Exponent
                ));
 }