Looking for gradient formula or algorithm to return normalized value

Viewed 20

I'm looking for some kind of formula or algorithm that can return a normalized value based on three inputs in a gradient type manner, where you define the hotspot of the gradient where the value is 1, and a roof and floor value where the value drops towards 0 as it gets closer to them.

Ex.

GradientFunction(valueToEvaluate, hotspot, roof, floor)

GradientFunction(50, 50, 60, 35) = 1.0
GradientFunction(60, 50, 60, 35) = 0
GradientFunction(35, 50, 60, 35) = 0
GradientFunction(51, 50, 60, 35) = 0.closeto1
GradientFunction(34, 50, 60, 35) = 0.closeto0

Is there a math formula that especially works for this of some kind?

0 Answers
Related