EBGeometry 1.0
|
Three-dimensional vector class with arithmetic operators. More...
#include <EBGeometry_Vec.hpp>
Public Member Functions | |
Vec3T () noexcept | |
Default constructor. Sets the vector to the zero vector. | |
Vec3T (const Vec3T< T > &a_u) noexcept | |
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 |
Lexicographical comparison operator. This returns to true. | |
constexpr T & | operator[] (size_t i) noexcept |
Return component in vector. (i=0 => x and so on) | |
constexpr const T & | operator[] (size_t i) const noexcept |
Return non-modifiable component in vector. (i=0 => x and so on) | |
constexpr bool | operator== (const Vec3T< T > &u) const noexcept |
Comparison operator. Returns true if all components are the same. | |
constexpr bool | operator!= (const Vec3T< T > &u) const noexcept |
Comparison operator. Returns false if all components are the same. | |
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 |
Assignment operator. Sets components equal to the argument vector's components. | |
constexpr Vec3T< T > | operator+ (const Vec3T< T > &u) const noexcept |
Addition operator. Returns a new vector with added components. | |
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 |
Negation operator. Returns a vector with negated components. | |
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 > | min (const Vec3T< T > &u) noexcept |
Vector minimum function. Returns a new vector with componentwise minimums. | |
constexpr Vec3T< T > | max (const Vec3T< T > &u) noexcept |
Vector maximum function. Returns a new vector with componentwise maximums. | |
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 direction which has the smallest component (can be absolute) | |
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 vector length squared. | |
Static Public Member Functions | |
static constexpr Vec3T< T > | zero () noexcept |
Return av vector with x = y = z = 0. | |
static constexpr Vec3T< T > | one () noexcept |
Return av vector with x = y = z = 1. | |
static constexpr Vec3T< T > | unit (const size_t a_dir) noexcept |
Return av vector with x = y = z = 1. | |
static constexpr Vec3T< T > | min () noexcept |
Return a vector with minimum representable components. | |
static constexpr Vec3T< T > | max () noexcept |
Return a vector with maximum representable components. | |
static constexpr Vec3T< T > | infinity () noexcept |
Return a vector with inf components. | |
Protected Attributes | |
std::array< T, 3 > | m_X |
Vector components. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Vec3T< T > &vec) |
For outputting a vector to an output stream. | |
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
Copy constructor.
[in] | a_u | Other vector |
Sets *this = u
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
Vector cross product.
[in] | u | Other vector |
Vector dot product.
[in] | u | Other vector |
Compute vector length.
Compute vector length squared.
Lexicographical comparison operator. This returns to true.
[in] | u | Other vector. |
Vector maximum function. Returns a new vector with componentwise maximums.
[in] | u | Other vector |
Return the direction which has the largest component (can be absolute)
[in] | a_doAbs | If true, evaluate component magnitudes rather than values. |
Vector minimum function. Returns a new vector with componentwise minimums.
[in] | u | Other vector |
Return the direction which has the smallest component (can be absolute)
[in] | a_doAbs | If true, evaluate component magnitudes rather than values. |
Comparison operator. Returns false if all components are the same.
[in] | u | Other vector |
Multiplication operator. Returns a vector with scalar multiplied components.
[in] | s | Scalar to multiply by |
Component-wise multiplication operator.
[in] | s | Scalar to multiply by |
Vector multiplication operator.
[in] | s | Scalar to multiply by |
Addition operator. Returns a new vector with added components.
[in] | u | Other vector |
Subtraction operator. Returns a new vector with subtracted components.
[in] | u | Other vector |
Division operator. Returns a vector with scalar divided components.
[in] | s | Scalar to divided by |
Component-wise division operator.
[in] | v | Other vector |
Vector division operator.
[in] | s | Scalar to divide by |
"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 |
"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 |
Assignment operator. Sets components equal to the argument vector's components.
[in] | u | Other vector |
Comparison operator. Returns true if all components are the same.
[in] | u | Other vector |
"Greater than" operator.
Returns true if this->x > u.x AND this->y > u.y AND this->z > u.z
[in] | u | Other vector |
"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 |
Return non-modifiable component in vector. (i=0 => x and so on)
[in] | i | Index. Must be < 3 |
Return component in vector. (i=0 => x and so on)
[in] | i | Index. Must be < 3 |
Return av vector with x = y = z = 1.
[in] | a_dir | Dircetion |