LSSTApplications  18.0.0+71,19.0.0+5,19.0.0+60,19.0.0+71,19.0.0+9,19.0.0-1-g20d9b18+27,19.0.0-1-g49a97f9+3,19.0.0-1-g5549ca4+4,19.0.0-1-g8c57eb9+27,19.0.0-1-g9a028c0+6,19.0.0-1-ga72da6b+3,19.0.0-1-gb77924a+7,19.0.0-1-gbfe0924+58,19.0.0-1-gd0f30f5+7,19.0.0-1-ge272bc4+27,19.0.0-1-gefe1d0d+42,19.0.0-13-g44bf2be,19.0.0-14-g983d7abd,19.0.0-15-g66e0b70,19.0.0-16-g98bbc9049,19.0.0-17-g9c22e3c+2,19.0.0-18-g2c901ce+2,19.0.0-19-g2772d4a+1,19.0.0-19-g85fbfd3+1,19.0.0-2-g0d9f9cd+66,19.0.0-2-g260436e+46,19.0.0-2-g361aba8+7,19.0.0-2-g9675b69+3,19.0.0-2-gde8e5e3+3,19.0.0-2-gff6972b+11,19.0.0-3-ga642a0f,19.0.0-4-g33ce3a3+8,19.0.0-4-gac56cce+9,19.0.0-4-gdb4f201+7,19.0.0-46-g6423acc,19.0.0-46-g8a917ba3+1,19.0.0-6-g28bbdb8,19.0.0-7-g3343160,19.0.0-7-g686a884+4,w.2020.16
LSSTDataManagementBasePackage
Extent.h
Go to the documentation of this file.
1 /*
2  * Developed for the LSST Data Management System.
3  * This product includes software developed by the LSST Project
4  * (https://www.lsst.org).
5  * See the COPYRIGHT file at the top-level directory of this distribution
6  * for details of code ownership.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 /*
23  * A coordinate class intended to represent offsets and dimensions.
24  */
25 #ifndef LSST_GEOM_EXTENT_H
26 #define LSST_GEOM_EXTENT_H
27 
28 #include <tuple>
29 #include <type_traits>
30 
31 #include "lsst/pex/exceptions.h"
33 
34 namespace lsst {
35 namespace geom {
36 
37 // These are present to avoid a static assertion for instantiating computeNorm() on integer types.
38 namespace detail {
39 
40 template <int N>
42  return s.asEigen().norm();
43 }
44 
45 template <int N>
47  throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot compute norm of integer extent");
48 #if 1 // make compilers happy in non-void function
49  return -1;
50 #endif
51 }
52 
53 } // namespace detail
54 
55 template <typename T, int N>
56 class ExtentBase : public CoordinateBase<Extent<T, N>, T, N> {
57  typedef CoordinateBase<Extent<T, N>, T, N> Super;
58 
59 public:
60  ExtentBase(ExtentBase const &) = default;
61  ExtentBase(ExtentBase &&) = default;
62  ExtentBase &operator=(ExtentBase const &) = default;
63  ExtentBase &operator=(ExtentBase &&) = default;
64  ~ExtentBase() = default;
65 
67  T computeSquaredNorm() const { return this->asEigen().squaredNorm(); }
68 
70  T computeNorm() const { return detail::computeExtentNorm(static_cast<Extent<T, N> const &>(*this)); }
71 
77  bool operator==(Extent<T, N> const &other) const noexcept { return all(this->eq(other)); }
78 
84  bool operator!=(Extent<T, N> const &other) const noexcept { return any(this->ne(other)); }
85 
99  CoordinateExpr<N> eq(Extent<T, N> const &other) const noexcept;
100  CoordinateExpr<N> ne(Extent<T, N> const &other) const noexcept;
101  CoordinateExpr<N> lt(Extent<T, N> const &other) const noexcept;
102  CoordinateExpr<N> le(Extent<T, N> const &other) const noexcept;
103  CoordinateExpr<N> gt(Extent<T, N> const &other) const noexcept;
104  CoordinateExpr<N> ge(Extent<T, N> const &other) const noexcept;
105  CoordinateExpr<N> eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
106  return this->eq(Extent<T, N>(scalar));
107  }
108  CoordinateExpr<N> ne(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
109  return this->ne(Extent<T, N>(scalar));
110  }
111  CoordinateExpr<N> lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
112  return this->lt(Extent<T, N>(scalar));
113  }
114  CoordinateExpr<N> le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
115  return this->le(Extent<T, N>(scalar));
116  }
117  CoordinateExpr<N> gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
118  return this->gt(Extent<T, N>(scalar));
119  }
120  CoordinateExpr<N> ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
121  return this->ge(Extent<T, N>(scalar));
122  }
124 
131  Point<T, N> operator+(Point<T, N> const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE);
132  Extent<T, N> operator+(Extent<T, N> const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
133  return Extent<T, N>(this->_vector + other._vector);
134  }
135  Extent<T, N> operator-(Extent<T, N> const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
136  return Extent<T, N>(this->_vector - other._vector);
137  }
138  Extent<T, N> &operator+=(Extent<T, N> const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE) {
139  this->_vector += other._vector;
140  return static_cast<Extent<T, N> &>(*this);
141  }
142  Extent<T, N> &operator-=(Extent<T, N> const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE) {
143  this->_vector -= other._vector;
144  return static_cast<Extent<T, N> &>(*this);
145  }
146  Extent<T, N> operator+() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
147  return static_cast<Extent<T, N> const &>(*this);
148  }
149  Extent<T, N> operator-() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
150  return Extent<T, N>(-this->_vector);
151  }
153 
160  Extent<T, N> operator*(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
161  return Extent<T, N>(this->_vector * scalar);
162  }
163  Extent<T, N> &operator*=(T scalar) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE) {
164  this->_vector *= scalar;
165  return static_cast<Extent<T, N> &>(*this);
166  }
167  Extent<T, N> operator/(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) {
168  return Extent<T, N>(this->_vector / scalar);
169  }
170  Extent<T, N> &operator/=(T scalar) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE) {
171  this->_vector /= scalar;
172  return static_cast<Extent<T, N> &>(*this);
173  }
175 
177  Point<T, N> asPoint() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE);
178 
180  std::stringstream out;
181  out << "Extent(";
182  for (size_t i = 0; i < N; ++i) {
183  if (i != 0) {
184  out << ",";
185  }
186  out << (*this)[i];
187  }
188  out << ")";
189  return out.str();
190  }
191 
192 protected:
194  explicit ExtentBase(T val = static_cast<T>(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
195  : Super(val) {}
196 
198  template <typename Vector>
199  explicit ExtentBase(Eigen::MatrixBase<Vector> const &vector) : Super(vector) {}
200 };
201 
209 template <typename T, int N>
210 class Extent : public ExtentBase<T, N> {
211  typedef ExtentBase<T, N> Super;
212 
213 public:
214  typedef typename Super::EigenVector EigenVector;
215 
217  explicit Extent(T val = static_cast<T>(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) : Super(val) {}
218 
220  explicit Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) : Super(vector) {}
221 
223  explicit Extent(Point<T, N> const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE);
224 
226  template <typename U>
227  explicit Extent(Extent<U, N> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
228  template <typename U>
229  explicit Extent(Point<U, N> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
230 
231  // Should be consistent with converting constructors
232  Extent(Extent const &other) = default;
233  Extent(Extent &&other) = default;
234  ~Extent() = default;
235 
236  Extent &operator=(Extent const &other) = default;
237  Extent &operator=(Extent &&other) = default;
238 
240  T computeSquaredNorm() const { return this->asEigen().squaredNorm(); }
241 
243  T computeNorm() const { return this->asEigen().norm(); }
244 
245  void swap(Extent &other) noexcept { this->_swap(other); }
246 };
247 
253 template <typename T>
254 class Extent<T, 2> : public ExtentBase<T, 2> {
255  typedef ExtentBase<T, 2> Super;
256 
257 public:
258  typedef typename Super::EigenVector EigenVector;
259 
261  explicit Extent(T val = static_cast<T>(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) : Super(val) {}
262 
264  explicit Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) : Super(vector) {}
265 
267  explicit Extent(Point<T, 2> const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE);
268 
270  template <typename U>
271  explicit Extent(Extent<U, 2> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
272  template <typename U>
273  explicit Extent(Point<U, 2> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
274 
276  explicit Extent(T x, T y) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) : Super(EigenVector(x, y)) {}
277 
279  explicit Extent(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
280  : Super(EigenVector(xy[0], xy[1])) {}
281 
283  explicit Extent(std::pair<T, T> const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
284  : Super(EigenVector(xy.first, xy.second)) {}
285 
287  explicit Extent(std::tuple<T, T> const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
288  : Super(EigenVector(std::get<0>(xy), std::get<1>(xy))) {}
289 
290  // Should be consistent with converting constructors
291  Extent(Extent const &other) = default;
292  Extent(Extent &&other) = default;
293  ~Extent() = default;
294 
295  Extent &operator=(Extent const &other) = default;
296  Extent &operator=(Extent &&other) = default;
297 
298  void swap(Extent &other) noexcept { this->_swap(other); }
299 };
300 
306 template <typename T>
307 class Extent<T, 3> : public ExtentBase<T, 3> {
308  typedef ExtentBase<T, 3> Super;
309 
310 public:
311  typedef typename Super::EigenVector EigenVector;
312 
314  explicit Extent(T val = static_cast<T>(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) : Super(val) {}
315 
317  explicit Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE) : Super(vector) {}
318 
320  explicit Extent(Point<T, 3> const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE);
321 
323  template <typename U>
324  explicit Extent(Extent<U, 3> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
325  template <typename U>
326  explicit Extent(Point<U, 3> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
327 
329  explicit Extent(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
330  : Super(EigenVector(x, y, z)) {}
331 
333  explicit Extent(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
334  : Super(EigenVector(xyz[0], xyz[1], xyz[2])) {}
335 
337  explicit Extent(std::tuple<T, T, T> const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
338  : Super(EigenVector(std::get<0>(xyz), std::get<1>(xyz), std::get<2>(xyz))) {}
339 
340  // Should be consistent with converting constructors
341  Extent(Extent const &other) = default;
342  Extent(Extent &&other) = default;
343  ~Extent() = default;
344 
345  Extent &operator=(Extent const &other) = default;
346  Extent &operator=(Extent &&other) = default;
347 
348  void swap(Extent &other) noexcept { this->_swap(other); }
349 };
350 
351 // Constructor for any 2D type from 2I type
352 template <typename T>
353 template <typename U>
354 Extent<T, 2>::Extent(Extent<U, 2> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>) {
356  "can only construct from Extent of different but integral type");
357  this->setX(static_cast<T>(other.getX()));
358  this->setY(static_cast<T>(other.getY()));
359 };
360 
361 template <typename T>
362 template <typename U>
363 Extent<T, 2>::Extent(Point<U, 2> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>) {
365  "can only construct from Extent of different but integral type");
366  this->setX(static_cast<T>(other.getX()));
367  this->setY(static_cast<T>(other.getY()));
368 };
369 
370 // Constructor for any 3D type from 3I type
371 template <typename T>
372 template <typename U>
373 Extent<T, 3>::Extent(Extent<U, 3> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>) {
375  "can only construct from Extent of different but integral type");
376  this->setX(static_cast<T>(other.getX()));
377  this->setY(static_cast<T>(other.getY()));
378  this->setZ(static_cast<T>(other.getZ()));
379 };
380 
381 // Constructor for any 3D type from 3I type
382 template <typename T>
383 template <typename U>
384 Extent<T, 3>::Extent(Point<U, 3> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>) {
386  "can only construct from Extent of different but integral type");
387  this->setX(static_cast<T>(other.getX()));
388  this->setY(static_cast<T>(other.getY()));
389  this->setZ(static_cast<T>(other.getZ()));
390 };
391 
392 // Hash functions
393 template <typename T, int N>
394 std::size_t hash_value(Extent<T, N> const &extent) noexcept;
395 
402 
408 template <int N>
409 Extent<int, N> truncate(Extent<double, N> const &input) noexcept;
410 
416 template <int N>
417 Extent<int, N> floor(Extent<double, N> const &input) noexcept;
418 
424 template <int N>
425 Extent<int, N> ceil(Extent<double, N> const &input) noexcept;
426 
427 // Some operators below need to take ExtentBase arguments rather than Extent to
428 // avoid ambiguous overloads (since some competing operators are defined as member
429 // functions on ExtentBase).
430 
431 template <typename T, int N>
434  return rhs * scalar;
435 }
436 
437 template <int N>
438 Extent<double, N> operator*(ExtentBase<int, N> const &lhs, double rhs) noexcept {
439  return Extent<double, N>(static_cast<Extent<int, N> const &>(lhs)) * rhs;
440 }
441 
442 template <int N>
443 void operator*=(ExtentBase<int, N> &lhs, double rhs) noexcept {
444  // use "N < 0" so assertion is dependent on template instantiation, instead of triggering all the time
445  static_assert(N < 0, "In-place multiplication of Extent<int,N> by double would truncate.");
446 }
447 
448 template <int N>
449 Extent<double, N> operator/(ExtentBase<int, N> const &lhs, double rhs) noexcept {
450  return Extent<double, N>(static_cast<Extent<int, N> const &>(lhs)) / rhs;
451 }
452 
453 template <int N>
454 void operator/=(ExtentBase<int, N> &lhs, double rhs) noexcept {
455  // use "N < 0" so assertion is dependent on template instantiation, instead of triggering all the time
456  static_assert(N < 0, "In-place division of Extent<int,N> by double would truncate.");
457 }
458 
459 template <int N>
460 Extent<double, N> operator*(double lhs, ExtentBase<int, N> const &rhs) noexcept {
461  return lhs * Extent<double, N>(static_cast<Extent<int, N> const &>(rhs));
462 }
463 
464 template <int N>
466  return lhs + Extent<double, N>(rhs);
467 }
468 
469 template <int N>
471  return lhs += Extent<double, N>(rhs);
472 }
473 
474 template <int N>
476  return lhs - Extent<double, N>(rhs);
477 }
478 
479 template <int N>
481  return lhs -= Extent<double, N>(rhs);
482 }
483 
484 template <int N>
486  return Extent<double, N>(lhs) + rhs;
487 }
488 
489 template <int N>
491  return Extent<double, N>(lhs) - rhs;
492 }
493 
494 } // namespace geom
495 } // namespace lsst
496 
497 namespace std {
498 template <typename T, int N>
499 struct hash<lsst::geom::Extent<T, N>> {
502  result_type operator()(argument_type const &x) const noexcept { return lsst::geom::hash_value(x); }
503 };
504 } // namespace std
505 
506 #endif
void swap(Extent &other) noexcept
Definition: Extent.h:298
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
Definition: Extent.h:240
Extent(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a three-element array.
Definition: Extent.h:333
A CRTP base class for coordinate objects.
Extent< double, 3 > Extent3D
Definition: Extent.h:401
Extent< int, N > ceil(Extent< double, N > const &input) noexcept
Return the component-wise ceil (round towards more positive).
Definition: Extent.cc:118
Extent(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from three scalars.
Definition: Extent.h:329
ExtentBase(Eigen::MatrixBase< Vector > const &vector)
Construct an Extent from an Eigen vector.
Definition: Extent.h:199
A coordinate class intended to represent absolute positions (2-d specialization). ...
Definition: Point.h:211
void operator/=(ExtentBase< int, N > &lhs, double rhs) noexcept
Definition: Extent.h:454
CoordinateExpr< N > ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:120
A coordinate class intended to represent absolute positions (3-d specialization). ...
Definition: Point.h:268
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
Definition: Extent.h:67
Extent(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent with all elements set to the same scalar value.
Definition: Extent.h:314
A coordinate class intended to represent absolute positions.
Extent< T, N > & operator*=(T scalar) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:163
void operator*=(ExtentBase< int, N > &lhs, double rhs) noexcept
Definition: Extent.h:443
int y
Definition: SpanSet.cc:49
STL namespace.
constexpr Angle operator+(Angle a, Angle d) noexcept
Sum of two angles.
Definition: Angle.h:308
ImageT val
Definition: CR.cc:146
Extent< double, N > & operator+=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Definition: Extent.h:470
CoordinateExpr< N > eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:105
ItemVariant const * other
Definition: Schema.cc:56
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:317
double z
Definition: Match.cc:44
std::size_t hash_value(Extent< T, N > const &extent) noexcept
Definition: Extent.cc:127
std::string toString() const
Definition: Extent.h:179
Extent< T, N > & operator/=(T scalar) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:170
CoordinateExpr< N > le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:114
Extent< T, N > operator-() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:149
Extent(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent with all elements set to the same scalar value.
Definition: Extent.h:217
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.
bool operator!=(Extent< T, N > const &other) const noexcept
Standard inequality comparison.
Definition: Extent.h:84
Extent< double, N > & operator-=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Definition: Extent.h:480
STL class.
Extent(std::pair< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a std::pair.
Definition: Extent.h:283
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
Definition: Extent.h:243
Extent(T x, T y) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from two scalars.
Definition: Extent.h:276
Extent< T, N > operator+() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:146
constexpr Angle operator-(Angle a, Angle d) noexcept
Difference of two angles.
Definition: Angle.h:314
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
CoordinateExpr< N > lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:111
Eigen::Matrix< int, N, 1, Eigen::DontAlign > EigenVector
A base class for image defects.
Extent< T, N > operator/(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:167
Extent< int, N > truncate(Extent< double, N > const &input) noexcept
Return the component-wise truncation (round towards zero).
Definition: Extent.cc:100
CoordinateExpr< N > ne(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:108
Extent(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent with all elements set to the same scalar value.
Definition: Extent.h:261
A boolean coordinate.
Extent< T, N > & operator+=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:138
Super::EigenVector EigenVector
Definition: Extent.h:258
ExtentBase(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent<T,N> with all elements set to the same scalar value.
Definition: Extent.h:194
constexpr Angle operator*(Angle a, Angle d) noexcept
Product of two angles.
Definition: Angle.h:322
Super::EigenVector EigenVector
Definition: Extent.h:311
double computeExtentNorm(Extent< double, N > const &s)
Definition: Extent.h:41
T str(T... args)
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
A coordinate class intended to represent offsets and dimensions.
double x
Eigen::Vector3d asEigen(sphgeom::Vector3d const &vector) noexcept
Definition: sphgeomUtils.h:36
void swap(Extent &other) noexcept
Definition: Extent.h:245
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
Definition: Extent.h:70
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
constexpr Angle operator/(Angle a, int d) noexcept
Ratio of an angle and a scalar.
Definition: Angle.h:349
Extent< int, 2 > Extent2I
Definition: Extent.h:397
Extent< T, N > operator+(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:132
bool operator==(Extent< T, N > const &other) const noexcept
Standard equality comparison.
Definition: Extent.h:77
Extent< double, 2 > ExtentD
Definition: Extent.h:399
Extent< int, 2 > ExtentI
Definition: Extent.h:396
Super::EigenVector EigenVector
Definition: Extent.h:214
void swap(Extent &other) noexcept
Definition: Extent.h:348
Extent< T, N > & operator-=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:142
Extent(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
Definition: Extent.h:279
EigenVector const & asEigen() const noexcept(IS_ELEMENT_NOTHROW_COPYABLE)
Return a fixed-size Eigen representation of the coordinate object.
Extent< int, N > floor(Extent< double, N > const &input) noexcept
Return the component-wise floor (round towards more negative).
Definition: Extent.cc:109
Extent< double, 2 > Extent2D
Definition: Extent.h:400
Extent< T, N > operator*(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:160
Extent< T, N > operator-(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:135
Extent< int, 3 > Extent3I
Definition: Extent.h:398
Extent(std::tuple< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Definition: Extent.h:287
Extent(std::tuple< T, T, T > const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Definition: Extent.h:337
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:220
result_type operator()(argument_type const &x) const noexcept
Definition: Extent.h:502
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:264
CoordinateExpr< N > gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:117