public double GetFunction(double x, char ch) { SplineInterval[] splines = new SplineInterval[Count - 1]; if (ch == 'c') { splines = _ClampedSplines; } else { splines = _splines; } if (x == splines[0].GetX1()) { return(splines[0].F(x)); } for (int i = 0; i < splines.Length; i++) { if (x <= splines[i].GetX2()) { return(splines[i].F(x)); } } return(0); }
public void BuildSubIntervalsForClamped() { double[] c = CreateCvector(A1, v1, Count); //{ -1,1,3,5,10,15} //Находим массив A for (int i = 0; i < c.Length - 1; i++) { double hi = _points[i + 1].X - _points[i].X; _ClampedSplines[i] = new SplineInterval(_points[i], _points[i + 1], _points[i].Y, (_points[i + 1].Y - _points[i].Y) / hi - (hi * (2 * c[i] + c[i + 1])) / 3, c[i], (c[i + 1] - c[i]) / (3 * (_points[i + 1].X - _points[i].X))); } }