2016-07-12 17:40:45 +00:00
|
|
|
#pragma once
|
2013-11-03 14:46:39 +00:00
|
|
|
|
|
|
|
#include "basics_global.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace basics {
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
class BASICSSHARED_EXPORT Interpolation {
|
|
|
|
public:
|
|
|
|
static inline double linear(double p1, double p2, double x) {
|
2015-09-29 20:31:25 +00:00
|
|
|
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);
|
|
|
|
|
2015-11-09 21:30:46 +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-03 14:46:39 +00:00
|
|
|
}
|
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
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|