iCub-main
|
Represents the range an axis is encompassing. More...
#include <qcustomplot.h>
Public Member Functions | |
QCPRange () | |
Constructs a range with lower and upper set to zero. | |
QCPRange (double lower, double upper) | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Constructs a range with the specified lower and upper values. | |
bool | operator== (const QCPRange &other) |
bool | operator!= (const QCPRange &other) |
QCPRange & | operator+= (const double &value) |
Adds value to both boundaries of the range. | |
QCPRange & | operator-= (const double &value) |
Subtracts value from both boundaries of the range. | |
QCPRange & | operator*= (const double &value) |
Multiplies both boundaries of the range by value. | |
QCPRange & | operator/= (const double &value) |
Divides both boundaries of the range by value. | |
double | size () const |
Returns the size of the range, i.e. | |
double | center () const |
Returns the center of the range, i.e. | |
void | normalize () |
Makes sure lower is numerically smaller than upper. | |
void | expand (const QCPRange &otherRange) |
Expands this range such that otherRange is contained in the new range. | |
QCPRange | expanded (const QCPRange &otherRange) const |
Returns an expanded range that contains this and otherRange. | |
QCPRange | sanitizedForLogScale () const |
Returns a sanitized version of the range. | |
QCPRange | sanitizedForLinScale () const |
Returns a sanitized version of the range. | |
bool | contains (double value) const |
Returns true when value lies within or exactly on the borders of the range. | |
Static Public Member Functions | |
static bool | validRange (double lower, double upper) |
Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange. | |
static bool | validRange (const QCPRange &range) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange. | |
Public Attributes | |
double | lower |
double | upper |
Static Public Attributes | |
static const double | minRange = 1e-280 |
Minimum range size (upper - lower) the range changing functions will accept. | |
static const double | maxRange = 1e250 |
Maximum values (negative and positive) the range will accept in range-changing functions. | |
Friends | |
const QCPRange | operator+ (const QCPRange &, double) |
Adds value to both boundaries of the range. | |
const QCPRange | operator+ (double, const QCPRange &) |
Adds value to both boundaries of the range. | |
const QCPRange | operator- (const QCPRange &range, double value) |
Subtracts value from both boundaries of the range. | |
const QCPRange | operator* (const QCPRange &range, double value) |
Multiplies both boundaries of the range by value. | |
const QCPRange | operator* (double value, const QCPRange &range) |
Multiplies both boundaries of the range by value. | |
const QCPRange | operator/ (const QCPRange &range, double value) |
Divides both boundaries of the range by value. | |
Represents the range an axis is encompassing.
contains a lower and upper double value and provides convenience input, output and modification functions.
Definition at line 475 of file qcustomplot.h.
QCPRange::QCPRange | ( | ) |
Constructs a range with lower and upper set to zero.
Definition at line 1310 of file qcustomplot.cpp.
QCPRange::QCPRange | ( | double | lower, |
double | upper | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Constructs a range with the specified lower and upper values.
Definition at line 1319 of file qcustomplot.cpp.
double QCPRange::center | ( | ) | const |
Returns the center of the range, i.e.
(upper+lower)*0.5
Definition at line 1337 of file qcustomplot.cpp.
bool QCPRange::contains | ( | double | value | ) | const |
Returns true when value lies within or exactly on the borders of the range.
Definition at line 1453 of file qcustomplot.cpp.
void QCPRange::expand | ( | const QCPRange & | otherRange | ) |
Expands this range such that otherRange is contained in the new range.
It is assumed that both this range and otherRange are normalized (see normalize).
If otherRange is already inside the current range, this function does nothing.
Definition at line 1360 of file qcustomplot.cpp.
Returns an expanded range that contains this and otherRange.
It is assumed that both this range and otherRange are normalized (see normalize).
Definition at line 1375 of file qcustomplot.cpp.
void QCPRange::normalize | ( | ) |
Makes sure lower is numerically smaller than upper.
If this is not the case, the values are swapped.
Definition at line 1346 of file qcustomplot.cpp.
|
inline |
Definition at line 484 of file qcustomplot.h.
|
inline |
Multiplies both boundaries of the range by value.
Definition at line 488 of file qcustomplot.h.
|
inline |
Adds value to both boundaries of the range.
Definition at line 486 of file qcustomplot.h.
|
inline |
Subtracts value from both boundaries of the range.
Definition at line 487 of file qcustomplot.h.
|
inline |
Divides both boundaries of the range by value.
Definition at line 489 of file qcustomplot.h.
|
inline |
Definition at line 483 of file qcustomplot.h.
QCPRange QCPRange::sanitizedForLinScale | ( | ) | const |
Returns a sanitized version of the range.
Sanitized means for linear scales, that lower will always be numerically smaller (or equal) to upper.
Definition at line 1443 of file qcustomplot.cpp.
QCPRange QCPRange::sanitizedForLogScale | ( | ) | const |
Returns a sanitized version of the range.
Sanitized means for logarithmic scales, that the range won't span the positive and negative sign domain, i.e. contain zero. Further lower will always be numerically smaller (or equal) to upper.
If the original range does span positive and negative sign domains or contains zero, the returned range will try to approximate the original range as good as possible. If the positive interval of the original range is wider than the negative interval, the returned range will only contain the positive interval, with lower bound set to rangeFac or rangeFac *upper, whichever is closer to zero. Same procedure is used if the negative interval is wider than the positive interval, this time by changing the upper bound.
Definition at line 1394 of file qcustomplot.cpp.
double QCPRange::size | ( | ) | const |
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange.
A valid range means:
Definition at line 1490 of file qcustomplot.cpp.
|
static |
Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange.
A valid range means:
Definition at line 1466 of file qcustomplot.cpp.
Multiplies both boundaries of the range by value.
Definition at line 571 of file qcustomplot.h.
Multiplies both boundaries of the range by value.
Definition at line 581 of file qcustomplot.h.
Adds value to both boundaries of the range.
Definition at line 541 of file qcustomplot.h.
Adds value to both boundaries of the range.
Definition at line 551 of file qcustomplot.h.
Subtracts value from both boundaries of the range.
Definition at line 561 of file qcustomplot.h.
Divides both boundaries of the range by value.
Definition at line 591 of file qcustomplot.h.
double QCPRange::lower |
Definition at line 478 of file qcustomplot.h.
|
static |
Maximum values (negative and positive) the range will accept in range-changing functions.
Larger absolute values would cause errors due to the 11-bit exponent of double precision numbers, corresponding to a maximum magnitude of roughly 1e308. Since the number of planck-volumes in the entire visible universe is only ~1e183, this should be enough.
Definition at line 509 of file qcustomplot.h.
|
static |
Minimum range size (upper - lower) the range changing functions will accept.
Smaller intervals would cause errors due to the 11-bit exponent of double precision numbers, corresponding to a minimum magnitude of roughly 1e-308.
Definition at line 508 of file qcustomplot.h.
double QCPRange::upper |
Definition at line 478 of file qcustomplot.h.