LSST Applications
21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
|
A floating-point coordinate rectangle geometry. More...
#include <Interval.h>
Public Types | |
using | Element = double |
Public Member Functions | |
IntervalD () noexcept | |
Construct an empty interval. More... | |
IntervalD (IntervalI const &other) noexcept | |
Construct a floating-point interval from an integer interval. More... | |
IntervalD (IntervalD const &) noexcept=default | |
Standard copy constructor. More... | |
IntervalD (IntervalD &&) noexcept=default | |
Standard move constructor. More... | |
~IntervalD () noexcept=default | |
void | swap (IntervalD &other) noexcept |
IntervalD & | operator= (IntervalD const &) noexcept=default |
Standard copy assignment operator. More... | |
IntervalD & | operator= (IntervalD &&) noexcept=default |
Standard move assignment operator. More... | |
Static Public Member Functions | |
template<typename Iter > | |
static IntervalD | fromSpannedPoints (Iter first, Iter last) |
Construct an interval that contains all of the given points. More... | |
static IntervalD | fromSpannedPoints (std::vector< Element > const &elements) |
Construct an interval that contains all of the given points. More... | |
static IntervalD | fromSpannedPoints (ndarray::Array< Element const, 1 > const &elements) |
static IntervalD | fromMinMax (Element min, Element max) |
Construct an interval from its lower and upper bounds. More... | |
static IntervalD | fromMinSize (Element min, Element size) |
Construct an interval from its lower bound and size. More... | |
static IntervalD | fromMaxSize (Element max, Element size) |
Construct an interval from its upper bound and size. More... | |
static IntervalD | fromCenterSize (double center, Element size) |
Construct an interval centered on a particular point. More... | |
Min/Max Accessors | |
Return the minimum (inclusive) and maximum (exclusive) coordinates of the interval. | |
Element | getMin () const noexcept |
Return the size of the interval. More... | |
Element | getMax () const noexcept |
Return the size of the interval. More... | |
Element | getSize () const noexcept |
Return the size of the interval. More... | |
Element | getCenter () const noexcept |
Return the center coordinate of the interval. More... | |
bool | isEmpty () const noexcept |
Return true if the interval contains no points. More... | |
bool | isFinite () const noexcept |
Return true if the interval's size is finite. More... | |
bool | contains (Element point) const |
Return true if the interval contains the point. More... | |
bool | contains (IntervalD const &other) const noexcept |
Return true if all points contained by other are also contained by this. More... | |
bool | overlaps (IntervalD const &other) const noexcept |
Return true if any points in other are also in this. More... | |
bool | intersects (IntervalD const &other) const noexcept |
Return the size of the interval. More... | |
bool | isDisjointFrom (IntervalD const &other) const noexcept |
Return true if there are no points in both this and other . More... | |
IntervalD | dilatedBy (Element buffer) const |
Increase the size of the interval by the given amount in both directions (returning a new object). More... | |
IntervalD | erodedBy (Element buffer) const |
Decrease the size of the interval by the given amount in both directions (returning a new object). More... | |
IntervalD | shiftedBy (Element offset) const |
Shift the position of the interval by the given offset (returning a new object). More... | |
IntervalD | reflectedAbout (Element point) const |
Reflect an interval about a point (returning a new object). More... | |
IntervalD | expandedTo (Element other) const |
Expand an interval to ensure that contains(other) is true. More... | |
IntervalD | expandedTo (IntervalD const &other) const noexcept |
Expand an interval to ensure that contains(other) is true. More... | |
IntervalD | clippedTo (IntervalD const &other) const noexcept |
Shrink an interval to ensure that it is contained by other (returning a new object). More... | |
bool | operator== (IntervalD const &other) const noexcept |
Compare two intervals for equality. More... | |
bool | operator!= (IntervalD const &other) const noexcept |
Compare two intervals for equality. More... | |
std::size_t | hash_value () const noexcept |
Return a hash of this object. More... | |
std::string | toString () const |
Return the size of the interval. More... | |
A floating-point coordinate rectangle geometry.
IntervalD is closed (its bounds are considered included in the interval). An interval never has negative size; the empty interval is defined to zero-size size and its minimum and maximum values are set to NaN. Non-empty intervals representing infinitesimal points may also have zero size, but are not considered empty.
The existence of zero-size, non-empty intervals is an important, intentional difference between IntervalI and IntervalD, related to the fact that IntervalI models a discrete set while IntervalD (imperfectly, due to floating-point limitations) models a continuous set.
Definition at line 413 of file Interval.h.
using lsst::geom::IntervalD::Element = double |
Definition at line 415 of file Interval.h.
|
noexcept |
|
explicitnoexcept |
Construct a floating-point interval from an integer interval.
Integer to floating-point interval conversion is based on the concept that a pixel is not an infinitesimal point but rather a square of unit size centered on integer-valued coordinates. While the output floating-point interval thus has the same size as the input integer interval, its minimum/maximum coordinates are 0.5 smaller/greater.
Definition at line 254 of file Interval.cc.
|
defaultnoexcept |
Standard copy constructor.
|
defaultnoexcept |
Standard move constructor.
|
defaultnoexcept |
Shrink an interval to ensure that it is contained by other (returning a new object).
In particular, if other
and this interval do not overlap the new interval will be empty.
Definition at line 335 of file Interval.cc.
bool lsst::geom::IntervalD::contains | ( | Element | point | ) | const |
Return true if the interval contains the point.
lsst::pex::exceptions::InvalidParameterError | Thrown if point is NaN. |
Definition at line 263 of file Interval.cc.
|
noexcept |
Return true if all points contained by other are also contained by this.
An empty interval is contained by every other interval, including other empty intervals.
Definition at line 271 of file Interval.cc.
Increase the size of the interval by the given amount in both directions (returning a new object).
If buffer
is negative, this is equivalent to eroding by -buffer
.
If the final size of the interval is less than zero, the new interval will be empty.
Empty intervals remain empty after dilation. Infinite bounds are unaffected by dilation.
lsst::pex::exceptions::InvalidParameterError | Thrown if buffer is not finite. |
Definition at line 284 of file Interval.cc.
Decrease the size of the interval by the given amount in both directions (returning a new object).
If buffer
is negative, this is equivalent to dilating by -buffer
.
If the final size of the interval is less than zero, the new interval will be empty.
Empty intervals remain empty after erosion. Infinite bounds are unaffected by erosion.
lsst::pex::exceptions::InvalidParameterError | Thrown if buffer is not finite. |
Definition at line 648 of file Interval.h.
Expand an interval to ensure that contains(other)
is true.
Expanding an empty interval with a single point yields an interval with size == 0
at that point.
lsst::pex::exceptions::InvalidParameterError | Thrown if other is not finite. |
Definition at line 314 of file Interval.cc.
Expand an interval to ensure that contains(other)
is true.
Expanding an empty interval with a second interval is equivalent to assignment.
Expanding by an empty interval yields the original interval.
Definition at line 325 of file Interval.cc.
Construct an interval centered on a particular point.
center | The desired center of the interval. May not be infinite. |
size | Number of pixels in interval. May not be infinite. |
If size < 0
or any parameter is NaN, an empty interval is returned.
lsst::pex::exceptions::InvalidParameterError | Thrown if any parameter is infinite. This includes the case where one parameter is NaN and the other is infinite. |
Definition at line 246 of file Interval.cc.
Construct an interval from its upper bound and size.
[in] | max | Maximum coordinate (inclusive). |
[in] | size | Size of interval. |
If size < 0
or any parameter is NaN, an empty interval is returned.
lsst::pex::exceptions::InvalidParameterError | Thrown if min is infinite or if size is +infinity (-infinity yields an empty interval). |
Definition at line 237 of file Interval.cc.
Construct an interval from its lower and upper bounds.
[in] | min | Minimum coordinate (inclusive). |
[in] | max | Maximum coordinate (inclusive). |
Bounds may be non-finite, with some restrictions.
min
is -inf
and/or max
is +inf
, the interval has infinite size and is considered valid.max < min
(regardless of whether one or both is infinite) or either is NaN
, the interval is empty.min == max == +inf
or min == max == -inf
is an error.lsst::pex::exceptions::InvalidParameterError | Thrown if min == max == inf or min == max == -inf . |
Definition at line 226 of file Interval.cc.
Construct an interval from its lower bound and size.
[in] | min | Minimum coordinate (inclusive). |
[in] | size | Size of interval. |
If size < 0
or any parameter is NaN, an empty interval is returned.
lsst::pex::exceptions::InvalidParameterError | Thrown if min is infinite or if size is +infinity (-infinity yields an empty interval). |
Definition at line 228 of file Interval.cc.
|
inlinestatic |
Construct an interval that contains all of the given points.
[in] | first | Iterator to the beginning of a sequence of floating-point values. |
[in] | last | Iterator to one-past-the-end of a sequence of floating-point values. |
An empty interval is returned if first == last
.
lsst::pex::exceptions::InvalidParameterError | Thrown if any input point is non-finite. |
Definition at line 434 of file Interval.h.
|
inlinestatic |
Definition at line 457 of file Interval.h.
|
inlinestatic |
Construct an interval that contains all of the given points.
[in] | elements | Points (floating-point values) to include in the interval. |
An empty interval is returned if the given container has no elements.
lsst::pex::exceptions::InvalidParameterError | Thrown if any input point is non-finite. |
Definition at line 454 of file Interval.h.
|
noexcept |
Return the center coordinate of the interval.
Returns NaN for empty intervals and infinite intervals.
Definition at line 261 of file Interval.cc.
|
inlinenoexcept |
Return the size of the interval.
Empty intervals have zero size, but not all zero-size intervals are empty. Intervals with an infinite bound have infinite size.
Definition at line 560 of file Interval.h.
|
inlinenoexcept |
Return the size of the interval.
Empty intervals have zero size, but not all zero-size intervals are empty. Intervals with an infinite bound have infinite size.
Definition at line 559 of file Interval.h.
|
noexcept |
Return the size of the interval.
Empty intervals have zero size, but not all zero-size intervals are empty. Intervals with an infinite bound have infinite size.
Definition at line 259 of file Interval.cc.
|
noexcept |
Return a hash of this object.
Definition at line 349 of file Interval.cc.
|
inlinenoexcept |
Return the size of the interval.
Empty intervals have zero size, but not all zero-size intervals are empty. Intervals with an infinite bound have infinite size.
Definition at line 608 of file Interval.h.
|
noexcept |
Return true if there are no points in both this
and other
.
Definition at line 277 of file Interval.cc.
|
inlinenoexcept |
|
inlinenoexcept |
Return true if the interval's size is finite.
Definition at line 582 of file Interval.h.
|
noexcept |
Compare two intervals for equality.
All empty intervals are equal.
Definition at line 347 of file Interval.cc.
Standard move assignment operator.
Standard copy assignment operator.
|
noexcept |
Compare two intervals for equality.
All empty intervals are equal.
Definition at line 343 of file Interval.cc.
|
noexcept |
Return true if any points in other are also in this.
Any overlap operation involving an empty interval returns false.
Definition at line 275 of file Interval.cc.
Reflect an interval about a point (returning a new object).
Empty intervals remain empty when reflected. If an interval with an infinite bound is reflected, the opposite bound will become infinite with the opposite sign.
lsst::pex::exceptions::InvalidParameterError | Thrown if point is not finite. |
Definition at line 303 of file Interval.cc.
Shift the position of the interval by the given offset (returning a new object).
Empty intervals remain empty when shifted. Infinite bounds are unaffected by shifting.
lsst::pex::exceptions::InvalidParameterError | Thrown if offset is not finite. |
Definition at line 292 of file Interval.cc.
|
inlinenoexcept |
Definition at line 541 of file Interval.h.
std::string lsst::geom::IntervalD::toString | ( | ) | const |
Return the size of the interval.
Empty intervals have zero size, but not all zero-size intervals are empty. Intervals with an infinite bound have infinite size.
Definition at line 354 of file Interval.cc.