Clamp
double Clamp (double value, double min, double max)
Return Value: If value is less then min the return value is min. If value is greater than max then the return value is max. Otherwise the return value is value.
Arguments:
value |
a number |
min |
number that value cannot be smaller than |
max |
number that value cannot be larger than |
Value is "clamped" between the min and max numbers so that it cannot be smaller than min and it cannot be larger than max.
Example:
Exp_1
|_ Clamp( 25, 40, 65 )
Exp_2
|_ Clamp( 50, 40, 65 )
Exp_3
|_ Clamp( 105, 40, 65 )
Exp_4
|_Clamp( [Null:ypos], -2.0, 2.0 )
|-> [Null:ypos]
Exp_1
|_ Clamp( 25, 40, 65 )
Exp_2
|_ Clamp( 50, 40, 65 )
Exp_3
|_ Clamp( 105, 40, 65 )
Exp_4
|_Clamp( [Null:ypos], -2.0, 2.0 )
|-> [Null:ypos]
Exp_1 returns 40 since 25 is smaller than 40. Exp_2 returns 50 since 50 is between 40 and 65. Exp_3 returns 65 since 105 is greater than 65. Exp_4 will return Null's ypos clamped off to -2.0->2.0 and then assigns that value back to Null. This effectively restricts the motion of Null on Y to the range -2.0 to 2.0.
Converted from CHM to HTML with chm2web Pro 2.82 (unicode) |