From 3de54bee23f5810c219299b6572d7afc06eb335f Mon Sep 17 00:00:00 2001 From: Roman Galochkin Date: Fri, 21 Feb 2020 16:54:39 +0300 Subject: [PATCH] Step 8 --- src/utility/lib/Functions.re | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/utility/lib/Functions.re diff --git a/src/utility/lib/Functions.re b/src/utility/lib/Functions.re new file mode 100644 index 00000000..3cf4537a --- /dev/null +++ b/src/utility/lib/Functions.re @@ -0,0 +1,7 @@ +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; +};