This class represents a monadic operation that modulates a numeric input into a specified range using modular arithmetic. It allows defining a flexible boundary behavior, which can either model standard numeric ranges or angular (circular) ranges, with the ability to make the range inclusive.
Value parameters
angularBoundaryBehavior
when true, treats the boundary as circular (e.g., for angles), otherwise treats it as standard numeric behavior
inclusive
if true, both min and max are valid; if false, max is excluded, unless boundaryBehavior specifies otherwise.
Modulates a value into a specified range [min, max] using modular arithmetic. The result ensures the value falls within the inclusive range. Optionally supports circular ranges where min wraps to max.
Modulates a value into a specified range [min, max] using modular arithmetic. The result ensures the value falls within the inclusive range. Optionally supports circular ranges where min wraps to max.
Value parameters
inclusive
if true, both min and max are valid; if false, max is excluded, unless boundaryBehavior specifies otherwise.
max
the maximum of the range (inclusive according to inclusive parameter)
Defines a set of functions for modulating a numeric input to a specified range, leveraging the modulate method. Each function within the tuple is wrapped in a Try for safe evaluation.
Defines a set of functions for modulating a numeric input to a specified range, leveraging the modulate method. Each function within the tuple is wrapped in a Try for safe evaluation.
The tuple contains:
A modulation function for numeric inputs matching the provided minimum and maximum bounds as integers.
A modulation function for numeric inputs with bounds converted to Rational.
Another modulation function for numeric inputs matching the provided integer bounds.