 | MathUtilsClampT Method |
Clamps the passed value to the passed bounds (i.e. if value is smaller than min bound it's set to min bound,
if bigger than max bound it's set to max bound).
Namespace: Slash.Math.UtilsAssembly: Slash.Math (in Slash.Math.dll) Version: 1.0.6018.40177
Syntaxpublic static T Clamp<T>(
T value,
T min,
T max
)
where T : Object, IComparable<T>
Public Shared Function Clamp(Of T As {Object, IComparable(Of T)}) (
value As T,
min As T,
max As T
) As T
public:
generic<typename T>
where T : Object, IComparable<T>
static T Clamp(
T value,
T min,
T max
)
static member Clamp :
value : 'T *
min : 'T *
max : 'T -> 'T when 'T : Object and IComparable<'T>
Parameters
- value
- Type: T
Value to clamp. - min
- Type: T
Minimum bound. - max
- Type: T
Maximum bound (inclusive).
Type Parameters
- T
- Type of the value to clamp.
Return Value
Type:
T Clamped value.
See Also