Table of Contents

Method Clamp

Namespace
Zyl.VectorTraits
Assembly
VectorTraits.dll

Clamp(sbyte, sbyte, sbyte)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

[CLSCompliant(false)]
public static sbyte Clamp(sbyte value, sbyte amin, sbyte amax)

Parameters

value sbyte

The value to be clamped (要限制的值).

amin sbyte

The lower bound of the result (结果的下限).

amax sbyte

The 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 (返回限制在 aminamax 范围内的 value).

public static byte Clamp(byte value, byte amin, byte amax)

Parameters

value byte

The value to be clamped (要限制的值).

amin byte

The lower bound of the result (结果的下限).

amax byte

The 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 (返回限制在 aminamax 范围内的 value).

public static short Clamp(short value, short amin, short amax)

Parameters

value short

The value to be clamped (要限制的值).

amin short

The lower bound of the result (结果的下限).

amax short

The 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 (返回限制在 aminamax 范围内的 value).

[CLSCompliant(false)]
public static ushort Clamp(ushort value, ushort amin, ushort amax)

Parameters

value ushort

The value to be clamped (要限制的值).

amin ushort

The lower bound of the result (结果的下限).

amax ushort

The 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 (返回限制在 aminamax 范围内的 value).

public static int Clamp(int value, int amin, int amax)

Parameters

value int

The value to be clamped (要限制的值).

amin int

The lower bound of the result (结果的下限).

amax int

The 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 (返回限制在 aminamax 范围内的 value).

[CLSCompliant(false)]
public static uint Clamp(uint value, uint amin, uint amax)

Parameters

value uint

The value to be clamped (要限制的值).

amin uint

The lower bound of the result (结果的下限).

amax uint

The 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 (返回限制在 aminamax 范围内的 value).

public static long Clamp(long value, long amin, long amax)

Parameters

value long

The value to be clamped (要限制的值).

amin long

The lower bound of the result (结果的下限).

amax long

The 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 (返回限制在 aminamax 范围内的 value).

[CLSCompliant(false)]
public static ulong Clamp(ulong value, ulong amin, ulong amax)

Parameters

value ulong

The value to be clamped (要限制的值).

amin ulong

The lower bound of the result (结果的下限).

amax ulong

The 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 (返回限制在 aminamax 范围内的 value).

public static nint Clamp(nint value, nint amin, nint amax)

Parameters

value nint

The value to be clamped (要限制的值).

amin nint

The lower bound of the result (结果的下限).

amax nint

The 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 (返回限制在 aminamax 范围内的 value).

[CLSCompliant(false)]
public static nuint Clamp(nuint value, nuint amin, nuint amax)

Parameters

value nuint

The value to be clamped (要限制的值).

amin nuint

The lower bound of the result (结果的下限).

amax nuint

The 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 (返回限制在 aminamax 范围内的 value).

public static float Clamp(float value, float amin, float amax)

Parameters

value float

The value to be clamped (要限制的值).

amin float

The lower bound of the result (结果的下限).

amax float

The 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 (返回限制在 aminamax 范围内的 value).

public static double Clamp(double value, double amin, double amax)

Parameters

value double

The value to be clamped (要限制的值).

amin double

The lower bound of the result (结果的下限).

amax double

The 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 (返回限制在 aminamax 范围内的 value).

public static Half Clamp(Half value, Half amin, Half amax)

Parameters

value Half

The value to be clamped (要限制的值).

amin Half

The lower bound of the result (结果的下限).

amax Half

The upper bound of the result (结果的上限).

Returns

Half

Returns (value<amax)?( (value>amin)?value:amin ):amax.

See Also