Here you can find the source of clamp(float x, float y, float z)
Parameter | Description |
---|---|
x | Number one |
y | Number two |
z | Number three |
public static float clamp(float x, float y, float z)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww . j ava 2s.co m*/ * Returns middle value from all three * @param x Number one * @param y Number two * @param z Number three * @return The middle number */ public static float clamp(float x, float y, float z) { if (x > y) { float tmp = x; x = y; y = tmp; } return Math.max(x, Math.min(y, z)); } }