cgv
|
#include <interval.h>
Public Member Functions | |
interval operations | |
interval () | |
construct empty interval | |
interval (bool) | |
interval (const interval< T > &I) | |
copy constructor | |
interval (const T &_lb, const T &_ub) | |
contruct interval from bounds, sort bounds if necessary. To construct empty interval call the standard constructor | |
bool | is_empty () const |
check if interval is empty | |
void | clear () |
set to empty interval | |
bool | contains (const T &v) const |
check if given value is contained in interval | |
void | set_lower_bound (const T &_lb) |
set the lower bound | |
void | set_upper_bound (const T &_ub) |
set the upper bound | |
const T & | get_lower_bound () const |
return the lower bound | |
const T & | get_upper_bound () const |
return the upper bound | |
T | get_center () const |
return the center value, which is only valid if the interval is not empty | |
T | get_size () const |
return the size of the interval | |
interval< T > & | intersect (const interval< T > &I) |
set interval to intersection with given interval and return reference to this interval | |
interval< T > | intersection (const interval< T > &I) const |
return intersection interval | |
interval< T > & | extend (const T &v) |
extend interval such that it includes the given value | |
interval< T > & | extension (const T &v) |
return extension of interval that it includes the given value | |
interval< T > & | extend (const interval< T > &I) |
extend interval such that it includes the given interval | |
interval< T > & | extend (const T &v0, const T &v1, const T &v2, const T &v3) |
extend by four values | |
interval< T > & | extension (const interval< T > &J) |
return extension of interval that it includes the given interval | |
scalar operators | |
interval< T > & | operator*= (const T &s) |
scale the interval | |
interval< T > | operator* (const T &s) const |
return scaled the interval | |
interval< T > & | operator/= (const T &s) |
divide the interval | |
interval< T > | operator/ (const T &s) const |
return divided the interval | |
interval< T > & | operator+= (const T &s) |
right shift interval by adding scalar to both bounds | |
interval< T > | operator+ (const T &s) const |
return right shifted interval | |
interval< T > & | operator-= (const T &s) |
left shift interval by subtracting scalar from both bounds | |
interval< T > | operator- (const T &s) const |
return left shifted interval | |
interval operators | |
interval< T > & | operator*= (const interval< T > &I) |
compute the interval of all values of all products of values from the two intervals | |
interval< T > | operator* (const interval< T > &J) const |
return the interval of all values of products of values from the two intervals | |
interval< T > & | operator/= (const interval< T > &I) |
interval< T > | operator/ (const interval< T > &J) const |
return the interval of all values of quotients of values from the two intervals. See also comments on the /= operator(). | |
interval< T > | operator- () const |
unary minus operator reflects interval at zero value | |
interval< T > & | operator+= (const interval< T > &I) |
compute interval of all sums of values from the two intervals | |
interval< T > | operator+ (const interval< T > &J) const |
return interval of all sums of values from the two intervals | |
interval< T > & | operator-= (const interval< T > &I) |
compute interval of all differences of values from the two intervals | |
interval< T > | operator- (const interval< T > &J) const |
return interval of all differences of values from the two intervals | |
comparison operators | |
bool | operator== (const interval< T > &I) const |
check for equality of two intervals | |
bool | operator!= (const interval< T > &I) const |
check for inequality of two intervals | |
bool | operator< (const interval< T > &I) const |
only returns true if both intervals are not empty and the operator holds for all values in both intervals | |
bool | operator> (const interval< T > &I) const |
only returns true if both intervals are not empty and the operator holds for all values in both intervals | |
the interval template represents a close interval of two numbers, i.e. [a,b]. All arithmetic operators are overloaded for the interval template. This allows to compute bounds for an arbitrary expression. For example if the variable x is from the interval [-1,1] then the expression x*x is from the interval [0,1], what can be computed via \codebegin interval<int> x(-1,1); interval<int> e = x*x; std::cout << e << std::endl; \codeend Furthermore, the interval template supports further interval based operations like intersection and extension of an interval.
|
inline |
construct interval over all valid values of the value type, where the parameter is only a dummy to distinguish this constructor from the standard constructor. This constructor relies on cgv::type::traits::min and cgv::type::traits::max. Thus if you want to build intervals over non standard types, you need to ensure that these two traits are instantiated for your type when using this constructor.
|
inline |
compute the interval of all values of all quotients of values from the two intervals. Notice that if zero is contained in the second interval, the result is the complete interval of all valid values and the same precondition holds as for the constructor with the bool dummy parameter interval(bool).