|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Two-dimensional vector class with arithmetic operators. More...
#include <EBGeometry_Vec.hpp>
Public Member Functions | |
| constexpr | Vec2T () noexcept |
| Default constructor. Sets the vector to the zero vector. | |
| constexpr | Vec2T (const Vec2T &u) noexcept=default |
| Copy constructor. | |
| constexpr | Vec2T (const T &a_x, const T &a_y) noexcept |
| Full constructor. | |
| ~Vec2T ()=default | |
| Destructor (does nothing) | |
| constexpr Vec2T< T > & | operator= (const Vec2T &a_other) noexcept=default |
| Assignment operator. | |
| constexpr Vec2T< T > | operator+ (const Vec2T &a_other) const noexcept |
| Addition operator. | |
| constexpr Vec2T< T > | operator- (const Vec2T &a_other) const noexcept |
| Subtraction operator. | |
| constexpr Vec2T< T > | operator- () const noexcept |
| Negation operator. | |
| constexpr Vec2T< T > | operator* (const T &s) const noexcept |
| Scalar multiplication operator. | |
| constexpr Vec2T< T > | operator/ (const T &s) const noexcept |
| Scalar division operator. | |
| constexpr Vec2T< T > & | operator+= (const Vec2T &a_other) noexcept |
| In-place addition operator. | |
| constexpr Vec2T< T > & | operator-= (const Vec2T &a_other) noexcept |
| In-place subtraction operator. | |
| constexpr Vec2T< T > & | operator*= (const T &s) noexcept |
| In-place scalar multiplication operator. | |
| constexpr Vec2T< T > & | operator/= (const T &s) noexcept |
| In-place scalar division operator. | |
| constexpr T | dot (const Vec2T &a_other) const noexcept |
| Dot product. | |
| constexpr T | length () const noexcept |
| Compute length of vector. | |
| constexpr T | length2 () const noexcept |
| Compute square of vector. | |
Static Public Member Functions | |
| static constexpr Vec2T< T > | zeros () noexcept |
| Return av vector with x = y = 0. | |
| static constexpr Vec2T< T > | ones () noexcept |
| Return a vector with x = y = 1. | |
| static constexpr Vec2T< T > | min () noexcept |
| Return the most-negative representable vector. | |
| static constexpr Vec2T< T > | max () noexcept |
| Return the most-positive representable vector. | |
| static constexpr Vec2T< T > | infinity () noexcept |
| Return a vector with infinite components. | |
Public Attributes | |
| T | x |
| First component in the vector. | |
| T | y |
| Second component in the vector. | |
Two-dimensional vector class with arithmetic operators.
The class has a public-only interface. To change it's components one can call the member functions, or set components directly, e.g. vec.x = 5.0
| T | Floating-point precision (float or double). |
|
constexprdefaultnoexcept |
Copy constructor.
| [in] | u | Other vector |
Sets *this = u
|
constexprnoexcept |
Full constructor.
| [in] | a_x | First vector component |
| [in] | a_y | Second vector component |
Sets this->x = a_x and this->y = a_y
|
inlineconstexprnoexcept |
Dot product.
| [in] | a_other | Other vector. |
|
inlinestaticconstexprnoexcept |
Return a vector with infinite components.
|
inlineconstexprnoexcept |
Compute length of vector.
|
inlineconstexprnoexcept |
Compute square of vector.
|
inlinestaticconstexprnoexcept |
Return the most-positive representable vector.
|
inlinestaticconstexprnoexcept |
Return the most-negative representable vector.
|
inlinestaticconstexprnoexcept |
Return a vector with x = y = 1.
|
inlineconstexprnoexcept |
Scalar multiplication operator.
| [in] | s | Scalar. |
|
inlineconstexprnoexcept |
In-place scalar multiplication operator.
| [in] | s | Scalar. |
|
inlineconstexprnoexcept |
Addition operator.
| [in] | a_other | Other vector. |
|
inlineconstexprnoexcept |
In-place addition operator.
| [in] | a_other | Other vector to add. |
|
inlineconstexprnoexcept |
Negation operator.
|
inlineconstexprnoexcept |
Subtraction operator.
| [in] | a_other | Other vector. |
|
inlineconstexprnoexcept |
In-place subtraction operator.
| [in] | a_other | Other vector to subtract. |
|
inlineconstexprnoexcept |
Scalar division operator.
| [in] | s | Scalar divisor. |
|
inlineconstexprnoexcept |
In-place scalar division operator.
| [in] | s | Scalar divisor. |
|
constexprdefaultnoexcept |
Assignment operator.
| [in] | a_other | Other vector. |
|
inlinestaticconstexprnoexcept |
Return av vector with x = y = 0.