map function

double map(
  1. double x,
  2. double minIn,
  3. double maxIn,
  4. double minOut,
  5. double maxOut,
)

Implementation

double map(double x, double minIn, double maxIn, double minOut, double maxOut) {
  return (x - minIn) * (maxOut - minOut) / (maxIn - minIn) + minOut;
}