Created
December 10, 2014 13:37
-
-
Save rosszurowski/e2193733292846eb0dc5 to your computer and use it in GitHub Desktop.
An n-th degree polynomial interpolator. Used as an alternative for common `lerp` functions
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
/** | |
* N-th degree polynomial interpolation | |
* @param {Number} degree | |
* @param {Number} min | |
* @param {Number} max | |
* @param {Number} amount | |
* @returns {Number} | |
*/ | |
function nerp(degree, min, max, amount) { | |
return min + Math.pow(amount, degree) * (max - min); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use it as follows: