-
-
Save tomoima525/89bd93fb71830836e57f3fdd1ee0c0f4 to your computer and use it in GitHub Desktop.
Javascript implementation of Bilinear 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
Math.blerp = function (values, x1, y1, x2, y2, x, y) { | |
let q11 = (((x2 - x) * (y2 - y)) / ((x2 - x1) * (y2 - y1))) * values[x1][y1] | |
let q21 = (((x - x1) * (y2 - y)) / ((x2 - x1) * (y2 - y1))) * values[x2][y1] | |
let q12 = (((x2 - x) * (y - y1)) / ((x2 - x1) * (y2 - y1))) * values[x1][y2] | |
let q22 = (((x - x1) * (y - y1)) / ((x2 - x1) * (y2 - y1))) * values[x2][y2] | |
return q11 + q21 + q12 + q22 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment