Method Clamp
- Namespace
- Zyl.VectorTraits
- Assembly
- VectorTraits.dll
Clamp(sbyte, sbyte, sbyte)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
[CLSCompliant(false)]
public static sbyte Clamp(sbyte value, sbyte amin, sbyte amax)
Parameters
valuesbyteThe value to be clamped (要限制的值).
aminsbyteThe lower bound of the result (结果的下限).
amaxsbyteThe upper bound of the result (结果的上限).
Returns
- sbyte
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(byte, byte, byte)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static byte Clamp(byte value, byte amin, byte amax)
Parameters
valuebyteThe value to be clamped (要限制的值).
aminbyteThe lower bound of the result (结果的下限).
amaxbyteThe upper bound of the result (结果的上限).
Returns
- byte
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(short, short, short)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static short Clamp(short value, short amin, short amax)
Parameters
valueshortThe value to be clamped (要限制的值).
aminshortThe lower bound of the result (结果的下限).
amaxshortThe upper bound of the result (结果的上限).
Returns
- short
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(ushort, ushort, ushort)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
[CLSCompliant(false)]
public static ushort Clamp(ushort value, ushort amin, ushort amax)
Parameters
valueushortThe value to be clamped (要限制的值).
aminushortThe lower bound of the result (结果的下限).
amaxushortThe upper bound of the result (结果的上限).
Returns
- ushort
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(int, int, int)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static int Clamp(int value, int amin, int amax)
Parameters
valueintThe value to be clamped (要限制的值).
aminintThe lower bound of the result (结果的下限).
amaxintThe upper bound of the result (结果的上限).
Returns
- int
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(uint, uint, uint)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
[CLSCompliant(false)]
public static uint Clamp(uint value, uint amin, uint amax)
Parameters
valueuintThe value to be clamped (要限制的值).
aminuintThe lower bound of the result (结果的下限).
amaxuintThe upper bound of the result (结果的上限).
Returns
- uint
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(long, long, long)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static long Clamp(long value, long amin, long amax)
Parameters
valuelongThe value to be clamped (要限制的值).
aminlongThe lower bound of the result (结果的下限).
amaxlongThe upper bound of the result (结果的上限).
Returns
- long
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(ulong, ulong, ulong)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
[CLSCompliant(false)]
public static ulong Clamp(ulong value, ulong amin, ulong amax)
Parameters
valueulongThe value to be clamped (要限制的值).
aminulongThe lower bound of the result (结果的下限).
amaxulongThe upper bound of the result (结果的上限).
Returns
- ulong
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(nint, nint, nint)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static nint Clamp(nint value, nint amin, nint amax)
Parameters
valuenintThe value to be clamped (要限制的值).
aminnintThe lower bound of the result (结果的下限).
amaxnintThe upper bound of the result (结果的上限).
Returns
- nint
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(nuint, nuint, nuint)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
[CLSCompliant(false)]
public static nuint Clamp(nuint value, nuint amin, nuint amax)
Parameters
valuenuintThe value to be clamped (要限制的值).
aminnuintThe lower bound of the result (结果的下限).
amaxnuintThe upper bound of the result (结果的上限).
Returns
- nuint
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(float, float, float)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static float Clamp(float value, float amin, float amax)
Parameters
valuefloatThe value to be clamped (要限制的值).
aminfloatThe lower bound of the result (结果的下限).
amaxfloatThe upper bound of the result (结果的上限).
Returns
- float
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(double, double, double)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static double Clamp(double value, double amin, double amax)
Parameters
valuedoubleThe value to be clamped (要限制的值).
amindoubleThe lower bound of the result (结果的下限).
amaxdoubleThe upper bound of the result (结果的上限).
Returns
- double
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also
Clamp(Half, Half, Half)
Returns value clamped to the inclusive range of amin and amax (返回限制在 amin 和 amax 范围内的 value).
public static Half Clamp(Half value, Half amin, Half amax)
Parameters
valueHalfThe value to be clamped (要限制的值).
aminHalfThe lower bound of the result (结果的下限).
amaxHalfThe upper bound of the result (结果的上限).
Returns
- Half
Returns
(value<amax)?( (value>amin)?value:amin ):amax.
- See Also