#include <Range.hpp>
Public Member Functions | |
constexpr | Range () |
constexpr | Range (double min, double max) |
bool | contains (const Range &range) const |
bool | contains (double x) const |
bool | containsFuzzy (double x, double eps=1e-14) const |
bool | empty () const |
Range & | extend (const Range &range) |
Range & | extend (double x) |
Range & | extendWithRedshift (double z) |
Range & | intersect (const Range &range) |
double | max () const |
double | mid () const |
double | min () const |
void | set (double min, double max) |
double | width () const |
Protected Attributes | |
double | _max |
double | _min |
Range is a low-level class for working with ranges: each instance represents a range with a minimum and maximum value. The class is fully implemented inline (in this header file). Most compilers optimize away all overhead so that using this class is just as efficient as directly writing the code in terms of the range components.
|
inlineconstexpr |
This is the default constructor; the minimum and maximum values are initialized to zero.
|
inlineconstexpr |
This constructor initializes the range to the minimum and maximum values provided as arguments.
|
inline |
This function returns true if the given range is inside the receiving range, and false otherwise.
|
inline |
This function returns true if the given value is inside the range, and false otherwise.
|
inline |
This function returns true if the given value is inside the range, with the given fuzzyness factor, and false otherwise.
|
inline |
This function returns true if the range is empty (its minimum is larger than or equal to its maximum), and false otherwise.
This function updates the range so that it represents the union of the original range with the other range given as an argument. If the two ranges do not overlap, the resulting range will include the interval between the input ranges.
|
inline |
This function updates the range so that it includes the specified value.
|
inline |
This function extends the range with a factor of (1+z) on each side.
This function updates the range so that it represents the intersection of the original range with the other range given as an argument. If the two ranges do not overlap, the resulting range will have a minimum larger than or equal to its maximum.
|
inline |
This function returns the maximum value of the range.
|
inline |
This function returns the middle value of the range.
|
inline |
This function returns the minimum value of the range.
|
inline |
This function sets the range to the minimum and maximum values provided as arguments.
|
inline |
This function returns the width of the range, i.e. the maximum value minus the minimum value.