Here you can find the source of clamp(float val, float min, float max)
Parameter | Description |
---|---|
val | The value to clamp |
min | Minimal value |
max | Maximal value |
public static float clamp(float val, float min, float max)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w . j a v a2s .c o m * Clamps the given value between the min and max values * @param val The value to clamp * @param min Minimal value * @param max Maximal value */ public static float clamp(float val, float min, float max) { if (val < min) return min; if (val > max) return max; return val; } }