Here you can find the source of clamp(double d, double min, double max)
Parameter | Description |
---|---|
d | The value to clamp. |
min | The minimum. |
max | The maximum. |
public static double clamp(double d, double min, double max)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww . ja v a 2 s . co m * Clamps d between min and max. * * @param d The value to clamp. * @param min The minimum. * @param max The maximum. * @return The clamped value. */ public static double clamp(double d, double min, double max) { if (d < min) return min; else if (d > max) return max; else return d; } }