|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Three-dimensional vector class with arithmetic operators. More...
#include <EBGeometry_Vec.hpp>

Public Member Functions | |
| constexpr | Vec3T () noexcept |
| Default constructor. Sets the vector to the zero vector. | |
| constexpr | Vec3T (const Vec3T< T > &a_u) noexcept=default |
| Copy constructor. | |
| constexpr | Vec3T (const T &a_x, const T &a_y, const T &a_z) noexcept |
| Full constructor. | |
| ~Vec3T () noexcept=default | |
| Destructor (does nothing) | |
| constexpr bool | lessLX (const Vec3T< T > &u) const noexcept |
| Lexicographic comparison (x first, then y, then z). | |
| constexpr T & | operator[] (size_t i) noexcept |
| Mutable element access. | |
| constexpr const T & | operator[] (size_t i) const noexcept |
| Const element access. | |
| constexpr bool | operator== (const Vec3T< T > &u) const noexcept |
| Equality comparison. | |
| constexpr bool | operator!= (const Vec3T< T > &u) const noexcept |
| Inequality comparison. | |
| constexpr bool | operator< (const Vec3T< T > &u) const noexcept |
| "Smaller than" operator. | |
| constexpr bool | operator> (const Vec3T< T > &u) const noexcept |
| "Greater than" operator. | |
| constexpr bool | operator<= (const Vec3T< T > &u) const noexcept |
| "Smaller or equal to" operator. | |
| constexpr bool | operator>= (const Vec3T< T > &u) const noexcept |
| "Greater or equal to" operator. | |
| constexpr Vec3T< T > & | operator= (const Vec3T< T > &u) noexcept=default |
| Assignment operator. | |
| constexpr Vec3T< T > | operator+ (const Vec3T< T > &u) const noexcept |
| Addition operator. | |
| constexpr Vec3T< T > | operator- (const Vec3T< T > &u) const noexcept |
| Subtraction operator. Returns a new vector with subtracted components. | |
| constexpr Vec3T< T > | operator+ () const noexcept |
| Identity operator. | |
| constexpr Vec3T< T > | operator- () const noexcept |
| Negation operator. | |
| constexpr Vec3T< T > | operator* (const T &s) const noexcept |
| Multiplication operator. Returns a vector with scalar multiplied components. | |
| constexpr Vec3T< T > | operator* (const Vec3T< T > &s) const noexcept |
| Component-wise multiplication operator. | |
| constexpr Vec3T< T > | operator/ (const T &s) const noexcept |
| Division operator. Returns a vector with scalar divided components. | |
| constexpr Vec3T< T > | operator/ (const Vec3T< T > &v) const noexcept |
| Component-wise division operator. | |
| constexpr Vec3T< T > & | operator+= (const Vec3T< T > &u) noexcept |
| Vector addition operator. | |
| constexpr Vec3T< T > & | operator-= (const Vec3T< T > &u) noexcept |
| Vector subtraction operator. | |
| constexpr Vec3T< T > & | operator*= (const T &s) noexcept |
| Vector multiplication operator. | |
| constexpr Vec3T< T > & | operator/= (const T &s) noexcept |
| Vector division operator. | |
| constexpr Vec3T< T > | cross (const Vec3T< T > &u) const noexcept |
| Vector cross product. | |
| constexpr T | dot (const Vec3T< T > &u) const noexcept |
| Vector dot product. | |
| size_t | minDir (const bool a_doAbs) const noexcept |
| Return the index of the smallest component (optionally by magnitude). | |
| size_t | maxDir (const bool a_doAbs) const noexcept |
| Return the direction which has the largest component (can be absolute) | |
| constexpr T | length () const noexcept |
| Compute vector length. | |
| constexpr T | length2 () const noexcept |
| Compute squared vector length. | |
Static Public Member Functions | |
| static constexpr Vec3T< T > | zeros () noexcept |
| Return a vector with x = y = z = 0. | |
| static constexpr Vec3T< T > | ones () noexcept |
| Return a vector with x = y = z = 1. | |
| static constexpr Vec3T< T > | unit (const size_t a_dir) noexcept |
| Return the unit basis vector for the given coordinate axis. | |
| static constexpr Vec3T< T > | min () noexcept |
| Return the most-negative representable vector. | |
| static constexpr Vec3T< T > | max () noexcept |
| Return the most-positive representable vector. | |
| static constexpr Vec3T< T > | infinity () noexcept |
| Return a vector with infinite components. | |
Protected Attributes | |
| std::array< T, 3 > | m_X |
| Vector components. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Vec3T< T > &vec) |
| Stream insertion operator. | |
Three-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] | a_u | Other vector |
Sets *this = u
|
constexprnoexcept |
Full constructor.
| [in] | a_x | First vector component |
| [in] | a_y | Second vector component |
| [in] | a_z | Third vector component |
Sets this->x = a_x, this->y = a_y, and this->z = a_z
|
inlineconstexprnoexcept |
Vector cross product.
| [in] | u | Other vector. |
|
inlineconstexprnoexcept |
Vector dot product.
| [in] | u | Other vector. |
|
inlinestaticconstexprnoexcept |
Return a vector with infinite components.
|
inlineconstexprnoexcept |
Compute vector length.
|
inlineconstexprnoexcept |
Compute squared vector length.
|
inlineconstexprnoexcept |
Lexicographic comparison (x first, then y, then z).
Returns true if this vector is lexicographically less than u, i.e. the first differing component of (*this) is less than the corresponding component of u.
| [in] | u | Other vector. |
|
inlinestaticconstexprnoexcept |
Return the most-positive representable vector.
|
inlinenoexcept |
Return the direction which has the largest component (can be absolute)
| [in] | a_doAbs | If true, evaluate component magnitudes rather than values. |
|
inlinestaticconstexprnoexcept |
Return the most-negative representable vector.
|
inlinenoexcept |
Return the index of the smallest component (optionally by magnitude).
| [in] | a_doAbs | If true, compare |X[i]| instead of X[i]. |
|
inlinestaticconstexprnoexcept |
Return a vector with x = y = z = 1.
|
inlineconstexprnoexcept |
Inequality comparison.
| [in] | u | Other vector. |
|
inlineconstexprnoexcept |
Multiplication operator. Returns a vector with scalar multiplied components.
| [in] | s | Scalar to multiply by |
|
inlineconstexprnoexcept |
Component-wise multiplication operator.
| [in] | s | Scalar to multiply by |
|
inlineconstexprnoexcept |
Vector multiplication operator.
| [in] | s | Scalar to multiply by |
|
inlineconstexprnoexcept |
Identity operator.
|
inlineconstexprnoexcept |
Addition operator.
| [in] | u | Other vector. |
|
inlineconstexprnoexcept |
Vector addition operator.
| [in] | u | Vector to add |
|
inlineconstexprnoexcept |
Negation operator.
|
inlineconstexprnoexcept |
Subtraction operator. Returns a new vector with subtracted components.
| [in] | u | Other vector |
|
inlineconstexprnoexcept |
Vector subtraction operator.
| [in] | u | Vector to subtraction |
|
inlineconstexprnoexcept |
Division operator. Returns a vector with scalar divided components.
| [in] | s | Scalar to divided by |
|
inlineconstexprnoexcept |
Component-wise division operator.
| [in] | v | Other vector |
|
inlineconstexprnoexcept |
Vector division operator.
| [in] | s | Scalar to divide by |
|
inlineconstexprnoexcept |
"Smaller than" operator.
Returns true if this->x < u.x AND this->y < u.y AND this->z < u.z and false otherwise
| [in] | u | Other vector |
|
inlineconstexprnoexcept |
"Smaller or equal to" operator.
Returns true if this->x <= u.x AND this->y <= u.y AND this->z <= u.z
| [in] | u | Other vector |
|
constexprdefaultnoexcept |
Assignment operator.
| [in] | u | Other vector. |
|
inlineconstexprnoexcept |
Equality comparison.
| [in] | u | Other vector. |
|
inlineconstexprnoexcept |
"Greater than" operator.
Returns true if this->x > u.x AND this->y > u.y AND this->z > u.z
| [in] | u | Other vector |
|
inlineconstexprnoexcept |
"Greater or equal to" operator.
Returns true if this->x >= u.x AND this->y >= u.y AND this->z >= u.z
| [in] | u | Other vector |
|
inlineconstexprnoexcept |
Const element access.
| [in] | i | Component index (0 = x, 1 = y, 2 = z). Must be < 3. |
|
inlineconstexprnoexcept |
Mutable element access.
| [in] | i | Component index (0 = x, 1 = y, 2 = z). Must be < 3. |
|
inlinestaticconstexprnoexcept |
Return the unit basis vector for the given coordinate axis.
| [in] | a_dir | Axis index (0 = x, 1 = y, 2 = z). |
|
inlinestaticconstexprnoexcept |
Return a vector with x = y = z = 0.
|
friend |
Stream insertion operator.
| [in,out] | os | Output stream. |
| [in] | vec | Vector to print. |