Here you can find the source of Clamp(float a, float min, float max)
public static float Clamp(float a, float min, float max)
//package com.java2s; public class Main { public static float Clamp(float a, float min, float max) { if (a < min) { return min; } else if (a > max) { return max; } else {/*from w w w . j av a 2s .co m*/ return a; } } }