Changeset 2730 for trunk/src/Interpolator1D.h
- Timestamp:
- 01/16/13 16:00:28 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Interpolator1D.h
r2727 r2730 23 23 class Interpolator1D { 24 24 public: 25 // Default constructor. 25 26 Interpolator1D(); 26 27 28 // Destructor. 27 29 virtual ~Interpolator1D(); 28 30 31 // Set horizontal (x) and vertical (y) data. 32 // @param[in] x pointer to horizontal data. 33 // @param[in] y pointer to vertical data. 34 // @param[in] n number of data. 29 35 void setData(double *x, float *y, unsigned int n); 36 37 // Set horizontal data (x). 38 // @param[in] x pointer to horizontal data. 39 // @param[in] n number of data. 30 40 void setX(double *x, unsigned int n); 41 42 // Set vertical data (y). 43 // @param[in] y pointer to vertical data. 44 // @param[in] n number of data. 31 45 void setY(float *y, unsigned int n); 46 47 // Reset object. 32 48 void reset(); 33 49 34 // currently only effective for polynomial interpolation 50 // Set order for polynomial interpolation. 51 // @param order order of the polynomial. 52 // 53 // This method is effective only for polynomial interpolation. 35 54 void setOrder(unsigned int order) {order_ = order;} 36 55 56 // Perform interpolation. 57 // @param[in] x horizontal location where the value is evaluated 58 // by interpolation. 59 // @return interpolated value at x. 37 60 virtual float interpolate(double x) = 0; 38 61 39 62 protected: 40 int locate(double x); 63 // Locate x. 64 // @param[in] x horizontal location. 65 // @return location as an index. 66 // @see Locator::locate() 67 unsigned int locate(double x); 68 69 // Query function whether the object is ready to interpolate. 70 // @return true if object is ready else false. 41 71 bool isready(); 72 73 // Fuctory method to create appropriate Locator object. 42 74 void createLocator(); 43 75 76 // Order of the polynomial (only effective for polynomial interpolation). 44 77 unsigned int order_; 78 79 // Number of data points. 45 80 unsigned int n_; 81 82 // Horizontal data. 46 83 double *x_; 84 85 // Vertical data. 47 86 float *y_; 87 88 // Pointer to the Locator object. 48 89 Locator *locator_; 49 90 };
Note: See TracChangeset
for help on using the changeset viewer.