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
|
Go to the documentation of this file.
25 #ifndef LSST_GEOM_EXTENT_H
26 #define LSST_GEOM_EXTENT_H
29 #include <type_traits>
42 return s.asEigen().norm();
48 #if 1 // make compilers happy in non-void function
55 template <
typename T,
int N>
182 for (
size_t i = 0; i < N; ++i) {
198 template <
typename Vector>
209 template <
typename T,
int N>
210 class Extent :
public ExtentBase<T, N> {
211 typedef ExtentBase<T, N> Super;
226 template <
typename U>
228 template <
typename U>
253 template <
typename T>
270 template <
typename U>
272 template <
typename U>
306 template <
typename T>
323 template <
typename U>
325 template <
typename U>
352 template <
typename T>
353 template <
typename 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()));
361 template <
typename T>
362 template <
typename 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()));
371 template <
typename T>
372 template <
typename 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()));
382 template <
typename T>
383 template <
typename 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()));
393 template <
typename T,
int N>
431 template <
typename T,
int N>
445 static_assert(N < 0,
"In-place multiplication of Extent<int,N> by double would truncate.");
456 static_assert(N < 0,
"In-place division of Extent<int,N> by double would truncate.");
498 template <
typename T,
int N>
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
result_type operator()(argument_type const &x) const noexcept
Extent & operator=(Extent const &other)=default
Extent(Extent const &other)=default
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.
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.
CoordinateExpr< N > ne(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > eq(Extent< T, N > const &other) const noexcept
Extent(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
constexpr Angle operator+(Angle a, Angle d) noexcept
Sum of two angles.
Extent(Extent const &other)=default
Extent< double, N > & operator+=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
void operator*=(ExtentBase< int, N > &lhs, double rhs) noexcept
Extent< T, N > operator+(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Extent(Point< T, 2 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Point.
CoordinateExpr< N > lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
bool operator==(Extent< T, N > const &other) const noexcept
Standard equality comparison.
Extent(Point< T, 3 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Point.
CoordinateExpr< N > ge(Extent< T, N > const &other) const noexcept
ExtentBase & operator=(ExtentBase const &)=default
Extent< T, N > & operator+=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
ExtentBase & operator=(ExtentBase &&)=default
void swap(Extent &other) noexcept
Super::EigenVector EigenVector
std::size_t hash_value(Extent< T, N > const &extent) noexcept
constexpr Angle operator-(Angle a, Angle d) noexcept
Difference of two angles.
Extent(T x, T y) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from two scalars.
void operator/=(ExtentBase< int, N > &lhs, double rhs) noexcept
Extent(std::tuple< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Extent & operator=(Extent const &other)=default
Extent< int, N > truncate(Extent< double, N > const &input) noexcept
Return the component-wise truncation (round towards zero).
Extent(Extent &&other)=default
double computeExtentNorm(Extent< double, N > const &s)
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
Extent & operator=(Extent &&other)=default
Extent & operator=(Extent &&other)=default
Extent< T, N > operator-(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
void swap(Extent &other) noexcept
CoordinateExpr< N > ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
Extent< T, N > & operator-=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Super::EigenVector EigenVector
ExtentBase(Eigen::MatrixBase< Vector > const &vector)
Construct an Extent from an Eigen vector.
ItemVariant const * other
Reports errors in the logical structure of the program.
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.
Extent< double, N > & operator-=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Extent(Extent< U, N > const &other) noexcept(IS_NOTHROW_CONVERTIBLE< T, U >)
Explicit constructor from Extent of different type (if allowed)
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.
Extent(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a three-element array.
Extent(std::tuple< T, T, T > const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
constexpr Angle operator*(Angle a, Angle d) noexcept
Product of two angles.
CoordinateExpr< N > le(Extent< T, N > const &other) const noexcept
Extent(Point< U, N > const &other) noexcept(IS_NOTHROW_CONVERTIBLE< T, U >)
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
Eigen::Matrix< T, N, 1, Eigen::DontAlign > EigenVector
CoordinateExpr< N > gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
bool operator!=(Extent< T, N > const &other) const noexcept
Standard inequality comparison.
Extent & operator=(Extent const &other)=default
ExtentBase(ExtentBase &&)=default
A CRTP base class for coordinate objects.
Extent(Extent &&other)=default
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.
A coordinate class intended to represent absolute positions (2-d specialization).
std::string toString() const
Cast this object to an Extent of the same numeric type and dimensionality.
Extent(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from three scalars.
constexpr Angle operator/(Angle a, int d) noexcept
Ratio of an angle and a scalar.
CoordinateExpr< N > ne(Extent< T, N > const &other) const noexcept
Extent< int, 2 > Extent2I
A coordinate class intended to represent absolute positions.
Extent(Extent const &other)=default
Extent< T, N > operator-() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Super::EigenVector EigenVector
Extent< double, 2 > Extent2D
Eigen::Vector3d asEigen(sphgeom::Vector3d const &vector) noexcept
Extent< T, N > operator+() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Extent< int, 3 > Extent3I
Extent< double, 2 > ExtentD
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.
Extent(std::pair< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a std::pair.
A coordinate class intended to represent absolute positions (3-d specialization).
CoordinateExpr< N > gt(Extent< T, N > const &other) const noexcept
CoordinateExpr< N > le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
static constexpr bool IS_ELEMENT_NOTHROW_COPYABLE
Extent & operator=(Extent &&other)=default
CoordinateExpr< N > eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
EigenVector const & asEigen() const noexcept(IS_ELEMENT_NOTHROW_COPYABLE)
Return a fixed-size Eigen representation of the coordinate object.
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.
Extent< int, N > floor(Extent< double, N > const &input) noexcept
Return the component-wise floor (round towards more negative).
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.
Extent< int, N > ceil(Extent< double, N > const &input) noexcept
Return the component-wise ceil (round towards more positive).
void swap(Extent &other) noexcept
CoordinateExpr< N > lt(Extent< T, N > const &other) const noexcept
A coordinate class intended to represent offsets and dimensions.
Extent(Extent &&other)=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.
ExtentBase(ExtentBase const &)=default
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
Extent< double, 3 > Extent3D
Point< T, N > asPoint() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
static constexpr bool IS_ELEMENT_NOTHROW_ASSIGNABLE