scamp_extensions.utilities.math.wrap_to_range

scamp_extensions.utilities.math.wrap_to_range(x, range_min, range_max, mirror=False)[source]

Wraps the input x into the given range, either jumping back to the other side of the range at the boundaries, or if the mirror parameter is set, reflecting at the boundaries.

Parameters:
  • x – the input

  • range_min – minimum of wrapping range

  • range_max – maximum of wrapping range

  • mirror – whether to mirror at the boundaries