mapRange function

double mapRange(
  1. double value,
  2. double iMin,
  3. double iMax, [
  4. double oMin = 0,
  5. double oMax = 1,
])

Map a given value between a range

Implementation

double mapRange(
  double value,
  double iMin,
  double iMax, [
  double oMin = 0,
  double oMax = 1,
]) {
  return ((value - iMin) * (oMax - oMin)) / (iMax - iMin) + oMin;
}