within_bounds

Tests whether a value is within certain bounds or not.

To use with scalar values (integers, floats), simply plug them in.

For vector values, will return true if the value is within the bounding box described by bounds_min / bounds_max.

Inclusivity

Inclusive means that being exactly equal to the bound is considered within the bounds. The alternative is exclusive, which means that beinge exactly on the bounds is not considered to be within the bounds.

By default, the comparison is inclusive at the minimum bound, and exclusive at the upper bound. This is the default type of comparison for many algorithms, such as testing whether an index is within array size in a zero indexed array. It is also the right default for testing whether an is within a slice of an array.

Inputs

value

Value to test.

bounds_min

Minimum bound.

bounds_max

Maximum bound.

inclusive_min

If true then bounds_min is part of the bounds. Default is true.

inclusive_max

If true then bounds_max is part of the bounds. Default is false.

Output

in_bounds

True if value is within bounds, else false.