2013-11-03 14:46:39 +00:00
|
|
|
#ifndef INTERPOLATION_H
|
|
|
|
#define INTERPOLATION_H
|
|
|
|
|
|
|
|
#include "basics_global.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace basics {
|
|
|
|
|
2013-11-17 21:36:18 +00:00
|
|
|
class BASICSSHARED_EXPORT Interpolation
|
2013-11-03 14:46:39 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-09-29 20:31:25 +00:00
|
|
|
static inline double linear(double p1, double p2, double x)
|
|
|
|
{
|
|
|
|
return p1 + x * (p2 - p1);
|
|
|
|
}
|
|
|
|
static double bilinear(double p[4], double x, double y);
|
|
|
|
static double trilinear(double p[8], double x, double y, double z);
|
|
|
|
|
2013-11-03 14:46:39 +00:00
|
|
|
static inline double cubic(double p[4], double x)
|
|
|
|
{
|
|
|
|
return p[1] + 0.5 * x * (p[2] - p[0] + x * (2.0 * p[0] - 5.0 * p[1] + 4.0 * p[2] - p[3] + x * (3.0 * (p[1] - p[2]) + p[3] - p[0])));
|
|
|
|
}
|
2013-11-17 21:36:18 +00:00
|
|
|
static double bicubic(double stencil[16], double x, double y);
|
2013-11-03 14:46:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // INTERPOLATION_H
|