Created
September 8, 2014 14:06
-
-
Save ssube/e4dcd755a2ce70a0734e to your computer and use it in GitHub Desktop.
This file contains 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
to find the linearly interpolated value of (x + 0.4, y + 0.7) | |
given the values at (x, y), (x, y+1), (x+1, y), and (x+1, y+1) | |
let x1 = val(x, y) * 0.4 + (val(x, y+1) * 0.6) | |
let x2 = val(x+1, y) * 0.4 + (val(x+1, y+1) * 0.6) | |
the final value is (x1 * 0.7 + (x2 * 0.3)) | |
generalized: | |
to find the linearly interpolated value of (x + dX, y + dY) | |
given the values at (x, y), (x, y+1), (x+1, y), and (x+1, y+1) | |
let x1 = val(x, y) * dX + (val(x, y+1) * (1-dX)) | |
let x2 = val(x+1, y) * dX + (val(x+1, y+1) * (1-dX)) | |
the final value is (x1 * dY + (x2 * (1-dY))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment