HerdSoftware  0.1.1
Public Member Functions | Friends | List of all members
Herd::Vec3D Class Reference

A class describing a vector in 3D space. More...

#include <common/Vec3D.h>

Inheritance diagram for Herd::Vec3D:
Herd::CooArray< float > Herd::ArrayForwarder< float, 3 > Herd::FitDigitizationTools::MCFT::Vec2 Herd::PhysPoint

Public Member Functions

 Vec3D ()
 Default constructor. More...
 
 Vec3D (float x, float y, float z)
 Constructor. More...
 
 Vec3D (std::array< float, 3 > arr)
 Constructor. More...
 
 Vec3D (RefFrame::Direction direction)
 Constructs a 3D vector from a given direction. More...
 
void Dump () const
 Dumps the vector components. More...
 
float Mag () const
 Compute the vector magnitude. More...
 
Vec3D CrossProduct (const Vec3D &rhs)
 Compute the cross product of two vectors. More...
 
float PolarAngle () const
 Compute the polar angle. More...
 
float AzimuthAngle () const
 Compute the azimuth angle. More...
 
Vec3Doperator+= (Vec3D const &right)
 Add a vector to this one. More...
 
Vec3Doperator+= (Vec3D &&right)
 
Vec3D operator- (Vec3D const &right) const
 Subtract two vectors. More...
 
Vec3Doperator-= (Vec3D const &right)
 Subtract a vector from this one. More...
 
Vec3Doperator-= (Vec3D &&right)
 
template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3Doperator*= (T const &right)
 Multiply a vector by a number. More...
 
template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3Doperator*= (T &&right)
 
template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3Doperator/= (T const &right)
 Divide a vector by a number. More...
 
template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3Doperator/= (T &&right)
 
bool operator== (const Vec3D &right) const
 Comparison operator. More...
 
- Public Member Functions inherited from Herd::CooArray< float >
 CooArray ()
 Default constructor. More...
 
 CooArray (const CooArray< float > &c)
 Copy constructor. More...
 
 CooArray (V &&v1, V &&v2, V &&v3)
 Initializer list constructor. More...
 
 CooArray (const std::array< float, 3 > &values)
 Array constructors. More...
 
 CooArray (std::array< float, 3 > &&values)
 
CooArray< float > & operator= (const CooArray< float > &lhs)
 Assignment operator. More...
 
float & operator[] (const RefFrame::Coo &coo)
 Accesses an element without validity check on the element index. More...
 
const float & operator[] (const RefFrame::Coo &coo) const
 Accesses an element without validity check on the element index. More...
 
float & at (const RefFrame::Coo &coo)
 Accesses an element with validity check on the element index. More...
 
const float & at (const RefFrame::Coo &coo) const
 Accesses an element with validity check on the element index. More...
 
- Public Member Functions inherited from Herd::ArrayForwarder< float, 3 >
 ArrayForwarder ()
 
 ArrayForwarder (std::array< float, _Nm > arr)
 
void fill (const value_type &__u)
 
void swap (ArrayForwarder &__other) noexcept(noexcept(std::swap(std::declval< float & >(), std::declval< float & >())))
 
_GLIBCXX17_CONSTEXPR iterator begin () noexcept
 
_GLIBCXX17_CONSTEXPR const_iterator begin () const noexcept
 
_GLIBCXX17_CONSTEXPR iterator end () noexcept
 
_GLIBCXX17_CONSTEXPR const_iterator end () const noexcept
 
_GLIBCXX17_CONSTEXPR reverse_iterator rbegin () noexcept
 
_GLIBCXX17_CONSTEXPR const_reverse_iterator rbegin () const noexcept
 
_GLIBCXX17_CONSTEXPR reverse_iterator rend () noexcept
 
_GLIBCXX17_CONSTEXPR const_reverse_iterator rend () const noexcept
 
_GLIBCXX17_CONSTEXPR const_iterator cbegin () const noexcept
 
_GLIBCXX17_CONSTEXPR const_iterator cend () const noexcept
 
_GLIBCXX17_CONSTEXPR const_reverse_iterator crbegin () const noexcept
 
_GLIBCXX17_CONSTEXPR const_reverse_iterator crend () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr size_type max_size () const noexcept
 
constexpr bool empty () const noexcept
 
_GLIBCXX17_CONSTEXPR reference operator[] (size_type __n) noexcept
 
constexpr const_reference operator[] (size_type __n) const noexcept
 
_GLIBCXX17_CONSTEXPR reference at (size_type __n)
 
constexpr const_reference at (size_type __n) const
 
_GLIBCXX17_CONSTEXPR reference front () noexcept
 
constexpr const_reference front () const noexcept
 
_GLIBCXX17_CONSTEXPR reference back () noexcept
 
constexpr const_reference back () const noexcept
 
_GLIBCXX17_CONSTEXPR pointer data () noexcept
 
_GLIBCXX17_CONSTEXPR const_pointer data () const noexcept
 

Friends

std::ostream & operator<< (std::ostream &os, const Vec3D &vec)
 Write coordinates to stream. More...
 

Additional Inherited Members

- Public Types inherited from Herd::CooArray< float >
using BaseType = ArrayForwarder< float, 3 >
 
- Public Types inherited from Herd::ArrayForwarder< float, 3 >
typedef float value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef value_typeiterator
 
typedef const value_typeconst_iterator
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 
typedef std::reverse_iterator< iteratorreverse_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 

Detailed Description

A class describing a vector in 3D space.

The Vec3D class provides vector functionality in 3D space. It also provides some utility operations common on vectors: such as multiplication by a scalar and addition.

Constructor & Destructor Documentation

◆ Vec3D() [1/4]

Herd::Vec3D::Vec3D ( )
inline

Default constructor.

Creates a vector with undefined coordinates.

◆ Vec3D() [2/4]

Herd::Vec3D::Vec3D ( float  x,
float  y,
float  z 
)
inline

Constructor.

Creates a vector from three coordinates.

◆ Vec3D() [3/4]

Herd::Vec3D::Vec3D ( std::array< float, 3 >  arr)
inline

Constructor.

Creates a vector from a std::array.

◆ Vec3D() [4/4]

Herd::Vec3D::Vec3D ( RefFrame::Direction  direction)
inline

Constructs a 3D vector from a given direction.

Parameters
directionThe given direction.

Member Function Documentation

◆ AzimuthAngle()

float Herd::Vec3D::AzimuthAngle ( ) const
inline

Compute the azimuth angle.

Returns
The vector azimuth angle.

◆ CrossProduct()

Vec3D Herd::Vec3D::CrossProduct ( const Vec3D rhs)
inline

Compute the cross product of two vectors.

Computes the cross product between this vector (lhs) and the argument vector (rhs): lhs x rhs.

Parameters
rhsThe vector to compute the cross product with.
Returns
the cross product between this vector and rhs.

◆ Dump()

void Herd::Vec3D::Dump ( ) const
inline

Dumps the vector components.

◆ Mag()

float Herd::Vec3D::Mag ( ) const
inline

Compute the vector magnitude.

Returns
The vector magnitude.

◆ operator*=() [1/2]

template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3D& Herd::Vec3D::operator*= ( T const &  right)
inline

Multiply a vector by a number.

Returns
The resulting vector.

◆ operator*=() [2/2]

template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3D& Herd::Vec3D::operator*= ( T &&  right)
inline

◆ operator+=() [1/2]

Vec3D& Herd::Vec3D::operator+= ( Vec3D const &  right)
inline

Add a vector to this one.

Returns
The resulting vector.

◆ operator+=() [2/2]

Vec3D& Herd::Vec3D::operator+= ( Vec3D &&  right)
inline

◆ operator-()

Vec3D Herd::Vec3D::operator- ( Vec3D const &  right) const
inline

Subtract two vectors.

Returns
The resulting vector.

◆ operator-=() [1/2]

Vec3D& Herd::Vec3D::operator-= ( Vec3D const &  right)
inline

Subtract a vector from this one.

Returns
The resulting vector.

◆ operator-=() [2/2]

Vec3D& Herd::Vec3D::operator-= ( Vec3D &&  right)
inline

◆ operator/=() [1/2]

template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3D& Herd::Vec3D::operator/= ( T const &  right)
inline

Divide a vector by a number.

Returns
The resulting vector.

◆ operator/=() [2/2]

template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr>
Vec3D& Herd::Vec3D::operator/= ( T &&  right)
inline

◆ operator==()

bool Herd::Vec3D::operator== ( const Vec3D right) const
inline

Comparison operator.

Parameters
rightThe vector to compare with.
Returns
true if the coordinates of the two vectors are equal.

◆ PolarAngle()

float Herd::Vec3D::PolarAngle ( ) const
inline

Compute the polar angle.

Returns
The vector polar angle.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Vec3D vec 
)
friend

Write coordinates to stream.


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