remap

fun Double.remap(fromStart: Double, fromEnd: Double, toStart: Double, toEnd: Double): Double

Remaps this value from the range fromStart..fromEnd to the range toStart..toEnd.

The receiver is not clamped: values outside the source range map outside the target range. When fromStart equals fromEnd the result is toStart.