QCPRange
Public Member Functions | |
QCPRange () | |
QCPRange (double lower, double upper) | |
QCPRange | bounded (double lowerBound, double upperBound) const |
double | center () const |
bool | contains (double value) const |
void | expand (const QCPRange &otherRange) |
void | expand (double includeCoord) |
QCPRange | expanded (const QCPRange &otherRange) const |
QCPRange | expanded (double includeCoord) const |
void | normalize () |
bool | operator!= (const QCPRange &other) const |
QCPRange & | operator*= (const double &value) |
QCPRange & | operator+= (const double &value) |
QCPRange & | operator-= (const double &value) |
QCPRange & | operator/= (const double &value) |
bool | operator== (const QCPRange &other) const |
QCPRange | sanitizedForLinScale () const |
QCPRange | sanitizedForLogScale () const |
double | size () const |
Static Public Member Functions | |
static bool | validRange (const QCPRange &range) |
static bool | validRange (double lower, double upper) |
Public Attributes | |
double | lower |
double | upper |
Static Public Attributes | |
static const double | maxRange = 1e250 |
static const double | minRange = 1e-280 |
Related Symbols | |
(Note that these are not member symbols.) | |
QDebug | operator<< (QDebug d, const QCPRange &range) |
Detailed Description
Represents the range an axis is encompassing.
contains a lower and upper double value and provides convenience input, output and modification functions.
- See also
- QCPAxis::setRange
Definition at line 831 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPRange() [1/2]
QCPRange::QCPRange | ( | ) |
Constructs a range with lower and upper set to zero.
Definition at line 1927 of file qcustomplot.cpp.
◆ QCPRange() [2/2]
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.
The resulting range will be normalized (see normalize), so if lower is not numerically smaller than upper, they will be swapped.
Definition at line 1940 of file qcustomplot.cpp.
Member Function Documentation
◆ bounded()
QCPRange QCPRange::bounded | ( | double | lowerBound, |
double | upperBound ) const |
Returns this range, possibly modified to not exceed the bounds provided as lowerBound and upperBound. If possible, the size of the current range is preserved in the process.
If the range shall only be bounded at the lower side, you can set upperBound to QCPRange::maxRange. If it shall only be bounded at the upper side, set lowerBound to -QCPRange::maxRange.
Definition at line 2030 of file qcustomplot.cpp.
◆ center()
|
inline |
Returns the center of the range, i.e. (upper+lower)*0.5
Definition at line 854 of file qcustomplot.h.
◆ contains()
|
inline |
Returns true when value lies within or exactly on the borders of the range.
Definition at line 863 of file qcustomplot.h.
◆ expand() [1/2]
void QCPRange::expand | ( | const QCPRange & | otherRange | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
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 this range contains NaN as lower or upper bound, it will be replaced by the respective bound of otherRange.
If otherRange is already inside the current range, this function does nothing.
- See also
- expanded
Definition at line 1959 of file qcustomplot.cpp.
◆ expand() [2/2]
void QCPRange::expand | ( | double | includeCoord | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Expands this range such that includeCoord is contained in the new range. It is assumed that this range is normalized (see normalize).
If this range contains NaN as lower or upper bound, the respective bound will be set to includeCoord.
If includeCoord is already inside the current range, this function does nothing.
- See also
- expand
Definition at line 1979 of file qcustomplot.cpp.
◆ expanded() [1/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns an expanded range that contains this and otherRange. It is assumed that both this range and otherRange are normalized (see normalize).
If this range contains NaN as lower or upper bound, the returned range's bound will be taken from otherRange.
- See also
- expand
Definition at line 1998 of file qcustomplot.cpp.
◆ expanded() [2/2]
QCPRange QCPRange::expanded | ( | double | includeCoord | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns an expanded range that includes the specified includeCoord. It is assumed that this range is normalized (see normalize).
If this range contains NaN as lower or upper bound, the returned range's bound will be set to includeCoord.
- See also
- expand
Definition at line 2015 of file qcustomplot.cpp.
◆ normalize()
|
inline |
Makes sure lower is numerically smaller than upper. If this is not the case, the values are swapped.
Definition at line 855 of file qcustomplot.h.
◆ operator!=()
|
inline |
Definition at line 840 of file qcustomplot.h.
◆ operator*=()
|
inline |
Multiplies both boundaries of the range by value.
Definition at line 844 of file qcustomplot.h.
◆ operator+=()
|
inline |
Adds value to both boundaries of the range.
Definition at line 842 of file qcustomplot.h.
◆ operator-=()
|
inline |
Subtracts value from both boundaries of the range.
Definition at line 843 of file qcustomplot.h.
◆ operator/=()
|
inline |
Divides both boundaries of the range by value.
Definition at line 845 of file qcustomplot.h.
◆ operator==()
|
inline |
Definition at line 839 of file qcustomplot.h.
◆ sanitizedForLinScale()
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 2114 of file qcustomplot.cpp.
◆ sanitizedForLogScale()
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 2065 of file qcustomplot.cpp.
◆ size()
|
inline |
Returns the size of the range, i.e. upper-lower
Definition at line 853 of file qcustomplot.h.
◆ validRange() [1/2]
|
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:
- range bounds within -maxRange and maxRange
- range size above minRange
- range size below maxRange
Definition at line 2148 of file qcustomplot.cpp.
◆ validRange() [2/2]
|
static |
Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange. A valid range means:
- range bounds within -maxRange and maxRange
- range size above minRange
- range size below maxRange
Definition at line 2129 of file qcustomplot.cpp.
Friends And Related Symbol Documentation
◆ operator<<()
Prints range in a human readable format to the qDebug output.
Definition at line 877 of file qcustomplot.h.
Member Data Documentation
◆ lower
double QCPRange::lower |
Definition at line 834 of file qcustomplot.h.
◆ maxRange
|
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.
- Warning
- Do not use this constant to indicate "arbitrarily large" values in plotting logic (as values that will appear in the plot)! It is intended only as a bound to compare against, e.g. to prevent axis ranges from obtaining overflowing ranges.
- See also
- validRange, minRange
Definition at line 868 of file qcustomplot.h.
◆ minRange
|
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.
- Warning
- Do not use this constant to indicate "arbitrarily small" values in plotting logic (as values that will appear in the plot)! It is intended only as a bound to compare against, e.g. to prevent axis ranges from obtaining underflowing ranges.
- See also
- validRange, maxRange
Definition at line 867 of file qcustomplot.h.
◆ upper
double QCPRange::upper |
Definition at line 834 of file qcustomplot.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:15:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.