User Tools

Site Tools


4rpl:commands:clamp

Index
Math Utility

clamp

clamp(<-val <-min <-max)

Description

Clamps the given value between the given minimum and maximum values. Returns the given value if it is within the min and max range. Returns the min value if the given value is less than the min. Returns the max value if the given value is greater than the max value. Use Clamp to restrict a value to a range that is defined by the min and max values. If the value is a vector, each element of the vector is clamped separately.

Examples

trace(clamp(42 -10 10)) #prints '10'

Index

4rpl/commands/clamp.txt · Last modified: 2022/09/04 09:26 by Karsten75