8 #ifndef BILINEARSPLINEFUNCTION_H 9 #define BILINEARSPLINEFUNCTION_H 55 void setData(
const std::vector<double> &x,
const std::vector<double> &y,
const std::vector<double> &vals) {
60 for (
unsigned int i = 0; i < x.size(); ++i) {
61 if (fabs(x[i] - cx) > 1e-6) {
64 m_xspls[m_xspls.size() - 1].add_val(y[i], vals[i]);
68 m_xspls[m_xspls.size() - 1].add_val(y[i], vals[i]);
75 double Eval(
double x,
double y)
const {
76 if (m_xs.size() < 2)
return -1.;
77 unsigned int indx = 0;
78 std::vector< double >::const_iterator it = std::lower_bound(m_xs.begin(), m_xs.end(), x);
79 indx = std::distance(m_xs.begin(), it);
80 int ind1 = 0, ind2 = 0;
85 else if (indx == m_xs.size()) {
93 double f1v = m_xspls[ind1].f(y);
94 double f2v = m_xspls[ind2].f(y);
95 return f1v + (x - m_xs[ind1]) * (f2v - f1v) / (m_xs[ind2] - m_xs[ind1]);
102 std::vector<double> m_xs;
103 std::vector<SplineFunction> m_xspls;
~BilinearSplineFunction(void)
Destructor.
void setData(const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &vals)
Class implementing a simple linear spline.
BilinearSplineFunction(const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &vals)
A class implementing a bilinear spline.
BilinearSplineFunction(void)
double Eval(double x, double y) const
Evaluates interpolated f(x,y)
The main namespace where all classes and functions of the Thermal-FIST library reside.