22 #ifndef CRNPOINT2D_HEADER
23 #define CRNPOINT2D_HEADER
28 #include <type_traits>
54 Point2D(T x, T y) noexcept(std::is_nothrow_copy_constructible<T>::value) :
X(x),
Y(y) {}
58 virtual ~Point2D()
override =
default;
111 return sqrt(
Sqr(p1.
X - p2.
X) +
Sqr(p1.
Y - p2.
Y));
113 throw ExceptionInvalidArgument(
"double Distance(const Point2D<T>&, const Point2D<T>&, DistanceType): invalid distance type.");
Point2D(T x, T y) noexcept(std::is_nothrow_copy_constructible< T >::value)
Constructor from values.
bool operator==(const Point2D &p) const noexcept
Point2D< U > Convert() const noexcept(noexcept(U{X}))
Converts to another type of Point.
Functor to compare points.
virtual ~Point2D() override=default
Destructor.
const T & Max(const T &a, const T &b)
Returns the max of two values.
Direction
An enumeration of directions.
A UTF32 character string class.
crn::Point2D< T > operator-(crn::Point2D< T > p1, const crn::Point2D< T > &p2) noexcept
int value_type
The value type.
Comparer(Direction dir)
Constructor.
Point2D & operator=(const Point2D &)=default
constexpr SumType< T > Sqr(const T &v) noexcept(noexcept(v *v))
Returns the square of a value.
Point2D< T > & operator-=(const Point2D< T > &p) noexcept
Translation.
double Distance(const Int &i1, const Int &i2) noexcept
void Abs(Image< T > &img, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) noexcept
Replaces each pixel by its absolute value.
Point2D< T > & operator+=(const Point2D< T > &p) noexcept
Translation.
DistanceType
An enumeration of distances.
String ToString() const
Converts object to string.
crn::Point2D< double > operator*(double d, const crn::Point2D< T > &p) noexcept
Point2D() noexcept(noexcept(T{0}))
Default constructor (sets coordinates to 0)
bool operator()(const Point2D &p1, const Point2D &p2) const
functor
crn::Point2D< T > operator+(crn::Point2D< T > p1, const crn::Point2D< T > &p2) noexcept
Invalid argument error (e.g.: nullptr pointer)