@ Pure public static double clamp ( double v , double min , double max ) { assert min <= max : AssertMessages . lowerEqualParameters ( 1 , min , 2 , max ) ; if ( v < min ) { return min ; } if ( v > max ) { return max ; } return v ; }
Clamp the given value to the given range .