1

I would like to interpolate a 3D scalar function f(x, y, z). I have coded up a 3D linear interpolation algorithm (http://en.wikipedia.org/wiki/Trilinear_interpolation). This was not so bad.

However, I would like something more sophisticated, e.g. 3D cubic splines. Are there any open source, easy-to-use, publicly available code for interpolating a 3D scalar? I would prefer to use C, but Fortran would be OK as well. I would like to stay away from Matlab.

I have seen similar questions asked here:

Interpolating a scalar field in a 3D space

and

What are some good libraries for 3D interpolation?

The second one was OK with Matlab, which I am not.

As for the first one, the main suggestion was Shepard's method. I am curious how accurate Shepard's method is. For instance, in the case of a uniform grid, one can apply Shepard's method only to nearby grid points, and in that case does it tend to be more accurate than linear interpolation or cubic splines? I imagine not, but wasn't 100% sure, and if in fact it is not better, then I would prefer to find code using something like splines if any such codes are available.

4

3 に答える 3

5

補間のための幾何学的ツールを見てみましょう: 3 次、一様 B スプラインなどのテンプレート化された C++。
( 1d 2d 3d の B スプライン用の C ライブラリであるeinsplineは、2013 年には休止しているようです。著者は電子メールに応答しません。また、これは C です。C++ テンプレートは、浮動小数点数、色、vecs を補間するためのコードの肥大化を減らします .. .) 私はこれらのどちらも使用していません。

シェパード法とも呼ばれる逆距離重み付けでは、3 次元、2^3 または 3^3 または 4^3 で任意の数の近傍を使用できます。一般
問題は「たるみ」です。リンクのプロットを参照してください。

補間法の「精度」を測定するのは非常に困難です。「ゴールデン」とは、どのクラスのデータに対して、どのノイズに対して?
そして、データの誤差と滑らかさの 2 つの測定値をトレードオフする必要があります 。写真の拡大
には、エイリアシング、ぼかし、エッジ ハローの 3 つがあります。帯域制限された関数のスプライン補間に関するいくつかの理論がありますが、IDW についてはまったくありません。

追加: ブルズアイ効果はどうですか?

ほとんどの場合、IDW はひどい選択です。すべての入力データ ポイントが局所的な最小値または最大値であると想定しています。

IDW は、遠くに高いピークがある場合、近くのデータ ポイントの上にピークを持つことができます。たとえば、1d では、
IDW( [0 0] [1 0] [2 y] ) = y/7 at x = 1/2. ただし、IDW の重み ~ 1 / 距離は、一部のタスクでは、スパイクが強すぎたり、減衰が速すぎたりする場合があります。
補間方法とカーネルは、特定のデータとノイズに適合するように選択する必要があります。これは芸術です。

于 2013-05-31T09:33:47.387 に答える
2

bspline -fortranライブラリは、通常のグリッド上のデータに対して 2d-6d b-spline 補間を行います。最新の Fortran で書かれています (基本的なサブルーチン インターフェイスとオブジェクト指向インターフェイスがあります)。

于 2015-07-18T02:53:18.880 に答える