Maps a number from one range to another range.
num
mapped between outMin
-outMax
from inMin
-inMax
.def num_to_range(num, inMin, inMax, outMin, outMax):
return outMin + (float(num - inMin) / float(inMax - inMin) * (outMax
- outMin))
num_to_range(5, 0, 10, 0, 100) # 50.0
Python, Math
Initializes a list containing the numbers in the specified range where start
and end
are inclusive and the ratio between two terms is step
.
Python, Math
Clamps num
within the inclusive range specified by the boundary values.
Python, Math
Checks if the given number falls within the given range.