Here you can find the source of clamp(double value)
Parameter | Description |
---|---|
value | the value to check |
public static double clamp(double value)
//package com.java2s; // GNU Affero General Public License as published by the Free Software Foundation, either version public class Main { /**//from w w w. j a v a2s .c o m * Constraint the provided value to lie within [0..1] range. * * @param value the value to check * @return the adjusted value */ public static double clamp(double value) { if (value < 0) { value = 0; } if (value > 1) { value = 1; } return value; } }