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
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::geom::IntervalI Class Referencefinal

A 1-d integer coordinate range. More...

#include <Interval.h>

Public Types

enum class  EdgeHandlingEnum { EXPAND , SHRINK }
 Enum used to indicate how to handle conversions from floating-point to integer intervals. More...
 
using Element = int
 

Public Member Functions

 IntervalI () noexcept
 Construct an empty interval.
 
 IntervalI (IntervalD const &other, EdgeHandlingEnum edgeHandling=EdgeHandlingEnum::EXPAND)
 Construct an integer interval from a floating-point interval.
 
 IntervalI (IntervalI const &) noexcept=default
 Standard copy constructor.
 
 IntervalI (IntervalI &&) noexcept=default
 Standard move constructor.
 
 ~IntervalI () noexcept=default
 
void swap (IntervalI &other) noexcept
 
IntervalIoperator= (IntervalI const &) noexcept=default
 Standard copy assignment operator.
 
IntervalIoperator= (IntervalI &&) noexcept=default
 Standard move assignment operatior.
 
Min/Max Accessors

Return the minimum and maximum coordinates of the interval (inclusive).

Element getMin () const noexcept
 
Element getMax () const noexcept
 
Begin/End Accessors

Return begin (inclusive) and end (exclusive) coordinates for the interval.

Element getBegin () const noexcept
 
Element getEnd () const noexcept
 

Static Public Member Functions

template<typename Iter >
static IntervalI fromSpannedPoints (Iter first, Iter last)
 Construct an interval that contains all of the given points.
 
static IntervalI fromSpannedPoints (std::vector< Element > const &elements)
 Construct an interval that contains all of the given points.
 
static IntervalI fromSpannedPoints (ndarray::Array< Element const, 1 > const &elements)
 
static IntervalI fromMinMax (Element min, Element max)
 Construct an interval from its lower and upper bounds.
 
static IntervalI fromMinSize (Element min, Element size)
 Construct an interval from its lower bound and size.
 
static IntervalI fromMaxSize (Element max, Element size)
 Construct an interval from its upper bound and size.
 
static IntervalI fromCenterSize (double center, Element size)
 Create an interval centered as closely as possible on a particular point.
 

Size Accessors

Return the size of the interval in pixels.

Element getSize () const noexcept
 Return slice to extract the interval's region from an ndarray::Array.
 
ndarray::View< boost::fusion::vector1< ndarray::index::Range > > getSlice () const
 Return slice to extract the interval's region from an ndarray::Array.
 
bool isEmpty () const noexcept
 Return true if the interval contains no points.
 
bool contains (Element point) const noexcept
 Return true if the interval contains the point.
 
bool contains (IntervalI const &other) const noexcept
 Return true if all points contained by other are also contained by this.
 
bool overlaps (IntervalI const &other) const noexcept
 Return true if there are any points in both this and other.
 
bool intersects (IntervalI const &other) const noexcept
 Return slice to extract the interval's region from an ndarray::Array.
 
bool isDisjointFrom (IntervalI const &other) const noexcept
 Return true if there are no points in both this and other.
 
IntervalI dilatedBy (Element buffer) const
 Increase the size of the interval by the given amount in both directions (returning a new object).
 
IntervalI erodedBy (Element buffer) const
 Decrease the size of the interval by the given amount in both directions (returning a new object).
 
IntervalI shiftedBy (Element offset) const
 Shift the position of the interval by the given offset (returning a new object).)
 
IntervalI reflectedAbout (Element point) const
 Reflect an interval about a point (returning a new object).
 
IntervalI expandedTo (Element other) const
 Expand an interval to ensure that contains(other) is true (returning a new object).
 
IntervalI expandedTo (IntervalI const &other) const
 Return slice to extract the interval's region from an ndarray::Array.
 
IntervalI clippedTo (IntervalI const &other) const noexcept
 Shrink an interval to ensure that it is contained by other (returning a new)
 
bool operator== (IntervalI const &other) const noexcept
 Compare two intervals for equality.
 
bool operator!= (IntervalI 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 slice to extract the interval's region from an ndarray::Array.
 

Detailed Description

A 1-d integer coordinate range.

IntervalI is an inclusive range that represents region of pixels. An IntervalI never has negative size; the empty interval is defined to have zero size, and is treated as though it does not have a well-defined position (regardless of the return value of getMin() or getMax() for an empty interval).

All IntervalI methods that return a new instance (and are not marked noexcept) throw OverflowError if the lower bound, upper bound, or the size would be too large to fit in int.

Definition at line 50 of file Interval.h.

Member Typedef Documentation

◆ Element

Definition at line 52 of file Interval.h.

Member Enumeration Documentation

◆ EdgeHandlingEnum

Enum used to indicate how to handle conversions from floating-point to integer intervals.

Note that the floating point bounds for some pixel x in an integer interval are [x - 0.5, x + 0.5] (because the pixel has unit size, and integer coordinates correspond to the centers of pixels). This means interval conversions involve more than just rounding the bounds inward or outward.

Enumerator
EXPAND 

Include all pixels that overlap the floating-point interval at all.

SHRINK 

Include only pixels that are wholly contained by the floating-point interval.

Definition at line 64 of file Interval.h.

64 {
68 EXPAND,
73 SHRINK
74 };
@ 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.

Constructor & Destructor Documentation

◆ IntervalI() [1/4]

lsst::geom::IntervalI::IntervalI ( )
inlinenoexcept

Construct an empty interval.

Definition at line 77 of file Interval.h.

77: _min(0), _size(0) {}

◆ IntervalI() [2/4]

lsst::geom::IntervalI::IntervalI ( IntervalD const & other,
EdgeHandlingEnum edgeHandling = EdgeHandlingEnum::EXPAND )
explicit

Construct an integer interval from a floating-point interval.

Floating-point to integer 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. Converting a floating-point interval to an integer interval thus requires a choice on how to handle pixels which are only partially contained by the input floating-point interval.

Parameters
[in]otherA floating-point interval to convert.
[in]edgeHandlingIf EXPAND, the integer interval will contain any pixels that overlap the floating-point interval. If SHRINK, the integer interval will contain only pixels completely contained by the floating-point interval.
Exceptions
lsst::pex::exceptions::InvalidParameterErrorThrown if other is not finite.
lsst::pex::exceptions::LogicErrorThrown if an invalid enum value is passed.

Definition at line 87 of file Interval.cc.

87 : _min(), _size() {
88 if (other.isEmpty()) {
89 *this = IntervalI();
90 return;
91 }
92 if (!std::isfinite(other.getMin()) || !std::isfinite(other.getMax())) {
93 throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
94 "Cannot convert non-finite IntervalD to IntervalI");
95 }
96 BigElement min, max;
97 switch (edgeHandling) {
99 min = static_cast<BigElement>(std::ceil(other.getMin() - 0.5));
100 max = static_cast<BigElement>(std::floor(other.getMax() + 0.5));
101 break;
103 min = static_cast<BigElement>(std::ceil(other.getMin() + 0.5));
104 max = static_cast<BigElement>(std::floor(other.getMax() - 0.5));
105 break;
106 default:
107 throw pex::exceptions::LogicError("Invalid enum value.");
108 }
109 *this = _fromMinMaxChecked(min, max);
110}
int min
int max
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
T ceil(T... args)
IntervalI() noexcept
Construct an empty interval.
Definition Interval.h:77
T floor(T... args)
T isfinite(T... args)

◆ IntervalI() [3/4]

lsst::geom::IntervalI::IntervalI ( IntervalI const & )
defaultnoexcept

Standard copy constructor.

◆ IntervalI() [4/4]

lsst::geom::IntervalI::IntervalI ( IntervalI && )
defaultnoexcept

Standard move constructor.

◆ ~IntervalI()

lsst::geom::IntervalI::~IntervalI ( )
defaultnoexcept

Member Function Documentation

◆ clippedTo()

IntervalI lsst::geom::IntervalI::clippedTo ( IntervalI const & other) const
noexcept

Shrink an interval to ensure that it is contained by other (returning a new)

In particular, if other and this interval do not overlap, the returned interval will be empty.

Definition at line 186 of file Interval.cc.

186 {
187 if (isEmpty() || other.isEmpty()) {
188 return IntervalI();
189 }
190 return fromMinMax(std::max(getMin(), other.getMin()), std::min(getMax(), other.getMax()));
191}
bool isEmpty() const noexcept
Return true if the interval contains no points.
Definition Interval.h:262
Element getMax() const noexcept
Definition Interval.h:228
static IntervalI fromMinMax(Element min, Element max)
Construct an interval from its lower and upper bounds.
Definition Interval.cc:53
Element getMin() const noexcept
Definition Interval.h:227
T max(T... args)
T min(T... args)

◆ contains() [1/2]

bool lsst::geom::IntervalI::contains ( Element point) const
noexcept

Return true if the interval contains the point.

Definition at line 116 of file Interval.cc.

116 {
117 // The case where this->isEmpty() is handled implicitly by the invariant
118 // that empty intervals have max < min.
119 return point >= this->getMin() && point <= this->getMax();
120}

◆ contains() [2/2]

bool lsst::geom::IntervalI::contains ( IntervalI const & other) const
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 122 of file Interval.cc.

122 {
123 // The case where this->isEmpty() is handled implicitly by the invariant
124 // that empty intervals have max < min.
125 return other.isEmpty() || (other.getMin() >= this->getMin() && other.getMax() <= this->getMax());
126}

◆ dilatedBy()

IntervalI lsst::geom::IntervalI::dilatedBy ( Element buffer) const

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 or equal to zero the new interval will be empty.

Empty intervals remain empty after dilation.

Definition at line 137 of file Interval.cc.

137 {
138 if (isEmpty()) {
139 return IntervalI();
140 }
141 BigElement min = static_cast<BigElement>(getMin()) - buffer;
142 BigElement max = static_cast<BigElement>(getMax()) + buffer;
143 return _fromMinMaxChecked(min, max);
144}

◆ erodedBy()

IntervalI lsst::geom::IntervalI::erodedBy ( Element buffer) const
inline

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 or equal to zero the new interval will be empty.

Empty intervals remain empty after erosion.

Definition at line 315 of file Interval.h.

315{ return dilatedBy(-buffer); }
IntervalI dilatedBy(Element buffer) const
Increase the size of the interval by the given amount in both directions (returning a new object).
Definition Interval.cc:137

◆ expandedTo() [1/2]

IntervalI lsst::geom::IntervalI::expandedTo ( Element other) const

Expand an interval to ensure that contains(other) is true (returning a new object).

Expanding an empty interval with a single point yields an interval with size=1 at that point; expanding an empty interval with a second interval is equivalent to assignment.

Definition at line 166 of file Interval.cc.

166 {
167 if (isEmpty()) {
168 return IntervalI(point, 1);
169 }
170 return _fromMinMaxChecked(std::min(static_cast<BigElement>(point), static_cast<BigElement>(getMin())),
171 std::max(static_cast<BigElement>(point), static_cast<BigElement>(getMax())));
172}

◆ expandedTo() [2/2]

IntervalI lsst::geom::IntervalI::expandedTo ( IntervalI const & other) const

Return slice to extract the interval's region from an ndarray::Array.

For example:

auto array = ndarray::copy(ndarray::arange(5);
auto interval = IntervalI::fromMinMax(2, 4);
auto subarray = array[interval.getSlice()];

Definition at line 174 of file Interval.cc.

174 {
175 if (other.isEmpty()) {
176 return *this;
177 }
178 if (this->isEmpty()) {
179 return other;
180 }
181 return _fromMinMaxChecked(
182 std::min(static_cast<BigElement>(other.getMin()), static_cast<BigElement>(getMin())),
183 std::max(static_cast<BigElement>(other.getMax()), static_cast<BigElement>(getMax())));
184}

◆ fromCenterSize()

IntervalI lsst::geom::IntervalI::fromCenterSize ( double center,
Element size )
static

Create an interval centered as closely as possible on a particular point.

Parameters
centerThe desired center of the interval.
sizeNumber of pixels in interval. Nonpositive values will produce an empty interval.
Returns
if size is positive, an interval with size size; if size is zero or negative, an empty interval. If the returned interval is not empty, its center shall be within half a pixel of center.
Exceptions
lsst::pex::exceptions::OverflowErrorThrown if the resulting interval would overflow.
lsst::pex::exceptions::InvalidParameterErrorThrown if center is not finite and size is positive.

Definition at line 75 of file Interval.cc.

75 {
76 if (size <= 0) {
77 return IntervalI();
78 }
79 double min = center - 0.5 * size;
80 // compensate for IntervalI's coordinate conventions (where max = min + size - 1)
81 min += 0.5;
82 checkForOverflow(min, "minimum");
83 checkForOverflow(min + size - 1, "maximum");
84 return IntervalI(static_cast<BigElement>(min), size);
85}

◆ fromMaxSize()

IntervalI lsst::geom::IntervalI::fromMaxSize ( Element max,
Element size )
static

Construct an interval from its upper bound and size.

Parameters
[in]maxMaximum coordinate (inclusive).
[in]sizeNumber of pixels in interval. Nonpositive values will produce an empty interval.
Exceptions
lsst::pex::exceptions::OverflowErrorThrown if the resulting interval would overflow.

Definition at line 66 of file Interval.cc.

66 {
67 if (size <= 0) {
68 return IntervalI();
69 }
70 BigElement min = static_cast<BigElement>(max) - static_cast<BigElement>(size) + 1;
71 checkForOverflow(min, "minimum");
72 return IntervalI(static_cast<Element>(min), size);
73}

◆ fromMinMax()

IntervalI lsst::geom::IntervalI::fromMinMax ( Element min,
Element max )
static

Construct an interval from its lower and upper bounds.

If min > max, the resulting interval is empty.

Parameters
[in]minMinimum coordinate (inclusive).
[in]maxMaximum coordinate (inclusive).
Exceptions
lsst::pex::exceptions::OverflowErrorThrown if the resulting interval would overflow.

Definition at line 53 of file Interval.cc.

53 {
54 return _fromMinMaxChecked(static_cast<BigElement>(min), static_cast<BigElement>(max));
55}

◆ fromMinSize()

IntervalI lsst::geom::IntervalI::fromMinSize ( Element min,
Element size )
static

Construct an interval from its lower bound and size.

Parameters
[in]minMinimum coordinate (inclusive).
[in]sizeNumber of pixels in interval. Nonpositive values will produce an empty interval.
Exceptions
lsst::pex::exceptions::OverflowErrorThrown if the resulting interval would overflow.

Definition at line 57 of file Interval.cc.

57 {
58 if (size <= 0) {
59 return IntervalI();
60 }
61 BigElement max = static_cast<BigElement>(min) + static_cast<BigElement>(size) - 1;
62 checkForOverflow(max, "maximum");
63 return IntervalI(min, size);
64}

◆ fromSpannedPoints() [1/3]

template<typename Iter >
static IntervalI lsst::geom::IntervalI::fromSpannedPoints ( Iter first,
Iter last )
inlinestatic

Construct an interval that contains all of the given points.

Parameters
[in]firstIterator to the beginning of a sequence of integers.
[in]lastIterator to one-past-the-end of a sequence of integers.

An empty interval is returned if first == last.

Exceptions
lsst::pex::exceptions::OverflowErrorThrown if the resulting interval would overflow.

Definition at line 92 of file Interval.h.

92 {
93 IntervalI result;
94 for (auto i = first; i != last; ++i) {
95 result = result.expandedTo(*i);
96 }
97 return result;
98 }
py::object result
Definition _schema.cc:429

◆ fromSpannedPoints() [2/3]

static IntervalI lsst::geom::IntervalI::fromSpannedPoints ( ndarray::Array< Element const, 1 > const & elements)
inlinestatic

Definition at line 115 of file Interval.h.

115 {
116 return fromSpannedPoints(elements.begin(), elements.end());
117 }
static IntervalI fromSpannedPoints(Iter first, Iter last)
Construct an interval that contains all of the given points.
Definition Interval.h:92

◆ fromSpannedPoints() [3/3]

static IntervalI lsst::geom::IntervalI::fromSpannedPoints ( std::vector< Element > const & elements)
inlinestatic

Construct an interval that contains all of the given points.

Parameters
[in]elementsPoints (integer values) to include in the interval.

An empty interval is returned if the given container has no elements.

Exceptions
lsst::pex::exceptions::OverflowErrorThrown if the resulting interval would overflow.

Definition at line 112 of file Interval.h.

112 {
113 return fromSpannedPoints(elements.begin(), elements.end());
114 }
T begin(T... args)
T end(T... args)

◆ getBegin()

Element lsst::geom::IntervalI::getBegin ( ) const
inlinenoexcept

Definition at line 238 of file Interval.h.

238{ return _min; }

◆ getEnd()

Element lsst::geom::IntervalI::getEnd ( ) const
inlinenoexcept

Definition at line 239 of file Interval.h.

239{ return _min + _size; }

◆ getMax()

Element lsst::geom::IntervalI::getMax ( ) const
inlinenoexcept

Definition at line 228 of file Interval.h.

228{ return _min + _size - 1; }

◆ getMin()

Element lsst::geom::IntervalI::getMin ( ) const
inlinenoexcept

Definition at line 227 of file Interval.h.

227{ return _min; }

◆ getSize()

Element lsst::geom::IntervalI::getSize ( ) const
inlinenoexcept

Return slice to extract the interval's region from an ndarray::Array.

For example:

auto array = ndarray::copy(ndarray::arange(5);
auto interval = IntervalI::fromMinMax(2, 4);
auto subarray = array[interval.getSlice()];

Definition at line 247 of file Interval.h.

247{ return _size; }

◆ getSlice()

ndarray::View< boost::fusion::vector1< ndarray::index::Range > > lsst::geom::IntervalI::getSlice ( ) const

Return slice to extract the interval's region from an ndarray::Array.

For example:

auto array = ndarray::copy(ndarray::arange(5);
auto interval = IntervalI::fromMinMax(2, 4);
auto subarray = array[interval.getSlice()];

Definition at line 112 of file Interval.cc.

112 {
113 return ndarray::view(getBegin(), getEnd());
114}
Element getEnd() const noexcept
Definition Interval.h:239
Element getBegin() const noexcept
Definition Interval.h:238

◆ hash_value()

std::size_t lsst::geom::IntervalI::hash_value ( ) const
noexcept

Return a hash of this object.

Definition at line 199 of file Interval.cc.

199 {
200 // Completely arbitrary seed
201 return cpputils::hashCombine(17, _min, _size);
202}
std::size_t hashCombine(std::size_t seed) noexcept
Combine hashes.
Definition hashCombine.h:35

◆ intersects()

bool lsst::geom::IntervalI::intersects ( IntervalI const & other) const
inlinenoexcept

Return slice to extract the interval's region from an ndarray::Array.

For example:

auto array = ndarray::copy(ndarray::arange(5);
auto interval = IntervalI::fromMinMax(2, 4);
auto subarray = array[interval.getSlice()];

Definition at line 283 of file Interval.h.

283{ return overlaps(other); }
bool overlaps(IntervalI const &other) const noexcept
Return true if there are any points in both this and other.
Definition Interval.cc:128

◆ isDisjointFrom()

bool lsst::geom::IntervalI::isDisjointFrom ( IntervalI const & other) const
noexcept

Return true if there are no points in both this and other.

Definition at line 130 of file Interval.cc.

130 {
131 if (isEmpty() || other.isEmpty()) {
132 return true;
133 }
134 return getMin() > other.getMax() || getMax() < other.getMin();
135}

◆ isEmpty()

bool lsst::geom::IntervalI::isEmpty ( ) const
inlinenoexcept

Return true if the interval contains no points.

Definition at line 262 of file Interval.h.

262{ return _size == 0; }

◆ operator!=()

bool lsst::geom::IntervalI::operator!= ( IntervalI const & other) const
noexcept

Compare two intervals for equality.

All empty intervals are equal.

Definition at line 197 of file Interval.cc.

197{ return !(other == *this); }

◆ operator=() [1/2]

IntervalI & lsst::geom::IntervalI::operator= ( IntervalI && )
defaultnoexcept

Standard move assignment operatior.

◆ operator=() [2/2]

IntervalI & lsst::geom::IntervalI::operator= ( IntervalI const & )
defaultnoexcept

Standard copy assignment operator.

◆ operator==()

bool lsst::geom::IntervalI::operator== ( IntervalI const & other) const
noexcept

Compare two intervals for equality.

All empty intervals are equal.

Definition at line 193 of file Interval.cc.

193 {
194 return other._min == this->_min && other._size == this->_size;
195}

◆ overlaps()

bool lsst::geom::IntervalI::overlaps ( IntervalI const & other) const
noexcept

Return true if there are any points in both this and other.

Any overlap operation involving an empty interval returns false.

Definition at line 128 of file Interval.cc.

128{ return !isDisjointFrom(other); }
bool isDisjointFrom(IntervalI const &other) const noexcept
Return true if there are no points in both this and other.
Definition Interval.cc:130

◆ reflectedAbout()

IntervalI lsst::geom::IntervalI::reflectedAbout ( Element point) const

Reflect an interval about a point (returning a new object).

Empty intervals remain empty when reflected.

Definition at line 157 of file Interval.cc.

157 {
158 if (isEmpty()) {
159 return IntervalI();
160 }
161 BigElement max = 2 * static_cast<BigElement>(point) - getMin();
162 BigElement min = 2 * static_cast<BigElement>(point) - getMax();
163 return _fromMinMaxChecked(min, max);
164}

◆ shiftedBy()

IntervalI lsst::geom::IntervalI::shiftedBy ( Element offset) const

Shift the position of the interval by the given offset (returning a new object).)

Empty intervals remain empty when shifted.

Definition at line 146 of file Interval.cc.

146 {
147 if (isEmpty()) {
148 return IntervalI();
149 }
150 BigElement min = static_cast<BigElement>(getMin()) + offset;
151 BigElement max = static_cast<BigElement>(getMax()) + offset;
152 checkForOverflow(min, "minimum");
153 checkForOverflow(max, "maximum");
154 return IntervalI(static_cast<Element>(min), getSize());
155}
Element getSize() const noexcept
Return slice to extract the interval's region from an ndarray::Array.
Definition Interval.h:247

◆ swap()

void lsst::geom::IntervalI::swap ( IntervalI & other)
inlinenoexcept

Definition at line 209 of file Interval.h.

209 {
210 using std::swap;
211 swap(_size, other._size);
212 swap(_min, other._min);
213 }
void swap(IntervalI &other) noexcept
Definition Interval.h:209
T swap(T... args)

◆ toString()

std::string lsst::geom::IntervalI::toString ( ) const

Return slice to extract the interval's region from an ndarray::Array.

For example:

auto array = ndarray::copy(ndarray::arange(5);
auto interval = IntervalI::fromMinMax(2, 4);
auto subarray = array[interval.getSlice()];

Definition at line 204 of file Interval.cc.

204 {
205 return (boost::format("(min=%s, max=%s)") % getMin() % getMax()).str();
206}

The documentation for this class was generated from the following files: