.Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
QCPlot::QCPRange Class Reference

Represents the range an axis is encompassing. More...

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.
 
double size () const
 Returns the size of the range, i.e. More...
 
double center () const
 Returns the center of the range, i.e. More...
 
void normalize ()
 Makes sure lower is numerically smaller than upper. More...
 
QCPRange sanitizedForLogScale () const
 Returns a sanitized version of the range. More...
 
QCPRange sanitizedForLinScale () const
 Returns a sanitized version of the range. More...
 
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. More...
 
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. More...
 

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. More...
 
static const double maxRange = 1e250
 Maximum values (negative and positive) the range will accept in range-changing functions. More...
 

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

Member Function Documentation

double QCPlot::QCPRange::center ( ) const

Returns the center of the range, i.e.

(upper+lower)*0.5

void QCPlot::QCPRange::normalize ( )

Makes sure lower is numerically smaller than upper.

If this is not the case, the values are swapped.

QCPRange QCPlot::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.

QCPRange QCPlot::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.

double QCPlot::QCPRange::size ( ) const

Returns the size of the range, i.e.

upper-lower

bool QCPlot::QCPRange::validRange ( double  lower,
double  upper 
)
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
bool QCPlot::QCPRange::validRange ( const QCPRange range)
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

Member Data Documentation

const double QCPlot::QCPRange::maxRange = 1e250
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.

See Also
validRange, minRange
const double QCPlot::QCPRange::minRange = 1e-280
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.

See Also
validRange, maxRange

The documentation for this class was generated from the following files: