#include <Interval.h>
Public Member Functions | |
void | getBounds (Numeric *pmin, Numeric *pmax) const |
Interval () | |
Interval (const Numeric max) | |
Interval (const Numeric min, const Numeric max, const bool swapIfOutOfOrder=false) | |
bool | isInside (const Numeric value) const |
bool | isInsideLower (const Numeric value) const |
bool | isInsideUpper (const Numeric value) const |
bool | isInsideWithBounds (const Numeric value) const |
Numeric | length () const |
template<typename Num2 > | |
void | linearMap (const Interval< Num2 > &r, double *a, double *b) const |
const Numeric | max () const |
Numeric | midpoint () const |
const Numeric | min () const |
Interval & | moveMidpointTo0 () |
Interval | overlap (const Interval &r) const |
double | overlapFraction (const Interval &r) const |
Numeric | overlapLength (const Interval &r) const |
void | setBounds (const Numeric minval, const Numeric maxval, const bool swapIfOutOfOrder=false) |
void | setMax (const Numeric value) |
void | setMin (const Numeric value) |
Interval & | operator*= (double r) |
Interval & | operator/= (double r) |
Interval & | operator+= (const Numeric value) |
Interval & | operator-= (const Numeric value) |
Interval & | expand (double r) |
Private Attributes | |
Numeric | max_ |
Numeric | min_ |
Representation of 1-d intervals. The following invariant is maintained: min() will not exceed max().
See BoxND class for rectangles, boxes, and hyperboxes.
Definition at line 25 of file Interval.h.
|
inline |
|
inlineexplicit |
Minimum is set to Numeric(), maximum to the given argument. An exception is thrown if the argument is smaller than Numeric().
Definition at line 34 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
|
inline |
Constructor from both bounds. Set "swapIfOutOfOrder" argument to "true" if the minimum can be larger than the maximum (in this case the bounds will be swapped internally).
Definition at line 44 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and std::swap().
|
inline |
Scaling the bounds by a constant in such a way that the midpoint remains unchanged
Definition at line 230 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and alignCSCRings::r.
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Return both bounds
Definition at line 84 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
|
inline |
Is the point completely inside the interval (and does not coincide with any bound)?
Definition at line 108 of file Interval.h.
References a, b, npstat::Interval< Numeric >::expand(), npstat::Interval< Numeric >::linearMap(), npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, npstat::Interval< Numeric >::moveMidpointTo0(), npstat::Interval< Numeric >::operator*=(), npstat::Interval< Numeric >::operator+=(), npstat::Interval< Numeric >::operator-=(), npstat::Interval< Numeric >::operator/=(), npstat::Interval< Numeric >::overlap(), npstat::Interval< Numeric >::overlapFraction(), npstat::Interval< Numeric >::overlapLength(), and alignCSCRings::r.
|
inline |
Is the point inside the interval or on the lower boundary?
Definition at line 96 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
|
inline |
Is the point inside the interval or on the upper boundary?
Definition at line 99 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
|
inline |
Is the point inside the interval or on one of the boundaries?
Definition at line 102 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
|
inline |
Interval length
Definition at line 90 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
void npstat::Interval< Numeric >::linearMap | ( | const Interval< Num2 > & | r, |
double * | a, | ||
double * | b | ||
) | const |
Derive the coefficients a and b such that the linear mapping y = a*x + b maps the lower limit of this interval into the lower limit of the argument interval and the upper limit of this interval into the upper limit of the argument interval
Definition at line 267 of file Interval.h.
References npstat::Interval< Numeric >::max(), npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min(), and npstat::Interval< Numeric >::min_.
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Return the upper bound
Definition at line 81 of file Interval.h.
References npstat::Interval< Numeric >::max_.
Referenced by npstat::BoxND< Numeric >::BoxND(), npstat::BoxND< Numeric >::copyFrom(), npstat::Interval< Numeric >::linearMap(), npstat::ArrayRange::operator<(), operator==(), and npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrangeLoop().
|
inline |
The middle point of the interval
Definition at line 93 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
|
inline |
Return the lower bound
Definition at line 78 of file Interval.h.
References npstat::Interval< Numeric >::min_.
Referenced by npstat::BoxND< Numeric >::BoxND(), npstat::BoxND< Numeric >::copyFrom(), npstat::Interval< Numeric >::linearMap(), npstat::ArrayRange::operator<(), operator==(), and npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrangeLoop().
|
inline |
Move the interval so that the midpoint ends up at 0
Definition at line 222 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Scaling of both the minimum and the maximum by a constant. Minimum and maximum will be swapped internally in case the constant is negative.
Definition at line 213 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, alignCSCRings::r, and std::swap().
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Shift both interval bounds by a constant
Definition at line 252 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and alignCSCRings::r.
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Definition at line 259 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and alignCSCRings::r.
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Definition at line 241 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, alignCSCRings::r, and std::swap().
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
The following function returns default-constructed empty interval in case this interval and the argument interval do not overlap
Definition at line 179 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and npstat::Interval< Numeric >::setBounds().
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Same as overlapLength(r)/length() but a tad faster
Definition at line 203 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Same as overlap.length() but a tad faster
Definition at line 193 of file Interval.h.
References npstat::Interval< Numeric >::max_, and npstat::Interval< Numeric >::min_.
Referenced by npstat::Interval< Numeric >::isInside().
|
inline |
Set both interval bounds
Definition at line 68 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and std::swap().
Referenced by npstat::Interval< Numeric >::overlap().
|
inline |
Set the upper interval bound
Definition at line 61 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and relativeConstraints::value.
|
inline |
Set the lower interval bound
Definition at line 54 of file Interval.h.
References npstat::Interval< Numeric >::max_, npstat::Interval< Numeric >::min_, and relativeConstraints::value.
Referenced by npstat::BoxND< Numeric >::allSpace().
|
private |
Definition at line 161 of file Interval.h.
Referenced by npstat::Interval< Numeric >::expand(), npstat::Interval< Numeric >::getBounds(), npstat::Interval< Numeric >::Interval(), npstat::Interval< Numeric >::isInside(), npstat::Interval< Numeric >::isInsideLower(), npstat::Interval< Numeric >::isInsideUpper(), npstat::Interval< Numeric >::isInsideWithBounds(), npstat::Interval< Numeric >::length(), npstat::Interval< Numeric >::linearMap(), npstat::Interval< Numeric >::max(), npstat::Interval< Numeric >::midpoint(), npstat::Interval< Numeric >::moveMidpointTo0(), npstat::Interval< Numeric >::operator*=(), npstat::Interval< Numeric >::operator+=(), npstat::Interval< Numeric >::operator-=(), npstat::Interval< Numeric >::operator/=(), npstat::Interval< Numeric >::overlap(), npstat::Interval< Numeric >::overlapFraction(), npstat::Interval< Numeric >::overlapLength(), npstat::Interval< Numeric >::setBounds(), npstat::Interval< Numeric >::setMax(), and npstat::Interval< Numeric >::setMin().
|
private |
Definition at line 160 of file Interval.h.
Referenced by npstat::Interval< Numeric >::expand(), npstat::Interval< Numeric >::getBounds(), npstat::Interval< Numeric >::Interval(), npstat::Interval< Numeric >::isInside(), npstat::Interval< Numeric >::isInsideLower(), npstat::Interval< Numeric >::isInsideUpper(), npstat::Interval< Numeric >::isInsideWithBounds(), npstat::Interval< Numeric >::length(), npstat::Interval< Numeric >::linearMap(), npstat::Interval< Numeric >::midpoint(), npstat::Interval< Numeric >::min(), npstat::Interval< Numeric >::moveMidpointTo0(), npstat::Interval< Numeric >::operator*=(), npstat::Interval< Numeric >::operator+=(), npstat::Interval< Numeric >::operator-=(), npstat::Interval< Numeric >::operator/=(), npstat::Interval< Numeric >::overlap(), npstat::Interval< Numeric >::overlapFraction(), npstat::Interval< Numeric >::overlapLength(), npstat::Interval< Numeric >::setBounds(), npstat::Interval< Numeric >::setMax(), and npstat::Interval< Numeric >::setMin().