LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
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. | |
IntervalD (IntervalI const &other) noexcept | |
Construct a floating-point interval from an integer interval. | |
IntervalD (IntervalD const &) noexcept=default | |
Standard copy constructor. | |
IntervalD (IntervalD &&) noexcept=default | |
Standard move constructor. | |
~IntervalD () noexcept=default | |
void | swap (IntervalD &other) noexcept |
IntervalD & | operator= (IntervalD const &) noexcept=default |
Standard copy assignment operator. | |
IntervalD & | operator= (IntervalD &&) noexcept=default |
Standard move assignment operator. | |
Static Public Member Functions | |
template<typename Iter > | |
static IntervalD | fromSpannedPoints (Iter first, Iter last) |
Construct an interval that contains all of the given points. | |
static IntervalD | fromSpannedPoints (std::vector< Element > const &elements) |
Construct an interval that contains all of the given points. | |
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. | |
static IntervalD | fromMinSize (Element min, Element size) |
Construct an interval from its lower bound and size. | |
static IntervalD | fromMaxSize (Element max, Element size) |
Construct an interval from its upper bound and size. | |
static IntervalD | fromCenterSize (double center, Element size) |
Construct an interval centered on a particular point. | |
Min/Max Accessors | |
Return the minimum (inclusive) and maximum (exclusive) coordinates of the interval. | |
Element | getMin () const noexcept |
Return the size of the interval. | |
Element | getMax () const noexcept |
Return the size of the interval. | |
Element | getSize () const noexcept |
Return the size of the interval. | |
Element | getCenter () const noexcept |
Return the center coordinate of the interval. | |
bool | isEmpty () const noexcept |
Return true if the interval contains no points. | |
bool | isFinite () const noexcept |
Return true if the interval's size is finite. | |
bool | contains (Element point) const |
Return true if the interval contains the point. | |
bool | contains (IntervalD const &other) const noexcept |
Return true if all points contained by other are also contained by this. | |
bool | overlaps (IntervalD const &other) const noexcept |
Return true if any points in other are also in this. | |
bool | intersects (IntervalD const &other) const noexcept |
Return the size of the interval. | |
bool | isDisjointFrom (IntervalD const &other) const noexcept |
Return true if there are no points in both this and other . | |
IntervalD | dilatedBy (Element buffer) const |
Increase the size of the interval by the given amount in both directions (returning a new object). | |
IntervalD | erodedBy (Element buffer) const |
Decrease the size of the interval by the given amount in both directions (returning a new object). | |
IntervalD | shiftedBy (Element offset) const |
Shift the position of the interval by the given offset (returning a new object). | |
IntervalD | reflectedAbout (Element point) const |
Reflect an interval about a point (returning a new object). | |
IntervalD | expandedTo (Element other) const |
Expand an interval to ensure that contains(other) is true. | |
IntervalD | expandedTo (IntervalD const &other) const noexcept |
Expand an interval to ensure that contains(other) is true. | |
IntervalD | clippedTo (IntervalD const &other) const noexcept |
Shrink an interval to ensure that it is contained by other (returning a new object). | |
bool | operator== (IntervalD const &other) const noexcept |
Compare two intervals for equality. | |
bool | operator!= (IntervalD const &other) const noexcept |
Compare two intervals for equality. | |
std::size_t | hash_value () const noexcept |
Return a hash of this object. | |
std::string | toString () const |
Return the size of the interval. | |
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 |
Construct an empty interval.
Definition at line 222 of file Interval.cc.
|
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.