atomicrex
0.1
An advanced atomistic model building tool
|
A vector with three components. More...
#include <Vector3.h>
Classes | |
struct | Zero |
An empty type that denotes the vector (0,0,0). More... | |
Public Member Functions | |
Vector_3 () | |
Constructs a vector without initializing its components. The components will have an undefined value! | |
constexpr | Vector_3 (T val) |
Constructs a vector with all three components initialized to the given value. | |
Related Functions | |
(Note that these are not member functions.) | |
using | Vector3 = Vector_3< FloatType > |
Instantiation of the Vector_3 class template with the default floating-point type. | |
using | Vector3I = Vector_3< int > |
Instantiation of the Vector_3 class template with the default integer type. | |
template<typename T > | |
constexpr Vector_3< T > | operator+ (const Vector_3< T > &a, const Vector_3< T > &b) |
Computes the sum of two vectors. More... | |
template<typename T > | |
constexpr Vector_3< T > | operator- (const Vector_3< T > &a, const Vector_3< T > &b) |
Computes the difference of two vectors. More... | |
template<typename T > | |
constexpr Vector_3< T > | operator* (const Vector_3< T > &a, T s) |
Computes the product of a vector and a scalar value. More... | |
template<typename T > | |
constexpr Vector_3< T > | operator* (T s, const Vector_3< T > &a) |
Computes the product of a scalar value and a vector. More... | |
template<typename T , typename S > | |
constexpr Vector_3< T > | operator/ (const Vector_3< T > &a, S s) |
Computes the division of a vector by a scalar value. More... | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &os, const Vector_3< T > &v) |
Writes a vector to a text output stream. More... | |
A vector with three components.
Vector_3 represents a vector in three-dimensional space. Note that there exists a corresponding class Point_3, which represents a point in three-dimensional space.
The template parameter T specifies the data type of the vector's components. Two standard instantiations of Vector_3 for floating-point and integer vectors are predefined:
Note that the default constructor does not initialize the components of the vector for performance reasons. The nested type Zero can be used to construct the vector (0,0,0):
Vector_3 derives from std::array<T,3>. Thus, the vector's components can be accessed via indices, but also via names:
Computes the product of a vector and a scalar value.
Computes the product of a scalar value and a vector.
|
related |
Computes the sum of two vectors.
|
related |
Computes the difference of two vectors.
|
related |
Computes the division of a vector by a scalar value.
|
related |
Writes a vector to a text output stream.