Two-dimensional vector class with arithmetic operators.
More...
#include <EBGeometry_Vec.hpp>
|
static constexpr Vec2T< T > | zero () noexcept |
| Return av vector with x = y = 0.
|
|
static constexpr Vec2T< T > | one () noexcept |
| Return av vector with x = y = 1.
|
|
static constexpr Vec2T< T > | min () noexcept |
| Return minimum possible representative vector.
|
|
static constexpr Vec2T< T > | max () noexcept |
| Return maximum possible representative vector.
|
|
static constexpr Vec2T< T > | infinity () noexcept |
| Return a vector with inf components.
|
|
|
T | x |
| First component in the vector.
|
|
T | y |
| Second component in the vector.
|
|
template<typename T>
class Vec2T< T >
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
- Note
- Vec2T is a templated class primarily used with DCEL grids.
◆ Vec2T() [1/2]
Copy constructor.
- Parameters
-
Sets *this = u
◆ Vec2T() [2/2]
template<typename T >
constexpr Vec2T< T >::Vec2T |
( |
const T & |
a_x, |
|
|
const T & |
a_y |
|
) |
| |
|
constexpr |
Full constructor.
- Parameters
-
[in] | a_x | First vector component |
[in] | a_y | Second vector component |
Sets this->x = a_x and this->y = a_y
◆ dot()
template<typename T >
constexpr T Vec2T< T >::dot |
( |
const Vec2T< T > & |
a_other | ) |
const |
|
inlineconstexprnoexcept |
Dot product operator.
- Parameters
-
Returns the dot product, i.e. this->x*a_other.x + this->y+a_other.y
◆ length()
template<typename T >
constexpr T Vec2T< T >::length |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Compute length of vector.
- Returns
- Returns length of vector, i.e. sqrt[(this->x)*(this->x) + (this->y)*(this->y)]
◆ length2()
template<typename T >
constexpr T Vec2T< T >::length2 |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Compute square of vector.
- Returns
- Returns length of vector, i.e. (this->x)*(this->x) + (this->y)*(this->y)
◆ operator*()
template<typename T >
constexpr Vec2T<T> Vec2T< T >::operator* |
( |
const T & |
s | ) |
const |
|
inlineconstexprnoexcept |
Multiplication operator.
- Parameters
-
[in] | s | Scalar to be multiplied |
Returns a new Vec2T<T> with components x = s*this->x (and same for y)
◆ operator*=()
template<typename T >
constexpr Vec2T<T>& Vec2T< T >::operator*= |
( |
const T & |
s | ) |
|
|
inlineconstexprnoexcept |
Multiplication operator.
- Parameters
-
[in] | s | Scalar to multiply by |
Returns (*this) with components this->x = s*this->x (and same for y)
◆ operator+()
template<typename T >
constexpr Vec2T<T> Vec2T< T >::operator+ |
( |
const Vec2T< T > & |
a_other | ) |
const |
|
inlineconstexprnoexcept |
Addition operator.
- Parameters
-
Returns a new object with component x = this->x + a_other.x (same for y-component)
◆ operator+=()
Addition operator.
- Parameters
-
[in] | a_other | Other vector to add |
Returns (*this) with components this->x = this->x + a_other.x (and same for y)
◆ operator-()
template<typename T >
constexpr Vec2T<T> Vec2T< T >::operator- |
( |
const Vec2T< T > & |
a_other | ) |
const |
|
inlineconstexprnoexcept |
Subtraction operator.
- Parameters
-
Returns a new object with component x = this->x - a_other.x (same for y-component)
◆ operator-=()
Subtraction operator.
- Parameters
-
[in] | a_other | Other vector to subtract |
Returns (*this) with components this->x = this->x - a_other.x (and same for y)
◆ operator/()
template<typename T >
constexpr Vec2T<T> Vec2T< T >::operator/ |
( |
const T & |
s | ) |
const |
|
inlineconstexprnoexcept |
Division operator.
- Parameters
-
[in] | s | Scalar to be multiplied |
Returns a new Vec2T<T> with components x = (1/s)*this->x (and same for y)
◆ operator/=()
template<typename T >
constexpr Vec2T<T>& Vec2T< T >::operator/= |
( |
const T & |
s | ) |
|
|
inlineconstexprnoexcept |
Division operator operator.
- Parameters
-
Returns (*this) with components this->x = (1/s)*this->x (and same for y)
◆ operator=()
Assignment operator. Sets this.x = a_other.x and this.y = a_other.y.
- Parameters
-
The documentation for this class was generated from the following file: