Skip to content

Instantly share code, notes, and snippets.

@SergeyMakeev
Created August 5, 2022 17:57
Show Gist options
  • Select an option

  • Save SergeyMakeev/369e163c0159ca9c5b4e19c92be3188f to your computer and use it in GitHub Desktop.

Select an option

Save SergeyMakeev/369e163c0159ca9c5b4e19c92be3188f to your computer and use it in GitHub Desktop.
RBF Interpolation
// note key/value can be arbitrrary type (as long as you define distance function)
build_rbf_interpolator(vec3 keys[], vec3 values[])
{
N = len(keys);
// distances (any symetrical functio)
// (diagonal filled with zeroes)
Matrix A[NxN];
// values (could be anything)
Matrix B[Nx3]
// solve A * X = B for X
// weights
Matrix X[Nx3]
// save keys + solved weights
}
vec3 interpolate(vec3 v)
{
vec3 res = 0;
for(each key/weight in rbf_interpolator)
{
res += distance(v, key[i]) * weight[i];
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment