Multi-purpose 2D vector class. More...
#include <cvb/point_2d.hpp>
Public Member Functions | |
Point2D () noexcept=default | |
Creates a default point at (0, 0). | |
Point2D (T x, T y) noexcept | |
Create a point from the x and y component. | |
Point2D (Angle phi, T r) noexcept | |
Create a PointD vector from radial coordinates. | |
template<std::size_t N> | |
Point2D (const T(&list)[N]) noexcept | |
Construct a point with an initializer list. | |
T | X () const noexcept |
Gets the x-component of the point. | |
void | SetX (T x) noexcept |
Sets the x-component of the point. | |
T | Y () const noexcept |
Gets the y-component of the point. | |
void | SetY (T y) |
Sets the y-component of the point. | |
T | Length () const noexcept |
Gets the length of the vector represented by this point object. | |
void | SetLength (T length) noexcept |
Sets the length of the vector represented by this point object. | |
Angle | Phi () const noexcept |
Gets the orientation of the vector represented by this point object. | |
void | SetPhi (Angle phi) noexcept |
Sets the orientation of the vector represented by this point object. | |
bool | operator== (const Point2D< T > &other) const noexcept |
Compares to an other point. | |
bool | operator!= (const Point2D< T > &other) const noexcept |
Compares to an other point. | |
template<class C> | |
operator Point2D< C > () const noexcept | |
Enable casting. | |
Point2D< T > & | operator+= (const Point2D< T > &point) noexcept |
Adds and assigns to this point. | |
Point2D< T > & | operator-= (const Point2D< T > &point) noexcept |
Subtracts and assigns to this point. | |
Point2D< T > & | operator*= (const T &value) noexcept |
Multiplies by a scalar and assigns to this point. | |
Point2D< T > & | operator/= (const T &value) noexcept |
Divide by a scalar and assigns to this point. | |
const T & | operator[] (int index) const noexcept |
Index based element access. | |
T & | operator[] (int index) noexcept |
Index based element access. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<size_t I, class T, std::enable_if_t< less< I, 2 >::value, int > = 0> | |
CVB_BEGIN_INLINE_NS auto | get (const Point2D< T > &point) noexcept -> decltype(point[I]) |
Get's the I-th element of the Point2D<T>. | |
template<size_t I, class T, std::enable_if_t< less< I, 2 >::value, int > = 0> | |
void | set (Point2D< T > &point, const T &val) noexcept |
Set's the value of the I-th element in the Point2D<T> point. | |
template<class T> | |
Point2D< T > | operator+ (const Point2D< T > &lhs, const Point2D< T > &rhs) |
Add two points. | |
template<class T> | |
Point2D< T > | operator- (const Point2D< T > &lhs, const Point2D< T > &rhs) |
Subtracts two points. | |
template<class T> | |
T | operator* (const Point2D< T > &lhs, const Point2D< T > &rhs) |
Inner product of two point vectors. | |
template<class T> | |
Point2D< T > | operator* (const Point2D< T > &lhs, const T &rhs) |
Multiply point with scalar. | |
template<class T> | |
Point2D< T > | operator* (const T &lhs, const Point2D< T > &rhs) |
Multiply scalar with point. | |
template<class T> | |
Point2D< T > | operator/ (const Point2D< T > &lhs, const T &rhs) |
Divide point by scalar. | |
Multi-purpose 2D vector class.
|
defaultnoexcept |
Creates a default point at (0, 0).
Does | not throw any exception. |
|
inlinenoexcept |
Create a point from the x and y component.
[in] | x | Data to initialize with. |
[in] | y | Data to initialize with. |
Does | not throw any exception. |
Create a PointD vector from radial coordinates.
[in] | phi | Angle coordinate. |
[in] | r | Radius coordinate. |
Does | not throw any exception. |
The vectors are internally stored in Cartesian coordinates and that extensive use of radial coordinates my be slow.
|
inlinenoexcept |
Construct a point with an initializer list.
[in] | list | Containing exactly 2 elements. |
Does | not throw any exception. |
|
inlinenoexcept |
Gets the length of the vector represented by this point object.
Does | not throw any exception. |
|
inlinenoexcept |
Compares to an other point.
[in] | other | Other point. |
Does | not throw any exception. |
|
inlinenoexcept |
Multiplies by a scalar and assigns to this point.
[in] | value | The scalar. |
Does | not throw any exception. |
|
inlinenoexcept |
Adds and assigns to this point.
[in] | point | Other point. |
Does | not throw any exception. |
|
inlinenoexcept |
Subtracts and assigns to this point.
[in] | point | Other point. |
Does | not throw any exception. |
|
inlinenoexcept |
Divide by a scalar and assigns to this point.
[in] | value | The scalar. |
Does | not throw any exception. |
|
inlinenoexcept |
Compares to an other point.
[in] | other | Other point. |
Does | not throw any exception. |
|
inlinenoexcept |
Index based element access.
[in] | index | Index of the element. |
Does | not throw any exception. |
|
inlinenoexcept |
Index based element access.
[in] | index | Index of the element. |
Does | not throw any exception. |
|
inlinenoexcept |
Gets the orientation of the vector represented by this point object.
Does | not throw any exception. |
|
inlinenoexcept |
Sets the length of the vector represented by this point object.
[in] | length | The length (accurate only for double or float). |
Does | not throw any exception. |
|
inlinenoexcept |
Sets the orientation of the vector represented by this point object.
[in] | phi | The angle (accurate only for double or float). |
Does | not throw any exception. |
|
inlinenoexcept |
Sets the x-component of the point.
[in] | x | X-component. |
Does | not throw any exception. |
|
inline |
Sets the y-component of the point.
[in] | y | Y-component. |
Does | not throw any exception. |
|
inlinenoexcept |
Gets the x-component of the point.
Does | not throw any exception. |
|
inlinenoexcept |
Gets the y-component of the point.
Does | not throw any exception. |
|
related |
Get's the I-th element of the Point2D<T>.
I | The index of the element. |
point | The Point2D<T> to retrieve the I-th element from. |
Inner product of two point vectors.
[in] | lhs | Right hand side point. |
[in] | rhs | Left hand side value. |
Does | not throw any exception. |
Multiply point with scalar.
[in] | lhs | Right hand side point. |
[in] | rhs | Left hand side value. |
Does | not throw any exception. |
Multiply scalar with point.
[in] | lhs | Right hand side value. |
[in] | rhs | Left hand side point. |
Does | not throw any exception. |
|
related |
Add two points.
[in] | lhs | Right hand side point. |
[in] | rhs | Left hand side point. |
Does | not throw any exception. |
|
related |
Subtracts two points.
[in] | lhs | Right hand side point. |
[in] | rhs | Left hand side point. |
Does | not throw any exception. |
Divide point by scalar.
[in] | lhs | Right hand side matrix. |
[in] | rhs | Left hand side value. |
Does | not throw any exception. |
|
related |
Set's the value of the I-th element in the Point2D<T> point.
I | The index of the element. |
point | The Point2D<T,K> to set the I-th value in. |
val | The value to be written to the I-th element of point. |
We use cookies to improve your experience. By using this documentation, you agree to our use of cookies.