LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
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.