title: 3D interpolation methods in C (or Fortran), and comparison to Shepard's Method
body: <p>I would like to interpolate a 3D scalar function <code>f(x, y, z)</code>.  I have coded up a 3D linear interpolation algorithm (<a href="http://en.wikipedia.org/wiki/Trilinear_interpolation" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Trilinear_interpolation</a>).  This was not so bad.  </p>
  
  <p>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.</p>
  
  <p>I have seen similar questions asked here:</p>
  
  <p><a href="https://stackoverflow.com/questions/1972172/interpolating-a-scalar-field-in-a-3d-space">Interpolating a scalar field in a 3D space</a></p>
  
  <p>and</p>
  
  <p><a href="https://stackoverflow.com/questions/7889772/what-are-some-good-libraries-for-3d-interpolation">What are some good libraries for 3D interpolation?</a></p>
  
  <p>The second one was OK with Matlab, which I am not.  </p>
  
  <p>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.</p>