2013-11-03 14:46:39 +00:00
|
|
|
#include "Interpolation.h"
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
double Interpolation::bicubic(double stencil[16], double x, double y) {
|
2013-11-17 21:36:18 +00:00
|
|
|
double buf_cubic_y[4];
|
|
|
|
|
|
|
|
buf_cubic_y[0] = Interpolation::cubic(stencil, x);
|
|
|
|
buf_cubic_y[1] = Interpolation::cubic(stencil + 4, x);
|
|
|
|
buf_cubic_y[2] = Interpolation::cubic(stencil + 8, x);
|
|
|
|
buf_cubic_y[3] = Interpolation::cubic(stencil + 12, x);
|
|
|
|
|
|
|
|
return Interpolation::cubic(buf_cubic_y, y);
|
2013-11-03 14:46:39 +00:00
|
|
|
}
|
2015-09-29 20:31:25 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
double Interpolation::bilinear(double p[4], double x, double y) {
|
2015-09-29 20:31:25 +00:00
|
|
|
double e1 = linear(p[0], p[1], x);
|
|
|
|
double e2 = linear(p[3], p[2], x);
|
|
|
|
return Interpolation::linear(e1, e2, y);
|
|
|
|
}
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
double Interpolation::trilinear(double p[8], double x, double y, double z) {
|
2015-09-29 20:31:25 +00:00
|
|
|
double f1 = bilinear(p, x, y);
|
|
|
|
double f2 = bilinear(p + 4, x, y);
|
|
|
|
return Interpolation::linear(f1, f2, z);
|
|
|
|
}
|