map static method

double map(
  1. double value,
  2. double start1,
  3. double stop1,
  4. double start2,
  5. double stop2,
)

Implementation

static double map(
    double value, double start1, double stop1, double start2, double stop2) {
  double outgoing =
      start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
  String? badness;
  if (outgoing != outgoing) {
    badness = "NaN (not a number)";
  } else if (outgoing == double.negativeInfinity ||
      outgoing == double.infinity) {
    badness = "infinity";
  }
  if (badness != null) {
    /*   final String msg =
      String.format("map(%s, %s, %s, %s, %s) called, which returns %s",
                    nf(value), nf(start1), nf(stop1),
                    nf(start2), nf(stop2), badness);
    PGraphics.showWarning(msg); */
  }
  return outgoing;
}