remap function
This funcion is like a lerp and unlerp, but is general. Its expect a number and a range for interpolate, after the result is interpolated with a second range
Implementation
double remap(
double value,
double start1,
double stop1,
double start2,
double stop2,
) {
final outgoing =
start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
return outgoing;
}