83 unsigned int N=c->xPoints.size()-1;
85 if (c->xPoints.size()==0)
return 0;
86 if (c->xPoints.size()==1)
return c->xPoints[0].second;
91 std::pair<double,double> fk(x,0);
92 std::vector<std::pair<double,double> >::const_iterator
93 n=std::lower_bound(c->xPoints.begin(),c->xPoints.end(),fk);
94 unsigned int i = n-c->xPoints.begin();
96 double x0=c->xPoints[0].first;
97 double y0=c->xPoints[0].second;
101 else if (i==c->xPoints.size()) {
102 double x0=c->xPoints[N].first;
103 double y0=c->xPoints[N].second;
105 return y0 + m*(x-x0);
108 double x0=c->xPoints[i-1].first;
109 double x1=c->xPoints[i].first;
110 double y0=c->xPoints[i-1].second;
111 double y1=c->xPoints[i].second;
115 double Q0 = c->Q[i-1];
117 double a = (Q0-m)*dx;
118 double b = (m-Q1)*dx;
119 double t = (x-x0)/dx;
121 return u*y0+t*y1 + t*u*(u*a + t*b);