25 #ifndef LSST_GEOM_POINT_H 26 #define LSST_GEOM_POINT_H 37 template <
typename T,
int N>
133 this->
_vector += offset.asEigen();
146 for (
size_t i = 0; i < N; ++i) {
159 template <
typename Vector>
160 explicit PointBase(Eigen::MatrixBase<Vector>
const &vector) : Super(vector) {}
168 template <
typename T,
int N>
192 template <
typename U>
193 explicit Point(
Point<U, N> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
210 template <
typename T>
234 template <
typename U>
235 explicit Point(
Point<U, 2> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
249 : Super(EigenVector(xy[0], xy[1])) {}
257 : Super(EigenVector(
std::get<0>(xy),
std::get<1>(xy))) {}
267 template <
typename T>
291 template <
typename U>
292 explicit Point(
Point<U, 3> const &other) noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
303 : Super(EigenVector(
x,
y,
z)) {}
307 : Super(EigenVector(xyz[0], xyz[1], xyz[2])) {}
311 : Super(EigenVector(
std::get<0>(xyz),
std::get<1>(xyz),
std::get<2>(xyz))) {}
317 template <
typename T,
int N>
Point(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point with all elements set to the same scalar value.
A CRTP base class for coordinate objects.
Point< T, N > & operator+=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Extent< T, N > asExtent() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
void swap(Point &other) noexcept
Point(Extent< T, 3 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Extent.
CoordinateExpr< N > lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
std::size_t hash_value(Point< T, N > const &point)
bool operator==(Point< T, N > const &other) const noexcept
Standard equality comparison.
void shift(Extent< T, N > const &offset) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Shift the point by the given offset.
Extent< T, N > operator-(Point< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > ne(Point< T, N > const &other) const noexcept
Super::EigenVector EigenVector
Point(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from a sequence of doubles.
A coordinate class intended to represent absolute positions.
CoordinateExpr< N > eq(Point< T, N > const &other) const noexcept
CoordinateExpr< N > ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Point(T x, T y) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from a pair of doubles.
A coordinate class intended to represent offsets and dimensions (2-d specialization).
std::string toString() const
Point< T, N > & operator-=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Point(std::pair< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a std::pair.
void swap(Point &other) noexcept
Point(Extent< T, 2 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Extent.
Point< double, 2 > Point2D
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.
void _swap(CoordinateBase &other) noexcept
A coordinate class intended to represent offsets and dimensions (3-d specialization).
CoordinateExpr< N > eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
Point(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
Eigen::Matrix< int, N, 1, Eigen::DontAlign > EigenVector
A base class for image defects.
CoordinateExpr< N > ge(Point< T, N > const &other) const noexcept
void scale(double factor) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
PointBase & operator=(PointBase const &)=default
static bool constexpr IS_ELEMENT_NOTHROW_COPYABLE
Super::EigenVector EigenVector
Point(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
A coordinate class intended to represent offsets and dimensions.
static bool constexpr IS_ELEMENT_NOTHROW_ASSIGNABLE
Point< T, N > operator-(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
void swap(Point &other) noexcept
CoordinateExpr< N > le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Point(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point from an Eigen vector.
Point(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point with all elements set to the same scalar value.
Super::EigenVector EigenVector
CoordinateExpr< N > lt(Point< T, N > const &other) const noexcept
Point< double, 3 > Point3D
EigenVector const & asEigen() const noexcept(IS_ELEMENT_NOTHROW_COPYABLE)
Return a fixed-size Eigen representation of the coordinate object.
Point(std::tuple< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
ItemVariant const * other
Point(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point from an Eigen vector.
PointBase(Eigen::MatrixBase< Vector > const &vector)
Point(std::tuple< T, T, T > const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Point< T, N > operator+(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Point(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Extent.
PointBase(PointBase const &)=default
bool operator!=(Point< T, N > const &other) const noexcept
Standard inequality comparison.
double distanceSquared(PointBase< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > le(Point< T, N > const &other) const noexcept
Point(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point with all elements set to the same scalar value.
CoordinateExpr< N > ne(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Point< double, 2 > PointD
CoordinateExpr< N > gt(Point< T, N > const &other) const noexcept
PointBase(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Point(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point from an Eigen vector.