atomicrex  0.1
An advanced atomistic model building tool
Classes | Public Member Functions | Related Functions | List of all members
atomicrex::Vector_3< T > Class Template Reference

A vector with three components. More...

#include <Vector3.h>

Inheritance diagram for atomicrex::Vector_3< T >:

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...
 

Detailed Description

template<typename T>
class atomicrex::Vector_3< T >

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:

typedef Vector_3<FloatType> Vector3;
typedef Vector_3<int> Vector3I;

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):

Vector3 v = Vector3::Zero()

Vector_3 derives from std::array<T,3>. Thus, the vector's components can be accessed via indices, but also via names:

v[1] = 10.0f;
v.y() = 10.0f;
See also
Point_3

Friends And Related Function Documentation

◆ operator*() [1/2]

template<typename T >
constexpr Vector_3< T > operator* ( const Vector_3< T > &  a,
s 
)
related

Computes the product of a vector and a scalar value.

◆ operator*() [2/2]

template<typename T >
constexpr Vector_3< T > operator* ( s,
const Vector_3< T > &  a 
)
related

Computes the product of a scalar value and a vector.

◆ operator+()

template<typename T >
constexpr Vector_3< T > operator+ ( const Vector_3< T > &  a,
const Vector_3< T > &  b 
)
related

Computes the sum of two vectors.

◆ operator-()

template<typename T >
constexpr Vector_3< T > operator- ( const Vector_3< T > &  a,
const Vector_3< T > &  b 
)
related

Computes the difference of two vectors.

◆ operator/()

template<typename T , typename S >
constexpr Vector_3< T > operator/ ( const Vector_3< T > &  a,
s 
)
related

Computes the division of a vector by a scalar value.

◆ operator<<()

template<typename T >
std::ostream & operator<< ( std::ostream &  os,
const Vector_3< T > &  v 
)
related

Writes a vector to a text output stream.


The documentation for this class was generated from the following file: