22#ifndef LSST_GEOM_INTERVAL_H
23#define LSST_GEOM_INTERVAL_H
91 template <
typename Iter>
94 for (
auto i = first; i != last; ++i) {
211 swap(_size, other._size);
212 swap(_min, other._min);
259 ndarray::View<boost::fusion::vector1<ndarray::index::Range> >
getSlice()
const;
262 bool isEmpty() const noexcept {
return _size == 0; }
374 template <typename T>
433 template <typename Iter>
436 for (
auto i = first; i != last; ++i) {
576 Element getCenter() const noexcept;
A floating-point coordinate rectangle geometry.
bool isFinite() const noexcept
Return true if the interval's size is finite.
IntervalD(IntervalD &&) noexcept=default
Standard move constructor.
IntervalD erodedBy(Element buffer) const
Decrease the size of the interval by the given amount in both directions (returning a new object).
Element getMax() const noexcept
Return the size of the interval.
bool intersects(IntervalD const &other) const noexcept
Return the size of the interval.
IntervalD(IntervalD const &) noexcept=default
Standard copy constructor.
IntervalD & operator=(IntervalD const &) noexcept=default
Standard copy assignment operator.
static IntervalD fromSpannedPoints(std::vector< Element > const &elements)
Construct an interval that contains all of the given points.
IntervalD & operator=(IntervalD &&) noexcept=default
Standard move assignment operator.
IntervalD expandedTo(Element other) const
Expand an interval to ensure that contains(other) is true.
static IntervalD fromSpannedPoints(ndarray::Array< Element const, 1 > const &elements)
A 1-d integer coordinate range.
bool contains(Element point) const noexcept
Return true if the interval contains the point.
static IntervalI fromMinSize(Element min, Element size)
Construct an interval from its lower bound and size.
IntervalI & operator=(IntervalI const &) noexcept=default
Standard copy assignment operator.
static IntervalI fromSpannedPoints(ndarray::Array< Element const, 1 > const &elements)
bool overlaps(IntervalI const &other) const noexcept
Return true if there are any points in both this and other.
static IntervalI fromSpannedPoints(std::vector< Element > const &elements)
Construct an interval that contains all of the given points.
ndarray::View< boost::fusion::vector1< ndarray::index::Range > > getSlice() const
Return slice to extract the interval's region from an ndarray::Array.
void swap(IntervalI &other) noexcept
static IntervalI fromSpannedPoints(Iter first, Iter last)
Construct an interval that contains all of the given points.
IntervalI() noexcept
Construct an empty interval.
IntervalI clippedTo(IntervalI const &other) const noexcept
Shrink an interval to ensure that it is contained by other (returning a new)
IntervalI erodedBy(Element buffer) const
Decrease the size of the interval by the given amount in both directions (returning a new object).
IntervalI dilatedBy(Element buffer) const
Increase the size of the interval by the given amount in both directions (returning a new object).
bool isEmpty() const noexcept
Return true if the interval contains no points.
IntervalI & operator=(IntervalI &&) noexcept=default
Standard move assignment operatior.
bool intersects(IntervalI const &other) const noexcept
Return slice to extract the interval's region from an ndarray::Array.
IntervalI(IntervalI &&) noexcept=default
Standard move constructor.
bool isDisjointFrom(IntervalI const &other) const noexcept
Return true if there are no points in both this and other.
Element getMax() const noexcept
IntervalI(IntervalI const &) noexcept=default
Standard copy constructor.
bool operator!=(IntervalI const &other) const noexcept
Compare two intervals for equality.
EdgeHandlingEnum
Enum used to indicate how to handle conversions from floating-point to integer intervals.
@ SHRINK
Include only pixels that are wholly contained by the floating-point interval.
@ EXPAND
Include all pixels that overlap the floating-point interval at all.
bool operator==(IntervalI const &other) const noexcept
Compare two intervals for equality.
Element getSize() const noexcept
Return slice to extract the interval's region from an ndarray::Array.
std::size_t hash_value() const noexcept
Return a hash of this object.
static IntervalI fromMaxSize(Element max, Element size)
Construct an interval from its upper bound and size.
Element getEnd() const noexcept
std::string toString() const
Return slice to extract the interval's region from an ndarray::Array.
static IntervalI fromCenterSize(double center, Element size)
Create an interval centered as closely as possible on a particular point.
static IntervalI fromMinMax(Element min, Element max)
Construct an interval from its lower and upper bounds.
IntervalI shiftedBy(Element offset) const
Shift the position of the interval by the given offset (returning a new object).)
Element getBegin() const noexcept
IntervalI expandedTo(Element other) const
Expand an interval to ensure that contains(other) is true (returning a new object).
Element getMin() const noexcept
IntervalI reflectedAbout(Element point) const
Reflect an interval about a point (returning a new object).
size_t operator()(argument_type const &x) const noexcept
size_t operator()(argument_type const &x) const noexcept