LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
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;
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 
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 
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 
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 
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
lsst::geom::CoordinateExpr
A boolean coordinate.
Definition: CoordinateExpr.h:50
lsst::geom::Extent::~Extent
~Extent()=default
y
int y
Definition: SpanSet.cc:49
lsst::geom::Extent::computeNorm
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
Definition: Extent.h:243
std::hash< lsst::geom::Extent< T, N > >::operator()
result_type operator()(argument_type const &x) const noexcept
Definition: Extent.h:502
lsst::geom::Extent::operator=
Extent & operator=(Extent const &other)=default
std::is_same
lsst::geom::Extent< T, 3 >::Extent
Extent(Extent const &other)=default
lsst::geom::Extent::Extent
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
lsst::geom::ExtentBase::operator/
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
lsst::geom::ExtentBase::ne
CoordinateExpr< N > ne(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:108
lsst::afw::table._match.second
second
Definition: _match.py:76
lsst::geom::ExtentBase::eq
CoordinateExpr< N > eq(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:47
lsst::geom::Extent< T, 2 >::Extent
Extent(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
Definition: Extent.h:279
lsst::geom::Extent< T, 3 >::Extent
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:317
lsst::geom::operator+
constexpr Angle operator+(Angle a, Angle d) noexcept
Sum of two angles.
Definition: Angle.h:308
lsst::geom::Extent::Extent
Extent(Extent const &other)=default
lsst::geom::Extent< T, 3 >::~Extent
~Extent()=default
lsst::geom::operator+=
Extent< double, N > & operator+=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Definition: Extent.h:470
lsst::geom::operator*=
void operator*=(ExtentBase< int, N > &lhs, double rhs) noexcept
Definition: Extent.h:443
std::pair
lsst::geom::ExtentBase::operator+
Extent< T, N > operator+(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:132
lsst::geom::Extent< T, 2 >::Extent
Extent(Point< T, 2 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Point.
lsst::geom::ExtentBase::lt
CoordinateExpr< N > lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:111
lsst::geom::ExtentBase::operator==
bool operator==(Extent< T, N > const &other) const noexcept
Standard equality comparison.
Definition: Extent.h:77
lsst::geom::Extent< T, 3 >::Extent
Extent(Point< T, 3 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Point.
lsst::geom::ExtentBase::ge
CoordinateExpr< N > ge(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:82
lsst::geom::ExtentBase::operator=
ExtentBase & operator=(ExtentBase const &)=default
lsst::afw::table._match.first
first
Definition: _match.py:74
lsst::geom::ExtentBase::operator+=
Extent< T, N > & operator+=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:138
std::stringstream
STL class.
lsst::geom::ExtentBase::operator=
ExtentBase & operator=(ExtentBase &&)=default
lsst::geom::Extent< T, 3 >::swap
void swap(Extent &other) noexcept
Definition: Extent.h:348
lsst::geom::Extent::EigenVector
Super::EigenVector EigenVector
Definition: Extent.h:214
std::tuple
lsst::geom::hash_value
std::size_t hash_value(Extent< T, N > const &extent) noexcept
Definition: Extent.cc:127
lsst::geom::operator-
constexpr Angle operator-(Angle a, Angle d) noexcept
Difference of two angles.
Definition: Angle.h:314
lsst::geom::Extent< T, 2 >::Extent
Extent(T x, T y) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from two scalars.
Definition: Extent.h:276
lsst::geom::operator/=
void operator/=(ExtentBase< int, N > &lhs, double rhs) noexcept
Definition: Extent.h:454
val
ImageT val
Definition: CR.cc:146
lsst::geom::Extent< T, 2 >::Extent
Extent(std::tuple< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Definition: Extent.h:287
lsst::geom::Extent< T, 3 >::operator=
Extent & operator=(Extent const &other)=default
lsst::geom::truncate
Extent< int, N > truncate(Extent< double, N > const &input) noexcept
Return the component-wise truncation (round towards zero).
Definition: Extent.cc:100
lsst::geom::Extent::Extent
Extent(Extent &&other)=default
lsst::geom::detail::computeExtentNorm
double computeExtentNorm(Extent< double, N > const &s)
Definition: Extent.h:41
lsst::geom::all
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
Definition: CoordinateExpr.h:81
lsst::geom::Extent< T, 2 >::operator=
Extent & operator=(Extent &&other)=default
lsst::geom::Extent< T, 3 >::operator=
Extent & operator=(Extent &&other)=default
lsst::geom::Extent< T, 2 >::~Extent
~Extent()=default
lsst::geom::ExtentBase::operator-
Extent< T, N > operator-(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:135
lsst::geom::Extent::computeSquaredNorm
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
Definition: Extent.h:240
lsst::geom::Extent< T, 2 >::swap
void swap(Extent &other) noexcept
Definition: Extent.h:298
lsst::geom::ExtentBase::ge
CoordinateExpr< N > ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:120
lsst::geom::ExtentBase::computeNorm
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
Definition: Extent.h:70
lsst::geom::ExtentBase::operator-=
Extent< T, N > & operator-=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Definition: Extent.h:142
lsst::geom::Extent< T, 2 >::Extent
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:264
z
double z
Definition: Match.cc:44
x
double x
Definition: ChebyshevBoundedField.cc:277
lsst::geom::Extent< T, 3 >::EigenVector
Super::EigenVector EigenVector
Definition: Extent.h:311
lsst::geom::ExtentBase::ExtentBase
ExtentBase(Eigen::MatrixBase< Vector > const &vector)
Construct an Extent from an Eigen vector.
Definition: Extent.h:199
other
ItemVariant const * other
Definition: Schema.cc:56
lsst.pex::exceptions::LogicError
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
lsst::geom::any
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.
Definition: CoordinateExpr.h:89
lsst::geom::operator-=
Extent< double, N > & operator-=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Definition: Extent.h:480
lsst::geom::Extent::Extent
Extent(Extent< U, N > const &other) noexcept(IS_NOTHROW_CONVERTIBLE< T, U >)
Explicit constructor from Extent of different type (if allowed)
lsst::geom::ExtentBase::operator*
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
lsst::geom::Extent< T, 3 >::Extent
Extent(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a three-element array.
Definition: Extent.h:333
lsst::geom::CoordinateBase< Extent< T, N >, T, N >::_vector
EigenVector _vector
Definition: CoordinateBase.h:109
std::is_integral
lsst::geom::Extent< T, 3 >::Extent
Extent(std::tuple< T, T, T > const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Definition: Extent.h:337
lsst::geom::operator*
constexpr Angle operator*(Angle a, Angle d) noexcept
Product of two angles.
Definition: Angle.h:322
lsst::geom::ExtentBase::le
CoordinateExpr< N > le(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:68
lsst::geom::Extent::Extent
Extent(Point< U, N > const &other) noexcept(IS_NOTHROW_CONVERTIBLE< T, U >)
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
lsst::geom::ExtentBase::computeSquaredNorm
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
Definition: Extent.h:67
lsst::geom::ExtentBase
Definition: Extent.h:56
lsst::geom::CoordinateBase< Extent< T, N >, T, N >::EigenVector
Eigen::Matrix< T, N, 1, Eigen::DontAlign > EigenVector
Definition: CoordinateBase.h:59
lsst::geom::ExtentBase::gt
CoordinateExpr< N > gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:117
lsst::geom
Definition: AffineTransform.h:36
lsst::geom::ExtentI
Extent< int, 2 > ExtentI
Definition: Extent.h:396
lsst::geom::ExtentBase::operator!=
bool operator!=(Extent< T, N > const &other) const noexcept
Standard inequality comparison.
Definition: Extent.h:84
lsst::geom::Extent< T, 2 >::operator=
Extent & operator=(Extent const &other)=default
lsst::geom::ExtentBase::ExtentBase
ExtentBase(ExtentBase &&)=default
lsst::geom::CoordinateBase
A CRTP base class for coordinate objects.
Definition: CoordinateBase.h:54
lsst::geom::ExtentBase::~ExtentBase
~ExtentBase()=default
lsst::geom::Extent< T, 3 >::Extent
Extent(Extent &&other)=default
lsst::geom::Extent< T, 3 >::Extent
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
lsst::geom::Point< T, 2 >
A coordinate class intended to represent absolute positions (2-d specialization).
Definition: Point.h:211
lsst::geom::ExtentBase::toString
std::string toString() const
Cast this object to an Extent of the same numeric type and dimensionality.
Definition: Extent.h:179
lsst::geom::Extent< T, 3 >::Extent
Extent(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from three scalars.
Definition: Extent.h:329
lsst::geom::operator/
constexpr Angle operator/(Angle a, int d) noexcept
Ratio of an angle and a scalar.
Definition: Angle.h:349
std
STL namespace.
lsst::geom::ExtentBase::ne
CoordinateExpr< N > ne(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:54
CoordinateExpr.h
lsst::geom::Extent2I
Extent< int, 2 > Extent2I
Definition: Extent.h:397
lsst::geom::Point
A coordinate class intended to represent absolute positions.
Definition: CoordinateBase.h:39
lsst::geom::Extent< T, 2 >::Extent
Extent(Extent const &other)=default
lsst::geom::ExtentBase::operator-
Extent< T, N > operator-() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:149
lsst::geom::Extent< T, 2 >::EigenVector
Super::EigenVector EigenVector
Definition: Extent.h:258
lsst::geom::Extent2D
Extent< double, 2 > Extent2D
Definition: Extent.h:400
lsst::geom::asEigen
Eigen::Vector3d asEigen(sphgeom::Vector3d const &vector) noexcept
Definition: sphgeomUtils.h:36
std::stringstream::str
T str(T... args)
lsst::geom::ExtentBase::operator+
Extent< T, N > operator+() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:146
lsst::geom::Extent3I
Extent< int, 3 > Extent3I
Definition: Extent.h:398
std::size_t
lsst::geom::ExtentD
Extent< double, 2 > ExtentD
Definition: Extent.h:399
lsst::geom::ExtentBase::ExtentBase
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
lsst::geom::Extent< T, 2 >::Extent
Extent(std::pair< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a std::pair.
Definition: Extent.h:283
lsst::geom::Point< T, 3 >
A coordinate class intended to represent absolute positions (3-d specialization).
Definition: Point.h:268
lsst::geom::ExtentBase::gt
CoordinateExpr< N > gt(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:75
lsst::geom::ExtentBase::le
CoordinateExpr< N > le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:114
lsst::geom::CoordinateBase< Extent< T, N >, T, N >::IS_ELEMENT_NOTHROW_COPYABLE
static constexpr bool IS_ELEMENT_NOTHROW_COPYABLE
Definition: CoordinateBase.h:60
lsst::geom::Extent::operator=
Extent & operator=(Extent &&other)=default
lsst::geom::ExtentBase::eq
CoordinateExpr< N > eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Definition: Extent.h:105
lsst::geom::CoordinateBase< Extent< T, N >, T, N >::asEigen
EigenVector const & asEigen() const noexcept(IS_ELEMENT_NOTHROW_COPYABLE)
Return a fixed-size Eigen representation of the coordinate object.
Definition: CoordinateBase.h:89
lsst::geom::Extent< T, 2 >::Extent
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
lsst::geom::floor
Extent< int, N > floor(Extent< double, N > const &input) noexcept
Return the component-wise floor (round towards more negative).
Definition: Extent.cc:109
lsst::geom::ExtentBase::operator*=
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
lsst::geom::ceil
Extent< int, N > ceil(Extent< double, N > const &input) noexcept
Return the component-wise ceil (round towards more positive).
Definition: Extent.cc:118
lsst::geom::Extent::swap
void swap(Extent &other) noexcept
Definition: Extent.h:245
lsst::geom::ExtentBase::lt
CoordinateExpr< N > lt(Extent< T, N > const &other) const noexcept
Definition: Extent.cc:61
lsst::geom::Extent
A coordinate class intended to represent offsets and dimensions.
Definition: CoordinateBase.h:41
lsst::geom::Extent< T, 2 >::Extent
Extent(Extent &&other)=default
lsst::geom::ExtentBase::operator/=
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
lsst::geom::ExtentBase::ExtentBase
ExtentBase(ExtentBase const &)=default
lsst::geom::Extent::Extent
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Definition: Extent.h:220
lsst::geom::Extent3D
Extent< double, 3 > Extent3D
Definition: Extent.h:401
lsst::geom::ExtentBase::asPoint
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
lsst::geom::CoordinateBase< Extent< T, N >, T, N >::IS_ELEMENT_NOTHROW_ASSIGNABLE
static constexpr bool IS_ELEMENT_NOTHROW_ASSIGNABLE
Definition: CoordinateBase.h:61
std::hash
exceptions.h