Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created January 16, 2016 19:29
Show Gist options
  • Save mortenjust/9b30b310e62f86fba11e to your computer and use it in GitHub Desktop.
Save mortenjust/9b30b310e62f86fba11e to your computer and use it in GitHub Desktop.
processing-like map()
static float rangeMap(float value, float low1, float low2, float high1, float high2){
return low2 + (value - low1) * (high2 - low2) / (high1 - low1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment