Loading...
Searching...
No Matches
jrlMathTools::Vector4D< T > Struct Template Reference

Generic 4D vector. More...

#include <jrl/mathtools/vector4.hh>

Public Member Functions

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

References m_w, m_x, m_y, and m_z.

Referenced by operator*(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator=(), operator=(), and operator==().

◆ 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

References m_w, m_x, m_y, and m_z.

Referenced by jrlMathTools::operator<<().

◆ norm()

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

Get the norm.

References m_w, m_x, m_y, and m_z.

◆ normalize()

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

Normalize.

References m_w, m_x, m_y, and m_z.

◆ normsquared()

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

Get the norm squared.

References m_w, m_x, m_y, and m_z.

◆ 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

Binary operator *.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator*=()

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

Binary operator *=.

References m_w, m_x, m_y, and m_z.

◆ operator+()

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

Binary operator +.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator+=()

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

Binary operator +=.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator-() [1/2]

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

Unary operator -.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator-() [2/2]

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

Binary operator -.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator-=()

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

Binary operator -=.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator/()

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

Binary operator /.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator/=()

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

Binary operator /=.

References m_w, m_x, m_y, and m_z.

◆ operator=() [1/2]

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

Assignement operator from vector3d.

Set last component to 1.

References m_w, jrlMathTools::Vector3D< T >::m_x, m_x, jrlMathTools::Vector3D< T >::m_y, m_y, jrlMathTools::Vector3D< T >::m_z, m_z, and Vector4D().

◆ operator=() [2/2]

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

Assignement operator.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator==()

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

Binary operator ==.

References m_w, m_x, m_y, m_z, and Vector4D().

◆ operator[]() [1/2]

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

Array operator.

References m_w, m_x, m_y, and m_z.

◆ operator[]() [2/2]

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

Array operator.

References m_w, m_x, m_y, and m_z.

Member Data Documentation

◆ m_w

◆ m_x

◆ m_y

◆ m_z