What's the common name for the inverse of the lerp function?

function, inverse, linear-interpolation, naming-conventions, terminology

Solution

GLSL

GLSL's built-in functions include:

`mix()`, which works like your `lerp()` function. `smoothstep()`, which works like your inverse-lerp function combined with hermite smoothing and a `x = clamp(x, 0.0, 1.0)`.

You could consider the name `linearstep()` for your implementation.

Unity Engine

Unity's API includes:

`Lerp()`/`LerpUnclamped()` `InverseLerp()`, which does exactly what your inverse-lerp function does.

Note: I wouldn't use the name `fraction()`— it seems that it would be easily confused with `fract()`/`frac()`, which do something completely different.

Problem

The function lerp() is a common function in programming languages: ``` lerp(a, b, t) = a + t * (b - a). ``` Now for very many situatons I have an inverse function: ``` fraction(x, a, b) = (x - a) / (b - a). ``` This function is built so that ``` lerp(a, b, fraction(x, a, b)) == x ``` and ``` fraction(lerp(a, b, t), a, b) == t ``` However I'm not happy with the name "fraction". Is there a common name for this function?

Original source