Skip to content

Instantly share code, notes, and snippets.

@StoneLabs
Created May 7, 2020 13:46
Show Gist options
  • Save StoneLabs/0d29d7b58460cda88ec6cac855635518 to your computer and use it in GitHub Desktop.
Save StoneLabs/0d29d7b58460cda88ec6cac855635518 to your computer and use it in GitHub Desktop.
Float remapping
//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