Created
May 7, 2020 13:46
-
-
Save StoneLabs/0d29d7b58460cda88ec6cac855635518 to your computer and use it in GitHub Desktop.
Float remapping
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
//Re-maps a number from one range to another. | |
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max) | |
{ | |
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment