Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
from typing import Sequence
from .charts_scale_linear_scale import interpolate, normalise, pair, round6 ← linearScale, another function of this group · built into the same file, even by a slim install
def invert_linear(domain: Sequence[float], range: Sequence[float], value: float) -> float:
"""The domain value at a position in the range: linear_scale read backwards.
Never clamped; a position past the end of the axis is a value past the end
of the data.
"""
d0, d1 = pair(domain, "domain")
r0, r1 = pair(range, "range")
return round6(interpolate(d0, d1, normalise(r0, r1, value, "range")))