Clamps the value to the specified range. @param val the value to clamp @param low the lower value that will replace val if val < low. @param high the upper value that will replace val if val > high. @return the clamped value in the range [low, high].
(double val, double low, double high)
| 23 | * @return the clamped value in the range [low, high]. |
| 24 | */ |
| 25 | public static final double clamp(double val, double low, double high) { |
| 26 | if (val > high) return high; |
| 27 | if (val < low) return low; |
| 28 | return val; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Input-checking inverse cosine. Clamps the input to the domain of acos (i.e. [-1..1]) before evaluating, instead of returning a silent NaN like java.lang.Math.acos. Useful when there's a |