面对用三次样条插值曲面的问题,挖出整个互联网,但除了广场[0,1] x [[0,1]中的平庸插值没有找到任何东西,但我需要在任意区域内插入值(无论是16点还是4点,带有所有导数的指示等),我举一个例子: 我们得到满足椭圆抛物面方程的点:x = {100..102},y = {100..102}
x = 100,y = 100,f(x,y)= 1805.56
x = 100,y = 101,f(x,y)= 1816.72
x = 100,y = 102,f(x,y)= 1828
x = 101,y = 100,f(x,y)= 1830.68
x = 101,y = 101,f(x,y)= 1841.85
x = 101,y = 102,f(x,y)= 1853.12
x = 102,y = 100,f(x,y)= 1856.06
x = 102,y = 101,f(x,y)= 1867.22
x = 102,y = 102,f(x,y)= 1878.5
如何计算{101.5,101.5}点的值? 我在维基百科上阅读了这篇文章,但没有说明它在广场[0,1] x [0,1]之外的任意点是如何工作的 一个很好的实现,适用于单个方形,并在此处使用一致插值
double cubicInterpolate (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])));
}
double bicubicInterpolate (double p[4][4], double x, double y) {
double arr[4];
arr[0] = cubicInterpolate(p[0], y);
arr[1] = cubicInterpolate(p[1], y);
arr[2] = cubicInterpolate(p[2], y);
arr[3] = cubicInterpolate(p[3], y);
return cubicInterpolate(arr, x);
}