LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
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;
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;
106  return this->eq(Extent<T, N>(scalar));
107  }
109  return this->ne(Extent<T, N>(scalar));
110  }
112  return this->lt(Extent<T, N>(scalar));
113  }
115  return this->le(Extent<T, N>(scalar));
116  }
118  return this->gt(Extent<T, N>(scalar));
119  }
121  return this->ge(Extent<T, N>(scalar));
122  }
124 
133  return Extent<T, N>(this->_vector + other._vector);
134  }
136  return Extent<T, N>(this->_vector - other._vector);
137  }
139  this->_vector += other._vector;
140  return static_cast<Extent<T, N> &>(*this);
141  }
143  this->_vector -= other._vector;
144  return static_cast<Extent<T, N> &>(*this);
145  }
147  return static_cast<Extent<T, N> const &>(*this);
148  }
150  return Extent<T, N>(-this->_vector);
151  }
153 
161  return Extent<T, N>(this->_vector * scalar);
162  }
164  this->_vector *= scalar;
165  return static_cast<Extent<T, N> &>(*this);
166  }
168  return Extent<T, N>(this->_vector / scalar);
169  }
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 
179  std::string toString() const {
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 
277 
279  explicit Extent(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
280  : Super(EigenVector(xy[0], xy[1])) {}
281 
284  : Super(EigenVector(xy.first, xy.second)) {}
285 
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 
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 
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
double x
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
double z
Definition: Match.cc:44
int y
Definition: SpanSet.cc:48
A CRTP base class for coordinate objects.
void _swap(CoordinateBase &other) noexcept
Eigen::Matrix< T, N, 1, Eigen::DontAlign > EigenVector
EigenVector const & asEigen() const noexcept(IS_ELEMENT_NOTHROW_COPYABLE)
Return a fixed-size Eigen representation of the coordinate object.
A boolean coordinate.
void swap(Extent &other) noexcept
Definition: Extent.h:298
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
Extent & operator=(Extent &&other)=default
Super::EigenVector EigenVector
Definition: Extent.h:258
Extent(Extent const &other)=default
Extent(std::tuple< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Definition: Extent.h:287
Extent & operator=(Extent const &other)=default
Extent(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
Definition: Extent.h:279
Extent(Extent &&other)=default
Extent(std::pair< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a std::pair.
Definition: Extent.h:283
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:264
Extent(Point< T, 2 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Point.
Extent(T x, T y) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from two scalars.
Definition: Extent.h:276
Extent(Extent const &other)=default
Extent(Extent &&other)=default
Extent(Point< T, 3 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Point.
Super::EigenVector EigenVector
Definition: Extent.h:311
Extent(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a three-element array.
Definition: Extent.h:333
Extent & operator=(Extent const &other)=default
Extent(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from three scalars.
Definition: Extent.h:329
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:317
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
void swap(Extent &other) noexcept
Definition: Extent.h:348
Extent(std::tuple< T, T, T > const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Definition: Extent.h:337
Extent & operator=(Extent &&other)=default
CoordinateExpr< N > ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:120
CoordinateExpr< N > lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:111
CoordinateExpr< N > le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:114
Extent< T, N > & operator+=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:138
ExtentBase & operator=(ExtentBase const &)=default
Extent< T, N > & operator/=(T scalar) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
Definition: Extent.h:170
CoordinateExpr< N > eq(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:47
ExtentBase & operator=(ExtentBase &&)=default
Extent< T, N > operator-(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:135
CoordinateExpr< N > le(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:68
bool operator==(Extent< T, N > const &other) const noexcept
Standard equality comparison.
Definition: Extent.h:77
CoordinateExpr< N > lt(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:61
CoordinateExpr< N > ne(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:108
Extent< T, N > operator/(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
Definition: Extent.h:167
ExtentBase(Eigen::MatrixBase< Vector > const &vector)
Construct an Extent from an Eigen vector.
Definition: Extent.h:199
Extent< T, N > & operator-=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:142
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
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
Definition: Extent.h:70
bool operator!=(Extent< T, N > const &other) const noexcept
Standard inequality comparison.
Definition: Extent.h:84
CoordinateExpr< N > eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:105
Extent< T, N > operator+(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:132
std::string toString() const
Cast this object to an Extent of the same numeric type and dimensionality.
Definition: Extent.h:179
Extent< T, N > operator-() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:149
CoordinateExpr< N > ne(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:54
Point< T, N > asPoint() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
Definition: Extent.cc:89
CoordinateExpr< N > gt(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:75
CoordinateExpr< N > gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:117
ExtentBase(ExtentBase const &)=default
Extent< T, N > operator*(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
Definition: Extent.h:160
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
Definition: Extent.h:67
CoordinateExpr< N > ge(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:82
Extent< T, N > operator+() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:146
ExtentBase(ExtentBase &&)=default
Extent< T, N > & operator*=(T scalar) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
Definition: Extent.h:163
A coordinate class intended to represent offsets and dimensions.
Definition: Extent.h:210
Extent & operator=(Extent const &other)=default
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:220
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
Extent(Point< U, N > const &other) noexcept(IS_NOTHROW_CONVERTIBLE< T, U >)
Extent(Extent const &other)=default
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
Definition: Extent.h:240
Extent(Extent< U, N > const &other) noexcept(IS_NOTHROW_CONVERTIBLE< T, U >)
Explicit constructor from Extent of different type (if allowed)
Extent & operator=(Extent &&other)=default
Extent(Extent &&other)=default
void swap(Extent &other) noexcept
Definition: Extent.h:245
Super::EigenVector EigenVector
Definition: Extent.h:214
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
Definition: Extent.h:243
A coordinate class intended to represent absolute positions (2-d specialization).
Definition: Point.h:211
A coordinate class intended to represent absolute positions (3-d specialization).
Definition: Point.h:268
A coordinate class intended to represent absolute positions.
Definition: Point.h:169
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
double computeExtentNorm(Extent< double, N > const &s)
Definition: Extent.h:41
constexpr Angle operator*(Angle a, Angle d) noexcept
Product of two angles.
Definition: Angle.h:322
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 > ExtentD
Definition: Extent.h:399
void operator/=(ExtentBase< int, N > &lhs, double rhs) noexcept
Definition: Extent.h:454
constexpr Angle operator+(Angle a, Angle d) noexcept
Sum of two angles.
Definition: Angle.h:308
std::size_t hash_value(Extent< T, N > const &extent) noexcept
Definition: Extent.cc:127
Extent< double, N > & operator+=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Definition: Extent.h:470
constexpr Angle operator/(Angle a, int d) noexcept
Ratio of an angle and a scalar.
Definition: Angle.h:349
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.
constexpr Angle operator-(Angle a, Angle d) noexcept
Difference of two angles.
Definition: Angle.h:314
Extent< int, N > truncate(Extent< double, N > const &input) noexcept
Return the component-wise truncation (round towards zero).
Definition: Extent.cc:100
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
Extent< double, 2 > Extent2D
Definition: Extent.h:400
Extent< double, N > & operator-=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Definition: Extent.h:480
Extent< int, 2 > ExtentI
Definition: Extent.h:396
void operator*=(ExtentBase< int, N > &lhs, double rhs) noexcept
Definition: Extent.h:443
Extent< int, N > ceil(Extent< double, N > const &input) noexcept
Return the component-wise ceil (round towards more positive).
Definition: Extent.cc:118
Extent< int, 3 > Extent3I
Definition: Extent.h:398
Extent< int, 2 > Extent2I
Definition: Extent.h:397
Extent< double, 3 > Extent3D
Definition: Extent.h:401
A base class for image defects.
STL namespace.
ImageT val
Definition: CR.cc:146
T str(T... args)
result_type operator()(argument_type const &x) const noexcept
Definition: Extent.h:502