squiggle/src/utility/lib/Functions.re

7 lines
284 B
ReasonML
Raw Normal View History

2020-02-21 13:54:39 +00:00
let interpolate =
(xMin: float, xMax: float, yMin: float, yMax: float, xIntended: float)
: float => {
let minProportion = (xMax -. xIntended) /. (xMax -. xMin);
let maxProportion = (xIntended -. xMin) /. (xMax -. xMin);
yMin *. minProportion +. yMax *. maxProportion;
2020-03-26 23:18:19 +00:00
};