Created
August 5, 2022 17:57
-
-
Save SergeyMakeev/369e163c0159ca9c5b4e19c92be3188f to your computer and use it in GitHub Desktop.
RBF Interpolation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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