datumhue.math.clamp(v: number,lo: number,hi: number) -> number
Clamp v to the range [lo, hi].
datumhue.math.remap
function
datumhue.math.remap(v: number,in_lo: number,in_hi: number,out_lo: number,out_hi: number) -> number
Remap v from [in_lo, in_hi] to [out_lo, out_hi]. A zero-width input range maps to out_lo.
Example
-- 5 is halfway through 0..10, so it maps halfway through 100..200.print(datumhue.math.remap(5, 0, 10, 100, 200)) --> 150.0-- A value outside the input range maps past the output range.print(datumhue.math.remap(15, 0, 10, 100, 200)) --> 250.0
datumhue.math.smoothstep
function
datumhue.math.smoothstep(edge0: number,edge1: number,x: number) -> number
Smooth Hermite interpolation: 0 at or below edge0, 1 at or above edge1, with a smooth 3t^2 - 2t^3 ramp between (zero slope at both edges). A zero-width edge range degenerates to a hard step at edge0.