Nez.Portable/Math/Mathf.cs
/// <summary>
/// Restricts a value to be within a specified range.
/// </summary>
/// <param name="value">The value to clamp.</param>
/// <param name="min">The minimum value. If <c>value</c> is less than <c>min</c>, <c>min</c> will be returned.</param>
/// <param name="max">The maximum value. If <c>value</c> is greater than <c>max</c>, <c>max</c> will be returned.</param>
/// <returns>The clamped value.</returns>
Restricts a value to be within a specified range.
Restricts a value to be within a specified range .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static int clamp(int value, int min, int max)
        {
            value = (value > max) ? max : value;
            value = (value < min) ? min : value;
            return value;
        }
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ] public static int clamp ( int value , int min , int max ) { value = ( value > max ) ? max : value ; value = ( value < min ) ? min : value ; return value ; }
Restricts a value to be within a specified range.
Restricts a value to be within a specified range .
The clamped value.
The clamped value .
value
int
The value to clamp.
The value to clamp .
min
int
The minimum value. If valueminmin
The minimum value . If valueminmin
max
int
The maximum value. If valuemaxmax
The maximum value . If valuemaxmax