Last active
February 8, 2022 13:43
-
-
Save Toscan0/67332bb8803606634680eca39f5bd696 to your computer and use it in GitHub Desktop.
Converts a number from one range to another range
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
private float NumberConvert(float oldValue, float oldMinScale, float oldMaxScale, float newMinScale, float newMaxScal) | |
{ | |
float newVal = (((oldValue - oldMinScale) * (newMaxScal - newMinScale)) / (oldMaxScale - oldMinScale)) + newMinScale; | |
return newVal; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment