jrlMathTools::Vector4D< T > Struct Template Reference

Generic 4D vector. More...

#include <jrl/mathtools/vector4.hh>

Collaboration diagram for jrlMathTools::Vector4D< T >:

Public Member Functions

 Vector4D ()
 Default constructor: all fields are set to zero. More...
 
 Vector4D (const T &x, const T &y, const T &z, const T &w=1.)
 
Vector4D< T > operator= (const Vector4D< T > &v)
 Assignement operator. More...
 
Vector4D< T > operator= (const Vector3D< T > &v)
 Assignement operator from vector3d. More...
 
Vector4D< T > operator- ()
 Unary operator -. More...
 
T & operator[] (unsigned i)
 Array operator. More...
 
const T & operator[] (unsigned i) const
 Array operator. More...
 
T & operator() (unsigned i)
 Array operator. More...
 
operator() (unsigned i) const
 Array operator. More...
 
bool operator== (const Vector4D< T > &v) const
 Binary operator ==. More...
 
Vector4D< T > operator+ (const Vector4D< T > &v) const
 Binary operator +. More...
 
Vector4D< T > operator- (const Vector4D< T > &v) const
 Binary operator -. More...
 
void operator+= (const Vector4D< T > &v)
 Binary operator +=. More...
 
void operator-= (const Vector4D< T > &v)
 Binary operator -=. More...
 
Vector4D< T > operator* (const T &t) const
 Binary operator *. More...
 
Vector4D< T > operator/ (const T &t) const
 Binary operator /. More...
 
void operator*= (const T &t)
 Binary operator *=. More...
 
void operator/= (const T &t)
 Binary operator /=. More...
 
void normalize ()
 Normalize. More...
 
norm () const
 Get the norm. More...
 
normsquared () const
 Get the norm squared. More...
 
std::ostream & display (std::ostream &os) const
 

Public Attributes

m_x
 
m_y
 
m_z
 
m_w
 

Detailed Description

template<typename T>
struct jrlMathTools::Vector4D< T >

Generic 4D vector.

Constructor & Destructor Documentation

◆ Vector4D() [1/2]

template<typename T>
jrlMathTools::Vector4D< T >::Vector4D ( )
inline

Default constructor: all fields are set to zero.

◆ Vector4D() [2/2]

template<typename T>
jrlMathTools::Vector4D< T >::Vector4D ( const T &  x,
const T &  y,
const T &  z,
const T &  w = 1. 
)
inlineexplicit

Member Function Documentation

◆ display()

template<typename T>
std::ostream& jrlMathTools::Vector4D< T >::display ( std::ostream &  os) const
inline

◆ norm()

◆ normalize()

◆ normsquared()

template<typename T>
T jrlMathTools::Vector4D< T >::normsquared ( ) const
inline

◆ operator()() [1/2]

template<typename T>
T& jrlMathTools::Vector4D< T >::operator() ( unsigned  i)
inline

Array operator.

◆ operator()() [2/2]

template<typename T>
T jrlMathTools::Vector4D< T >::operator() ( unsigned  i) const
inline

Array operator.

◆ operator*()

template<typename T>
Vector4D<T> jrlMathTools::Vector4D< T >::operator* ( const T &  t) const
inline

◆ operator*=()

template<typename T>
void jrlMathTools::Vector4D< T >::operator*= ( const T &  t)
inline

◆ operator+()

template<typename T>
Vector4D<T> jrlMathTools::Vector4D< T >::operator+ ( const Vector4D< T > &  v) const
inline

◆ operator+=()

template<typename T>
void jrlMathTools::Vector4D< T >::operator+= ( const Vector4D< T > &  v)
inline

◆ operator-() [1/2]

◆ operator-() [2/2]

template<typename T>
Vector4D<T> jrlMathTools::Vector4D< T >::operator- ( const Vector4D< T > &  v) const
inline

◆ operator-=()

template<typename T>
void jrlMathTools::Vector4D< T >::operator-= ( const Vector4D< T > &  v)
inline

◆ operator/()

template<typename T>
Vector4D<T> jrlMathTools::Vector4D< T >::operator/ ( const T &  t) const
inline

◆ operator/=()

template<typename T>
void jrlMathTools::Vector4D< T >::operator/= ( const T &  t)
inline

◆ operator=() [1/2]

template<typename T>
Vector4D<T> jrlMathTools::Vector4D< T >::operator= ( const Vector4D< T > &  v)
inline

◆ operator=() [2/2]

◆ operator==()

template<typename T>
bool jrlMathTools::Vector4D< T >::operator== ( const Vector4D< T > &  v) const
inline

◆ operator[]() [1/2]

template<typename T>
T& jrlMathTools::Vector4D< T >::operator[] ( unsigned  i)
inline

◆ operator[]() [2/2]

template<typename T>
const T& jrlMathTools::Vector4D< T >::operator[] ( unsigned  i) const
inline

Member Data Documentation

◆ m_w

◆ m_x

◆ m_y

◆ m_z