Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef INTERPOLATION_HPP
00044 #define INTERPOLATION_HPP 1
00045
00046
00047 #include <vector>
00048 #include <cstddef>
00049
00050
00056 class Interpolation2D
00057 {
00058 protected:
00059
00060 size_t _n;
00061 size_t _m;
00062 std::vector<double> _f;
00069 Interpolation2D( size_t n, size_t m, const std::vector<double> &f );
00070
00071 const double &__f( int i, int j ) const;
00072 double &__f( int i, int j );
00073
00074 public:
00075
00078 virtual ~Interpolation2D() {}
00079
00085 virtual double operator()( double x, double y ) const = 0;
00086 };
00087
00088
00094 class ClosestInterpolation2D : public Interpolation2D
00095 {
00096
00097 public:
00098
00101 ClosestInterpolation2D( size_t n, size_t m, const std::vector<double> &f );
00102
00105 virtual ~ClosestInterpolation2D() {}
00106
00112 virtual double operator()( double x, double y ) const;
00113 };
00114
00115
00118 class BiLinearInterpolation2D : public Interpolation2D
00119 {
00120
00121 public:
00122
00125 BiLinearInterpolation2D( size_t n, size_t m, const std::vector<double> &f );
00126
00129 virtual ~BiLinearInterpolation2D() {}
00130
00136 virtual double operator()( double x, double y ) const;
00137 };
00138
00139
00145 class BiCubicInterpolation2D : public Interpolation2D
00146 {
00147
00148 std::vector<double> _fx;
00149 std::vector<double> _fy;
00150 std::vector<double> _fxy;
00151 std::vector<double> _c;
00156 const double &__fx( int i, int j ) const;
00157 const double &__fy( int i, int j ) const;
00158 const double &__fxy( int i, int j ) const;
00159
00160 double &__fx( int i, int j );
00161 double &__fy( int i, int j );
00162 double &__fxy( int i, int j );
00163
00164 static void calc_coefs( double *c, double *x );
00165 static const double wt[16][16];
00166
00167 public:
00168
00171 BiCubicInterpolation2D( size_t n, size_t m, const std::vector<double> &f );
00172
00175 virtual ~BiCubicInterpolation2D() {}
00176
00182 virtual double operator()( double x, double y ) const;
00183 };
00184
00185
00186 #endif
00187