I want to implement thin spline interpolation of scattered elevation data $ \{z_i(x_i,y_i)\}_{i=1..n} $ in C++.

This seems fairly simple using Radial Basis Functions:

$$ z(x,y) = p(x,y) + \sum_i l_i\phi(r)$$ where p(x,y) is a polynomial and $\ \phi= r^2\ln(r) $ .

Requiring the interpolated surface to go exactly trough the n datapoints + ortogonality of polynomials leads to a matrix equation. This is then solved to find the coefficients $l_i$.

However I want the implementation to take into account "barriers": enter image description here

As you can see in this figure: points on one side of the "barrier" should not be influenced by points on the other side of the "barrier".

As an example consider this simple form of interpolation: the elevation in a grid node is found as an average over the elevation of points within a circle of radius R. Now consider a grid node very close to the "barrier". This would be influenced by points on both side of the "barrier" and as a result the interpolated elevation would be somewhere in between. The resulting surface would not show a discontinuity ("cliff") instead it would show a "hill". In this case things could be remedied by only using points from the same side of the "barrier" as the grid node when doing the averaging.

NB! The "barriers" do not necessarily split the data into two sets like in the image.

How do I do this?

  • 1
    $\begingroup$ I don't know from your description what a "barrier" is supposed to be. Can you describe it in words? $\endgroup$ Jun 24 '13 at 4:02
  • $\begingroup$ I have added some more description. $\endgroup$
    – Andy
    Jun 24 '13 at 7:39
  • $\begingroup$ Use "compactly supported radial basis functions"? $\endgroup$
    – André
    Jun 24 '13 at 12:21
  • $\begingroup$ Would it be feasible to put extra weight on the barrier points? You can perhaps "enforce" a strong "ridge" by putting a second interpolation point very close to the barrier. But all this depends a little on the desired continuity or smoothness $\endgroup$
    – André
    Jun 24 '13 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.