Functions to get percentage from 3 different values

43 Views Asked by At

I can't figure out how to create 2 linear functions that takes as input a value between 0 and 180 (always) and returns a percentage using 3 values :

a1, b1 and c1 used by the first function

And a2, b2 and c2 used by the second function

The first function (Image 1) :

if the value is b1 --> return 100%

if the value is a1 --> return 0%

if the value is c1 --> return 0%

The second function (Image 2) :

if the value is b2 --> return 0%

if the value is a2 --> return 100%

if the value is c2 --> return 100%

Image 1 & image 2