Here you can find the source of clamp(float input, float min, float max)
public static float clamp(float input, float min, float max)
//package com.java2s; public class Main { public static float clamp(float input, float min, float max) { return (input < min) ? min : (input > max) ? max : input; }/* ww w.j a va 2 s .c om*/ public static double clamp(double input, double min, double max) { return (input < min) ? min : (input > max) ? max : input; } }