25 #ifndef LSST_GEOM_EXTENT_H
26 #define LSST_GEOM_EXTENT_H
29 #include <type_traits>
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>
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>
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
ItemVariant const * other
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.
static constexpr bool IS_ELEMENT_NOTHROW_COPYABLE
static constexpr bool IS_ELEMENT_NOTHROW_ASSIGNABLE
void swap(Extent &other) noexcept
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 & operator=(Extent &&other)=default
Super::EigenVector EigenVector
Extent(Extent const &other)=default
Extent(std::tuple< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Extent & operator=(Extent const &other)=default
Extent(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
Extent(Extent &&other)=default
Extent(std::pair< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a std::pair.
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
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.
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
Extent(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a three-element array.
Extent & operator=(Extent const &other)=default
Extent(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from three scalars.
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
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.
void swap(Extent &other) noexcept
Extent(std::tuple< T, T, T > const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Extent & operator=(Extent &&other)=default
CoordinateExpr< N > ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Extent< T, N > & operator+=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
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.
CoordinateExpr< N > eq(Extent< T, N > const &other) const noexcept
ExtentBase & operator=(ExtentBase &&)=default
Extent< T, N > operator-(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > le(Extent< T, N > const &other) const noexcept
bool operator==(Extent< T, N > const &other) const noexcept
Standard equality comparison.
CoordinateExpr< N > lt(Extent< T, N > const &other) const noexcept
CoordinateExpr< N > ne(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
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.
ExtentBase(Eigen::MatrixBase< Vector > const &vector)
Construct an Extent from an Eigen vector.
Extent< T, N > & operator-=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
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.
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
bool operator!=(Extent< T, N > const &other) const noexcept
Standard inequality comparison.
CoordinateExpr< N > eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Extent< T, N > operator+(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
std::string toString() const
Cast this object to an Extent of the same numeric type and dimensionality.
Extent< T, N > operator-() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > ne(Extent< T, N > const &other) const noexcept
Point< T, N > asPoint() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
CoordinateExpr< N > gt(Extent< T, N > const &other) const noexcept
CoordinateExpr< N > gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
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.
T computeSquaredNorm() const
Return the squared L2 norm of the Extent (x^2 + y^2 + ...).
CoordinateExpr< N > ge(Extent< T, N > const &other) const noexcept
Extent< T, N > operator+() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
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.
A coordinate class intended to represent offsets and dimensions.
Extent & operator=(Extent const &other)=default
Extent(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct an Extent from an Eigen vector.
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(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 + ...).
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
Super::EigenVector EigenVector
T computeNorm() const
Return the L2 norm of the Extent (sqrt(x^2 + y^2 + ...)).
A coordinate class intended to represent absolute positions (2-d specialization).
A coordinate class intended to represent absolute positions (3-d specialization).
A coordinate class intended to represent absolute positions.
Reports errors in the logical structure of the program.
double computeExtentNorm(Extent< double, N > const &s)
constexpr Angle operator*(Angle a, Angle d) noexcept
Product of two angles.
Extent< int, N > floor(Extent< double, N > const &input) noexcept
Return the component-wise floor (round towards more negative).
Extent< double, 2 > ExtentD
void operator/=(ExtentBase< int, N > &lhs, double rhs) noexcept
constexpr Angle operator+(Angle a, Angle d) noexcept
Sum of two angles.
std::size_t hash_value(Extent< T, N > const &extent) noexcept
Extent< double, N > & operator+=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
constexpr Angle operator/(Angle a, int d) noexcept
Ratio of an angle and a scalar.
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.
Extent< int, N > truncate(Extent< double, N > const &input) noexcept
Return the component-wise truncation (round towards zero).
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
Extent< double, 2 > Extent2D
Extent< double, N > & operator-=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
void operator*=(ExtentBase< int, N > &lhs, double rhs) noexcept
Extent< int, N > ceil(Extent< double, N > const &input) noexcept
Return the component-wise ceil (round towards more positive).
Extent< int, 3 > Extent3I
Extent< int, 2 > Extent2I
Extent< double, 3 > Extent3D
A base class for image defects.
result_type operator()(argument_type const &x) const noexcept