4
$\begingroup$

I am trying to interpolate irregular data $f(\theta, \phi)$ on a sphere and I have so far tried a scipy approach using Kd-Trees and inverse distance weighting, which works ok - however I was wondering if there is an open-source library for spherical interpolation. I have come across the SHTns library, which is suggested to be useful, but it's not immediately clear to me how to use it for interpolation purposes.

I was wondering if someone could please shed some light on this. Many thanks.

$\endgroup$
2
$\begingroup$

After some more searching I've managed to find what I was looking for. They are available on NETLIB as stripack and ssrfpack - fortran routines - that allow for spherical interpolation of irregular data using spherical splines.

There's also an alternative that uses generalized Green's function for spherical surface splines in tension. The matlab code (and the associated paper) is available there, although it has GMT as a dependency.

$\endgroup$
1
$\begingroup$

On a basic search on Spherical Interpolation I found these:

  • Graphics Math Template Library (GMTL)

Link: http://ggt.sourceforge.net/

How do I perform spherical interpolation with quaternions?

Use the slerp function. You need an origin quaternion, a target quaternion, and an interpolation amount between 0 and 1. The following example interpolated halfway between the origin and target quaternions. Note that the interpolation path follows the shortest length arc around a sphere.

  gmtl::Quatf resultQuat, originQuat, targetQuat;
  float amount = 0.5;

  gmtl::slerp( resultQuat, amount, originQuat, targetQuat );

Source: http://ggt.sourceforge.net/html/gmtlfaq.html

  • Example Code for Spherical Interpolation

Project Link: http://freesourcecode.net/cprojects/2275/Piecewise-Linear-Image-Denoising

C++ Link: http://freesourcecode.net/cprojects/2275/sourcecode/quaternion_demo.cpp

H Link: http://freesourcecode.net/cprojects/2275/sourcecode/quaternion_demo.h

  • OpenGLDemoEngine:

Spherical Interpolation: http://gitlab.scss.tcd.ie/gv2/opengldemoengine/blob/bc0b7ab4f7e4fc287dd7905353bf4a783c05813d/Dependencies/assimp--3.0.1270/include/assimp/quaternion.h

LINK: http://gitlab.scss.tcd.ie/gv2/opengldemoengine

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.