public double GetY(double x) { PiecewiseLinearApproximationData approximationData = GetApproximationData(x); LinearFunctionParameters linearFunctionParameters = new LinearFunctionParameters(); linearFunctionParameters.X = x; double y = CalculateY(approximationData, linearFunctionParameters); return(y); }
private double CalculateY(PiecewiseLinearApproximationData approximationData, LinearFunctionParameters linearFunctionParameters) { // y = k * x+ b linearFunctionParameters.K = GetK(approximationData); linearFunctionParameters.B = GetB(approximationData.YForPreviousExistingX, linearFunctionParameters.K, approximationData.PreviousExistingX); double y = linearFunctionParameters.K * linearFunctionParameters.X + linearFunctionParameters.B; return(y); }