| 1 | //
|
|---|
| 2 | // C++ Interface: PolynomialInterpolator1D
|
|---|
| 3 | //
|
|---|
| 4 | // Description:
|
|---|
| 5 | //
|
|---|
| 6 | //
|
|---|
| 7 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2012
|
|---|
| 8 | //
|
|---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
|---|
| 10 | //
|
|---|
| 11 | //
|
|---|
| 12 | #ifndef ASAP_POLYNOMIAL_INTERPOLATOR_1D_H
|
|---|
| 13 | #define ASAP_POLYNOMIAL_INTERPOLATOR_1D_H
|
|---|
| 14 |
|
|---|
| 15 | #include "Interpolator1D.h"
|
|---|
| 16 |
|
|---|
| 17 | namespace asap {
|
|---|
| 18 |
|
|---|
| 19 | /**
|
|---|
| 20 | * Implementation of polynomial interpolation.
|
|---|
| 21 | * @author TakeshiNakazato
|
|---|
| 22 | */
|
|---|
| 23 | class PolynomialInterpolator1D : public Interpolator1D {
|
|---|
| 24 | public:
|
|---|
| 25 | // Default constructor.
|
|---|
| 26 | PolynomialInterpolator1D();
|
|---|
| 27 |
|
|---|
| 28 | // Destructor.
|
|---|
| 29 | virtual ~PolynomialInterpolator1D();
|
|---|
| 30 |
|
|---|
| 31 | // Perform interpolation.
|
|---|
| 32 | // @param[in] x horizontal location where the value is evaluated
|
|---|
| 33 | // by interpolation.
|
|---|
| 34 | // @return interpolated value at x.
|
|---|
| 35 | float interpolate(double x);
|
|---|
| 36 | private:
|
|---|
| 37 | // Perform polynomial interpolation.
|
|---|
| 38 | // If (number of data points) > (polynomial order + 1), polynomial
|
|---|
| 39 | // interpolation must be done in the sub-region that contains x.
|
|---|
| 40 | // This method takes arguments that specifies sub-region to be used.
|
|---|
| 41 | // @param[in] x horizontal location where the value is evaluated
|
|---|
| 42 | // by interpolation.
|
|---|
| 43 | // @param[in] left the leftmost index of sub-region.
|
|---|
| 44 | // @param[in] n number of data points of sub-region.
|
|---|
| 45 | // @return interpolated value at x.
|
|---|
| 46 | float dopoly(double x, unsigned int left, unsigned int n);
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | }
|
|---|
| 50 | #endif
|
|---|