template struct CCL::Math::Range
Overview
#include <mathrange.h> template <class T> struct Range { // fields T start; T end; // construction Range (); Range (const T _start, const T _end); // methods bool isEmpty () const; T getLength () const; bool isOverlap (const Range& other) const; bool getOverlap (Range& result, const Range& other) const; T getOverlapLength (const Range& other) const; T scaleValue (const T factor) const; bool bound (const Range& other); Range& include (T value); Range& join (const Range& other); Range& offset (T offset); T getBound (T value) const; bool isInsideClosed (T value) const; bool isInsideOpen (T value) const; bool isInside (T value) const; Range& operator () (T start, T end); bool operator == (const Range& other) const; bool operator != (const Range& other) const; };
Detailed Documentation
Methods
bool isEmpty () const
Check if range is empty.
T getLength () const
Get range length.
bool isOverlap (const Range& other) const
Check for overlap.
bool getOverlap (Range& result, const Range& other) const
Get overlap with other range.
T getOverlapLength (const Range& other) const
Get length of overlap with other range.
T scaleValue (const T factor) const
Get scaled value from range (0 -> start, 1 -> end).
bool bound (const Range& other)
Bound to overlap with other range.
Returns false, if result is empty.
Range& include (T value)
Enlarge if necessary to include given value.
Range& join (const Range& other)
Join with other range.
Range& offset (T offset)
Offset start and end.
T getBound (T value) const
Get value bound to this range.
bool isInsideClosed (T value) const
Check if value is inside this range as a closed interval [start, end].
bool isInsideOpen (T value) const
Check if value is inside this range as an open interval (start, end).
bool isInside (T value) const
Check if value is inside this range as a left-closed, right-open interval [start, end).
Range& operator () (T start, T end)
Assign new range.
bool operator == (const Range& other) const
Compare ranges.