Skip to content

Instantly share code, notes, and snippets.

View Kodagrux's full-sized avatar
🤠

Arvid Bräne Kodagrux

🤠
View GitHub Profile
@Kodagrux
Kodagrux / gist:5b39358d812c0fd8eaf4
Created May 6, 2015 11:09
reMap-function for Python
def reMap(value, maxInput, minInput, maxOutput, minOutput):
value = maxInput if value > maxInput else value
value = minInput if value < minInput else value
inputSpan = maxInput - minInput
outputSpan = maxOutput - minOutput
scaledThrust = float(value - minInput) / float(inputSpan)