Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created January 16, 2016 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mortenjust/5425193ca4888ac3d75c to your computer and use it in GitHub Desktop.
Save mortenjust/5425193ca4888ac3d75c to your computer and use it in GitHub Desktop.
Processing-like map()
func rangeMap(whereIs value:Double, low1:Double, low2:Double, high1:Double, high2:Double) -> Double {
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