Changeset 2730 for trunk/src/CubicSplineInterpolator1D.h
- Timestamp:
- 01/16/13 16:00:28 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/CubicSplineInterpolator1D.h
r2727 r2730 18 18 19 19 /** 20 * Cubic spline interpolation20 * Implementation of (natural) cubic spline interpolation. 21 21 * @author TakeshiNakazato 22 22 */ 23 23 class CubicSplineInterpolator1D : public Interpolator1D { 24 24 public: 25 // Default constructor. 25 26 CubicSplineInterpolator1D(); 26 27 28 // Destructor. 27 29 virtual ~CubicSplineInterpolator1D(); 28 30 31 // Override Interpolator1D::setData. 32 // @see Interpolator1D::setData 33 void setData(double *x, float *y, unsigned int n); 34 35 // Override Interpolator1D::setY. 36 // @see Interpolator1D::setY() 29 37 void setY(float *y, unsigned int n); 38 39 // Perform interpolation. 40 // @param[in] x horizontal location where the value is evaluated 41 // by interpolation. 42 // @return interpolated value at x. 30 43 float interpolate(double x); 31 44 private: 32 // determine second derivatives of each point based on 33 // natural cubic spline condition 34 void spline(); 45 // Determine second derivatives of each point based on 46 // natural cubic spline condition (second derivative at each 47 // end is zero). 48 void evaly2(); 35 49 36 // do interpolation using second derivatives from spline() 37 float splint(double x, unsigned int i); 50 // Do interpolation using second derivatives determined by evaly2(). 51 // @param[in] x horizontal location where the value is evaluated 52 // by interpolation. 53 // @param[in] i location index for x. 54 // @return interpolated value at x. 55 float dospline(double x, unsigned int i); 38 56 57 // Array to store second derivatives on the data points. 39 58 float *y2_; 59 60 // number of data points for second derivatives 40 61 unsigned int ny2_; 62 63 // Boolean parameter whether buffered values are effective or not. 41 64 bool reusable_; 42 65 };
Note: See TracChangeset
for help on using the changeset viewer.