![]() |
Fréchet View
1.6.0
A Tool for Exploring Fréchet Distance Algorithms
|
an interval of two double values.
Contains methods for intersection, union, and more.
This is one of the most-used basic classes in free-space and reachability algorithms.
It is up to the user of an interval object, whether the interval is interpreted as a closed, open or semi-open interval. (e.g. when constructing a free-space diagram, intervals are usually meant to be closed). The Interval class just manages two interval borders, without imposing an interpretation.
Invalid intervals are indicated by NAN values.
Empty intervals have lower bound == upper bound. Those intervals can be interpreted as empty, or as containing exactly one point.
Empty intervals with lower bound > upper are valid to, but are usually to be avoided.
Since Interval objects are small (two words) it is perfectly alright to pass them by value.
Definition at line 31 of file interval.h.
#include <interval.h>
Inherited by frechet::k::MappedInterval, and frechet::reach::BoundarySegment.
Public Member Functions | |
Interval () | |
Default constructor. Creates an invalid Interval. More... | |
Interval (double lower, double upper) | |
Constructor from boundary values. More... | |
Interval (const Interval &that) | |
Copy constructor. More... | |
Interval (const Interval &that, double shift) | |
Copy constructor with shift offset. More... | |
double | size () const |
size of the interval (upper - lower). More... | |
bool | valid () const |
validity test More... | |
bool | empty () const |
empty test More... | |
operator bool () const | |
bool | operator! () const |
double | lower () const |
double | upper () const |
double & | lower () |
double & | upper () |
Interval & | setLower (double value) |
update lower bound More... | |
Interval & | setUpper (double value) |
update upper bound More... | |
double | mid () const |
Interval & | operator= (const Interval &that) |
assignment operator More... | |
bool | operator== (const Interval &that) const |
equality comparator More... | |
bool | equals (const Interval &that, double precision) const |
equalality comparator with tolerance More... | |
bool | operator!= (const Interval &that) const |
non-equality comparator More... | |
Interval | normalized () const |
normalized More... | |
Interval & | normalize () |
make sure that lower <= upper, swapping bounds, if necessary More... | |
Interval & | clear () |
make this an invalid interval More... | |
bool | contains (double x) const |
containment test (assumes closed interval, bounds inclusive) More... | |
bool | contains (double x, double precision) const |
containment test with tolerance (assumes closed interval, bounds inclusive) More... | |
bool | contains (const Interval &that) const |
containment test (closed interval, bounds inclusive) More... | |
bool | intersects (const Interval &that) const |
intersection test (closed interval, bounds inclusive) More... | |
bool | intersects_proper (const Interval &that) const |
intersection test (open interval, bounds exclusive) More... | |
bool | bordersTo (const Interval &that) const |
adjacency test More... | |
double | mapToUnitInterval (double x) const |
re-map a value from this interval to the unit interval More... | |
double | mapFromUnitInterval (double x) const |
re-map a value from the unit interval to this interval More... | |
double | mapTo (double x, const Interval &other) const |
re-map a value to another interval More... | |
double | mapFrom (double x, const Interval &other) const |
re-map a value from another interval to this interval More... | |
Interval | operator+ (double offset) const |
shift the interval by a fixed offset More... | |
Interval & | operator+= (double offset) |
shift the interval by a fixed offset More... | |
Interval | operator- (double offset) const |
shift the interval by a fixed offset More... | |
Interval & | operator-= (double offset) |
shift the interval by a fixed offset More... | |
Interval | operator * (double factor) const |
multiply by a factor More... | |
Interval & | operator *= (double factor) |
multiply by a factor More... | |
Interval | operator/ (double factor) const |
divide by a factor More... | |
Interval & | operator/= (double factor) |
multiply by a factor More... | |
Interval | operator+ (const Interval &that) const |
union operator More... | |
Interval & | operator+= (const Interval &that) |
union operator More... | |
Interval | operator- (const Interval &that) const |
difference operator More... | |
Interval | operator-= (const Interval &that) |
difference operator More... | |
Interval | operator & (const Interval &that) const |
intersection operator More... | |
Interval & | operator&= (const Interval &that) |
intersection operator More... | |
Interval & | union_lf (const Interval &that) |
lock-free union operator; not used and not tested More... | |
Static Public Member Functions | |
static bool | equals (double a, double b) |
equality comparator More... | |
Static Public Attributes | |
static const Interval | UNIT |
the unit interval [0,1] More... | |
static const Interval | INVALID = Interval () |
an invalid interval (contains NAN values) More... | |
Private Member Functions | |
Interval & | assign (double lower, double upper) |
assign new bounds More... | |
Static Private Member Functions | |
static void | assign_min_lf (volatile double *value, double update_value) |
lock-free assigment; not used and not tested More... | |
static void | assign_max_lf (volatile double *value, double update_value) |
lock-free assigment; not used and not tested More... | |
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 More... | |
Private Attributes | |
double | _lower |
lower and upper border of the interval More... | |
double | _upper |
|
inline |
Default constructor. Creates an invalid Interval.
Definition at line 44 of file interval.h.
|
inline |
Constructor from boundary values.
lower | lower bound |
upper | upper bound |
Definition at line 50 of file interval.h.
|
inline |
|
inline |
Copy constructor with shift offset.
that | object to copy from |
shift | offset resulting interval by this value |
Definition at line 61 of file interval.h.
|
inlineprivate |
assign new bounds
lower | new lower bound |
upper | new upper bound |
Definition at line 434 of file interval.h.
|
staticprivate |
lock-free assigment; not used and not tested
Definition at line 46 of file interval.cpp.
|
staticprivate |
lock-free assigment; not used and not tested
Definition at line 28 of file interval.cpp.
|
inline |
adjacency test
that | interval to compare to |
Definition at line 252 of file interval.h.
|
inline |
make this an invalid interval
Definition at line 197 of file interval.h.
|
staticprivate |
lock-free compare-and-swap; not used and not tested
Definition at line 64 of file interval.cpp.
|
inline |
containment test (assumes closed interval, bounds inclusive)
x | a value |
Definition at line 206 of file interval.h.
|
inline |
containment test with tolerance (assumes closed interval, bounds inclusive)
x | a value |
precision | tolerance |
Definition at line 216 of file interval.h.
|
inline |
containment test (closed interval, bounds inclusive)
that | interval to test for |
Definition at line 225 of file interval.h.
|
inline |
|
inlinestatic |
equality comparator
Definition at line 137 of file interval.h.
|
inline |
equalality comparator with tolerance
that | interval to compare to |
precision | tolerance |
Definition at line 159 of file interval.h.
|
inline |
intersection test (closed interval, bounds inclusive)
that | interval to test for |
Definition at line 234 of file interval.h.
|
inline |
intersection test (open interval, bounds exclusive)
that | interval to test for |
Definition at line 243 of file interval.h.
|
inline |
Definition at line 92 of file interval.h.
|
inline |
Definition at line 101 of file interval.h.
|
inline |
re-map a value from another interval to this interval
x | a value (possibly contained in this interval) |
other | another interval |
Definition at line 293 of file interval.h.
|
inline |
re-map a value from the unit interval to this interval
x | a value (possibly contained in this interval) |
Definition at line 273 of file interval.h.
|
inline |
re-map a value to another interval
x | a value (possibly contained in this interval) |
other | another interval |
Definition at line 283 of file interval.h.
|
inline |
re-map a value from this interval to the unit interval
x | a value (possibly contained in this interval) |
Definition at line 260 of file interval.h.
|
inline |
Definition at line 121 of file interval.h.
|
inline |
make sure that lower <= upper, swapping bounds, if necessary
Definition at line 187 of file interval.h.
|
inline |
intersection operator
that | another interval |
Definition at line 405 of file interval.h.
|
inline |
multiply by a factor
Definition at line 330 of file interval.h.
|
inline |
multiply by a factor
Definition at line 337 of file interval.h.
|
inline |
Definition at line 83 of file interval.h.
|
inline |
Definition at line 87 of file interval.h.
|
inline |
non-equality comparator
that | interval to compare to |
Definition at line 167 of file interval.h.
intersection operator
that | another interval |
Definition at line 416 of file interval.h.
|
inline |
shift the interval by a fixed offset
Definition at line 301 of file interval.h.
union operator
that | another interval |
Definition at line 361 of file interval.h.
|
inline |
shift the interval by a fixed offset
Definition at line 308 of file interval.h.
union operator
that | another interval |
Definition at line 372 of file interval.h.
|
inline |
shift the interval by a fixed offset
Definition at line 316 of file interval.h.
difference operator
that | another interval |
Definition at line 383 of file interval.h.
|
inline |
shift the interval by a fixed offset
Definition at line 323 of file interval.h.
difference operator
that | another interval |
Definition at line 394 of file interval.h.
|
inline |
divide by a factor
Definition at line 345 of file interval.h.
|
inline |
multiply by a factor
Definition at line 352 of file interval.h.
assignment operator
that | interval to copy from |
Definition at line 130 of file interval.h.
|
inline |
equality comparator
that | interval to compare to |
Definition at line 149 of file interval.h.
|
inline |
update lower bound
value | new value for lower bound |
Definition at line 111 of file interval.h.
|
inline |
update upper bound
value | new value for upper bound |
Definition at line 117 of file interval.h.
|
inline |
size of the interval (upper - lower).
Definition at line 67 of file interval.h.
lock-free union operator; not used and not tested
Sketch for a lock-free union operator
Definition at line 19 of file interval.cpp.
|
inline |
Definition at line 96 of file interval.h.
|
inline |
Definition at line 105 of file interval.h.
|
inline |
validity test
Definition at line 74 of file interval.h.
|
private |
lower and upper border of the interval
Definition at line 34 of file interval.h.
|
private |
Definition at line 34 of file interval.h.
an invalid interval (contains NAN values)
Definition at line 39 of file interval.h.
|
static |
the unit interval [0,1]
Definition at line 37 of file interval.h.