interval.normalize
The normalised parameter of a value within an interval, the inverse of Interval.at.
Usage
Interval.normalize(i: Interval, t: number): numberParameters
iIntervalThe interval; decreasing intervals (t0 > t1) keep their order.
tnumberThe value to locate.
Returns
The parameter (t − t0) / (t1 − t0): 0 at t0, 1 at t1, outside [0, 1] beyond the ends. For a zero-length interval it is NaN at the single value and ±Infinity elsewhere.
Example
Interval.normalize(Interval.of(10, 20), 12.5) // → 0.25