Function get_interval(const double, const double)

Function Documentation

inline double get_interval(const double x, const double length)

Calculates the interval of a given value within a specified length.

The interval is calculated by adding half of the length to the value, taking the modulo of the sum with the length, and subtracting half of the length.

Parameters:
  • x -- The value for which the interval is calculated.

  • length -- The length of the interval.

Returns:

The interval of the value within the specified length.