map static method

double map(
  1. String mode,
  2. int i,
  3. int n
)

Implementation

static double map(String mode, int i, int n) {
  switch (mode) {
    case "linear":
      return i / n;
    case "exp":
      return pow(i / n, 2).toDouble();
    default: // log
      return log(1 + i.toDouble()) / log(n.toDouble());
  }
}