(a, b)
| 14961 | } |
| 14962 | |
| 14963 | function clamper(a, b) { |
| 14964 | var t; |
| 14965 | if (a > b) t = a, a = b, b = t; |
| 14966 | return function(x) { return Math.max(a, Math.min(b, x)); }; |
| 14967 | } |
| 14968 | |
| 14969 | // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. |
| 14970 | // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. |