25#ifndef LSST_GEOM_POINT_H
26#define LSST_GEOM_POINT_H
37template <
typename T,
int N>
117 this->
_vector += other.asEigen();
121 this->
_vector -= other.asEigen();
133 this->
_vector += offset.asEigen();
140 return (this->
asEigen() - other.asEigen()).squaredNorm();
146 for (
size_t i = 0; i < N; ++i) {
159 template <
typename Vector>
168template <
typename T,
int N>
192 template <
typename U>
193 explicit Point(
Point<U, N> const &other)
noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
234 template <
typename U>
235 explicit Point(
Point<U, 2> const &other)
noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
291 template <
typename U>
292 explicit Point(
Point<U, 3> const &other)
noexcept(IS_NOTHROW_CONVERTIBLE<T, U>);
317template <
typename T,
int N>
376template <
typename T,
int N>
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 bool constexpr IS_ELEMENT_NOTHROW_COPYABLE
static bool constexpr IS_ELEMENT_NOTHROW_ASSIGNABLE
A coordinate class intended to represent offsets and dimensions.
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.
Point(std::tuple< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Point(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point from an Eigen vector.
Point(T x, T y) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from a pair of doubles.
Super::EigenVector EigenVector
Point(std::pair< T, T > const &xy) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a std::pair.
Point & operator=(Point const &)=default
Point(T const xy[2]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
void swap(Point &other) noexcept
Point(Point const &)=default
Point(Extent< T, 2 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Extent.
Point & operator=(Point &&)=default
Point(T const xyz[3]) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from a two-element array.
Point(Point const &)=default
Point & operator=(Point const &)=default
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.
Point(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point from an Eigen vector.
Point(std::tuple< T, T, T > const &xyz) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct from std::tuple.
Point(Extent< T, 3 > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Extent.
Point & operator=(Point &&)=default
void swap(Point &other) noexcept
Super::EigenVector EigenVector
Point(T x, T y, T z) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from a sequence of doubles.
CoordinateExpr< N > ne(Point< T, N > const &other) const noexcept
Point< T, N > operator-(Extent< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
CoordinateExpr< N > eq(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
double distanceSquared(PointBase< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
PointBase(PointBase &&)=default
CoordinateExpr< N > lt(Point< T, N > const &other) const noexcept
Point< T, N > & operator+=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
CoordinateExpr< N > le(Point< T, N > const &other) const noexcept
Point< T, N > & operator-=(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_ASSIGNABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
bool operator!=(Point< T, N > const &other) const noexcept
Standard inequality comparison.
PointBase & operator=(PointBase &&)=default
void scale(double factor) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
CoordinateExpr< N > ge(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > ge(Point< T, N > const &other) const noexcept
CoordinateExpr< N > le(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
CoordinateExpr< N > gt(Point< T, N > const &other) const noexcept
PointBase(PointBase const &)=default
CoordinateExpr< N > lt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
void shift(Extent< T, N > const &offset) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Shift the point by the given offset.
PointBase & operator=(PointBase const &)=default
PointBase(Eigen::MatrixBase< Vector > const &vector)
Cast this object to an Extent of the same numeric type and dimensionality.
bool operator==(Point< T, N > const &other) const noexcept
Standard equality comparison.
CoordinateExpr< N > gt(T scalar) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
PointBase(T val=static_cast< T >(0)) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
Extent< T, N > asExtent() const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
CoordinateExpr< N > eq(Point< T, N > const &other) const noexcept
Point< T, N > operator+(Extent< T, N > const &other) 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)
std::string toString() const
Cast this object to an Extent of the same numeric type and dimensionality.
Extent< T, N > operator-(Point< T, N > const &other) const noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Cast this object to an Extent of the same numeric type and dimensionality.
A coordinate class intended to represent absolute positions.
Point(Point const &)=default
Point(Extent< T, N > const &other) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Explicit constructor from Extent.
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.
Point & operator=(Point &&)=default
Super::EigenVector EigenVector
Point(EigenVector const &vector) noexcept(Super::IS_ELEMENT_NOTHROW_COPYABLE)
Construct a Point from an Eigen vector.
void swap(Point &other) noexcept
Point & operator=(Point const &)=default
Extent< double, N > & operator+=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
Point< double, 2 > PointD
constexpr Angle operator+(Angle a, Angle d) noexcept
Sum of two angles.
std::size_t hash_value(Extent< T, N > const &extent) noexcept
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.
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
Point< double, 3 > Point3D
Point< double, 2 > Point2D
Extent< double, N > & operator-=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
result_type operator()(argument_type const &x) const noexcept