18 template<
class T,
class ENABLE =
void>
64 :
Point2D(static_cast<T>(static_cast<double>(r) *
Cos(phi)),
65 static_cast<T>(static_cast<double>(r) *
Sin(phi)))
74 template<std::
size_t N>
77 static_assert(N == 2,
"CVB: Point2D must have 2 elements");
78 std::copy(std::begin(list), std::end(list), &x_);
128 return static_cast<T>(sqrt(static_cast<double>(x_) * static_cast<double>(x_)
129 + static_cast<double>(y_) * static_cast<double>(y_)));
149 return Atan2(static_cast<double>(y_), static_cast<double>(x_));
173 return (x_ == other.x_ && y_ == other.y_);
185 return !(*
this == other);
193 return Point2D<C>(static_cast<C>(
X()), static_cast<C>(
Y()));
257 assert(index < 2 && index >= 0);
258 return *(&x_ + index);
269 assert(index < 2 && index >= 0);
270 return *(&x_ + index);
275 T x_ = static_cast<T>(0);
276 T y_ = static_cast<T>(0);
323 return lhs.
X() * rhs.
X() + lhs.
Y() * rhs.
Y();
383 return Point2D<int>(static_cast<int>(std::round(rhs.X())), static_cast<int>(std::round(rhs.Y())));
void SetPhi(Angle phi) noexcept
Sets the orientation of the vector represented by this point object.
Definition: point_2d.hpp:157
Point2D< T > & operator *=(const T &value) noexcept
Multiplies by a scalar and assigns to this point.
Definition: point_2d.hpp:228
double Cos(Angle angle) noexcept
Returns the cosine of an angle.
Definition: angle.hpp:411
T Length() const noexcept
Gets the length of the vector represented by this point object.
Definition: point_2d.hpp:126
Point2D< int > Round(const Point2D< T > &rhs) noexcept
Round to an integer point.
Definition: point_2d.hpp:380
Angle Phi() const noexcept
Gets the orientation of the vector represented by this point object.
Definition: point_2d.hpp:147
AffineMatrix2D operator+(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Add two affine matrices.
Definition: affine_matrix_2d.hpp:217
Point2D< T > & operator -=(const Point2D< T > &point) noexcept
Subtracts and assigns to this point.
Definition: point_2d.hpp:215
Point2D(Angle phi, T r) noexcept
Create a PointD vector from radial coordinates.
Definition: point_2d.hpp:63
bool operator!=(const Point2D< T > &other) const noexcept
Compares to an other point.
Definition: point_2d.hpp:183
AffineMatrix2D operator/(const AffineMatrix2D &lhs, const double &rhs)
Divide affine matrix by scalar.
Definition: affine_matrix_2d.hpp:301
double Sin(Angle angle) noexcept
Returns the sine of an angle.
Definition: angle.hpp:438
bool operator==(const Point2D< T > &other) const noexcept
Compares to an other point.
Definition: point_2d.hpp:171
Root namespace for the Image Manager interface.
Definition: version.hpp:11
Point2D< T > & operator+=(const Point2D< T > &point) noexcept
Adds and assigns to this point.
Definition: point_2d.hpp:202
T Y() const noexcept
Gets the y-component of the point.
Definition: point_2d.hpp:106
Multi-purpose 2D vector class.
Definition: point_2d.hpp:19
AffineMatrix2D operator *(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Multiply two affine matrices.
Definition: affine_matrix_2d.hpp:245
void SetY(T y)
Sets the y-component of the point.
Definition: point_2d.hpp:116
T X() const noexcept
Gets the x-component of the point.
Definition: point_2d.hpp:86
T & operator[](int index) noexcept
Index based element access.
Definition: point_2d.hpp:267
const T & operator[](int index) const noexcept
Index based element access.
Definition: point_2d.hpp:255
void SetLength(T length) noexcept
Sets the length of the vector represented by this point object.
Definition: point_2d.hpp:137
void SetX(T x) noexcept
Sets the x-component of the point.
Definition: point_2d.hpp:96
Point2D(const T(&list)[N]) noexcept
Construct a point with an initializer list.
Definition: point_2d.hpp:75
Angle Atan2(double y, double x) noexcept
Returns the angle whose tangent is the quotient of two specified numbers.
Definition: angle.hpp:397
Point2D< T > & operator/=(const T &value) noexcept
Divide by a scalar and assigns to this point.
Definition: point_2d.hpp:241
Point2D() noexcept=default
Creates a default point at (0, 0).
AffineMatrix2D operator-(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Subtract two affine matrices.
Definition: affine_matrix_2d.hpp:231
Object for convenient and type - safe handling of angles.
Definition: angle.hpp:18