Created
June 20, 2014 06:08
-
-
Save woodnathan/c069b3e599eba29ee03b to your computer and use it in GitHub Desktop.
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
static inline CGFloat map(CGFloat input, CGFloat inMinimum, CGFloat inMaximum, CGFloat outMinimum, CGFloat outMaximum) | |
{ | |
CGFloat returnValue; | |
CGFloat deltaIn = inMaximum - inMinimum; | |
CGFloat deltaOut = outMaximum - outMinimum; | |
returnValue = (input - inMinimum) / deltaIn; | |
returnValue = returnValue * deltaOut; | |
returnValue = returnValue + outMinimum; | |
return returnValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment