Created
August 31, 2023 18:18
-
-
Save eliheuer/89a8be6eabde131a2b7f0b0da3483b24 to your computer and use it in GitHub Desktop.
Revisions
-
eliheuer created this gist
Aug 31, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ def remap(value, inputMin, inputMax, outputMin, outputMax): inputSpan = inputMax - inputMin # FIND INPUT RANGE SPAN outputSpan = outputMax - outputMin # FIND OUTPUT RANGE SPAN valueScaled = float(value - inputMin) / float(inputSpan) return outputMin + (valueScaled * outputSpan) test01 = remap(0, -100, 100, 20, 250) print(test01) test02 = remap(-100, -100, 100, 20, 250) print(test02) test03 = remap(100, -100, 100, 20, 250) print(test03)