7 namespace frechet {
namespace data {
137 inline static bool equals(
double a,
double b) {
139 return std::isnan(b);
217 return (x >= (
_lower-precision))
218 && (x <= (
_upper+precision));
441 static void assign_min_lf(
volatile double* value,
double update_value);
443 static void assign_max_lf(
volatile double* value,
double update_value);
445 static int64_t
compare_and_swap(
volatile int64_t* value, int64_t old_value, int64_t update_value);
492 return H==that.
H &&
V==that.
V;
500 return H!=that.
H ||
V!=that.
V;
Interval(const Interval &that, double shift)
Copy constructor with shift offset.
QDebug operator<<(QDebug debug, const frechet::data::Interval &ival)
operator for printing debug info to a QDebug stream
static bool equals(double a, double b)
equality comparator
bool contains(const Interval &that) const
containment test (closed interval, bounds inclusive)
double mapTo(double x, const Interval &other) const
re-map a value to another interval
Interval & setLower(double value)
update lower bound
IntervalPair & clear()
clear both intervals (assigning NAN as boundary values)
Interval operator &(const Interval &that) const
intersection operator
static const Interval INVALID
an invalid interval (contains NAN values)
Interval H
horizontal interval
global definitions for all algorithms.
Interval(const Interval &that)
Copy constructor.
bool intersects(const Interval &that) const
intersection test (closed interval, bounds inclusive)
Interval operator/(double factor) const
divide by a factor
bool intersects_proper(const Interval &that) const
intersection test (open interval, bounds exclusive)
Interval & operator-=(double offset)
shift the interval by a fixed offset
Interval & operator=(const Interval &that)
assignment operator
Interval & union_lf(const Interval &that)
lock-free union operator; not used and not tested
double _lower
lower and upper border of the interval
Interval()
Default constructor. Creates an invalid Interval.
a pair of horizonal / vertical intervals.
double mapFrom(double x, const Interval &other) const
re-map a value from another interval to this interval
bool bordersTo(const Interval &that) const
adjacency test
bool empty() const
empty test
bool operator!=(const Interval &that) const
non-equality comparator
Interval & clear()
make this an invalid interval
std::ostream & operator<<(std::ostream &stream, const frechet::data::Interval &ival)
operator for printing debug info to a std::ostream
bool equals(const Interval &that, double precision) const
equalality comparator with tolerance
Interval V
vertical interval
static void assign_max_lf(volatile double *value, double update_value)
lock-free assigment; not used and not tested
Interval normalized() const
normalized
Interval operator-(double offset) const
shift the interval by a fixed offset
double mapFromUnitInterval(double x) const
re-map a value from the unit interval to this interval
IntervalPair & operator+=(const IntervalPair &that)
union operator
double size() const
size of the interval (upper - lower).
bool operator==(const IntervalPair &that)
equality comparator
bool contains(double x, double precision) const
containment test with tolerance (assumes closed interval, bounds inclusive)
Interval & operator&=(const Interval &that)
intersection operator
Interval & operator+=(double offset)
shift the interval by a fixed offset
double min(double a, double b)
minimum function with checks for NAN
Interval & normalize()
make sure that lower <= upper, swapping bounds, if necessary
Interval & setUpper(double value)
update upper bound
Interval operator *(double factor) const
multiply by a factor
static void assign_min_lf(volatile double *value, double update_value)
lock-free assigment; not used and not tested
Interval(double lower, double upper)
Constructor from boundary values.
static const Interval UNIT
the unit interval [0,1]
Interval & operator/=(double factor)
multiply by a factor
IntervalPair()
empty constructor; creates a pair of invalid intervals
double mapToUnitInterval(double x) const
re-map a value from this interval to the unit interval
static int64_t compare_and_swap(volatile int64_t *value, int64_t old_value, int64_t update_value)
lock-free compare-and-swap; not used and not tested
bool contains(double x) const
containment test (assumes closed interval, bounds inclusive)
Interval & operator *=(double factor)
multiply by a factor
IntervalPair translated(double i, double j) const
translate both intervals
Interval operator+(double offset) const
shift the interval by a fixed offset
bool operator!=(const IntervalPair &that)
non-equality comparator
Interval & assign(double lower, double upper)
assign new bounds
an interval of two double values.
Number abs(const Number &x)
abs() function template for arbitrary numerical types
bool valid() const
validity test
IntervalPair(const Interval &ah, const Interval &av)
constructor with intervals
double max(double a, double b)
maximum function with checks for NAN
QRectF boundingRect() const
calculate the bounding rectangle, i.e. a rectangle that is defined by the horizontal and vertical int...
bool operator==(const Interval &that) const
equality comparator