src/math.js
function clamp (x, a, b) {
  return (x < a) ? a : ((x > b) ? b : x);
}
function clamp (x, a, b) {
  return (x < a) ? a : ((x > b) ? b : x);
}
function clamp ( x , a , b ) { return ( x < a ) ? a : ( ( x > b ) ? b : x ) ; }
Based on THREE.JS
Based on THREE . JS