ULIS  dev4.0.7
Utility Library for Imaging Systems
Public Types | Public Member Functions | Public Attributes | List of all members
TVectorN< T, P, N > Class Template Reference

The TVectorN class provides a simple ND vector class for vector geometry applications. More...

Public Types

typedef P tComputation
 

Public Member Functions

constexpr TVectorN ()
 
template<typename U , typename Q , uint8 M>
constexpr TVectorN (const TVectorN< U, Q, M > &iOther)
 
constexpr TVectorN (std::initializer_list< T > iValues)
 
constexpr TVectorN (T iValue)
 
constexpr T * Data ()
 
constexpr const T * Data () const
 
constexpr tComputation Distance () const
 
constexpr tComputation DistanceSquared () const
 
constexpr tComputation DotProduct (const TVectorN< T, P, N > &iOther) const
 
constexpr tComputation ManhattanDistance () const
 
constexpr TVectorN< T, P, N > & Normalize ()
 
constexpr TVectorN< T, P, N > Normalized () const
 
constexpr bool operator!= (const TVectorN< T, P, N > &iOther) const
 
constexpr TVectorN< T, P, N > & operator*= (const TVectorN< T, P, N > &iOther)
 
constexpr TVectorN< T, P, N > & operator*= (T iValue)
 
constexpr TVectorN< T, P, N > & operator+= (const TVectorN< T, P, N > &iOther)
 
constexpr TVectorN< T, P, N > & operator+= (T iValue)
 
constexpr TVectorN< T, P, N > operator- () const
 
constexpr TVectorN< T, P, N > & operator-= (const TVectorN< T, P, N > &iOther)
 
constexpr TVectorN< T, P, N > & operator-= (T iValue)
 
constexpr TVectorN< T, P, N > & operator/= (const TVectorN< T, P, N > &iOther)
 
constexpr TVectorN< T, P, N > & operator/= (T iValue)
 
constexpr bool operator== (const TVectorN< T, P, N > &iOther) const
 
constexpr T & operator[] (int iIndex)
 
constexpr const T & operator[] (int iIndex) const
 
constexpr tComputation Sum () const
 

Public Attributes

m [N]
 

Detailed Description

template<typename T, typename P, uint8 N>
class TVectorN< T, P, N >

The TVectorN class is a template class that provides basic ND vector functionnalities, it can be used with any numeric types, ranging from integer values to floating point values.

Member Typedef Documentation

◆ tComputation

template<typename T , typename P , uint8 N>
typedef P TVectorN< T, P, N >::tComputation

Constructor & Destructor Documentation

◆ TVectorN() [1/4]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::TVectorN ( )
constexpr

Default constructor for the vector, with default zero values.

◆ TVectorN() [2/4]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::TVectorN ( iValue)
constexpr

Construct the vector from input value all components will have said value

◆ TVectorN() [3/4]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::TVectorN ( std::initializer_list< T >  iValues)
constexpr

Construct the vector from input values.

◆ TVectorN() [4/4]

template<typename T , typename P , uint8 N>
template<typename U , typename Q , uint8 M>
constexpr TVectorN< T, P, N >::TVectorN ( const TVectorN< U, Q, M > &  iOther)
constexpr

Construct the vector from input vector of any convertible type.

Member Function Documentation

◆ Data() [1/2]

template<typename T , typename P , uint8 N>
constexpr T * TVectorN< T, P, N >::Data ( )
constexpr

Return a pointer to the base storage.

◆ Data() [2/2]

template<typename T , typename P , uint8 N>
constexpr const T * TVectorN< T, P, N >::Data ( ) const
constexpr

Return a pointer to the base storage.

◆ Distance()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::tComputation TVectorN< T, P, N >::Distance ( ) const
constexpr

Return the euclidean distance of the vector.

◆ DistanceSquared()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::tComputation TVectorN< T, P, N >::DistanceSquared ( ) const
constexpr

Return the squared euclidean distance of the vector. This can be useful for testing against another squared distance, thus saving a square root calculation.

◆ DotProduct()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::tComputation TVectorN< T, P, N >::DotProduct ( const TVectorN< T, P, N > &  iOther) const
constexpr

Dot Product

◆ ManhattanDistance()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::tComputation TVectorN< T, P, N >::ManhattanDistance ( ) const
constexpr

Return the manhattan distance of the vector.

◆ Normalize()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::Normalize ( )
constexpr

Normalize this vector.

◆ Normalized()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > TVectorN< T, P, N >::Normalized ( ) const
constexpr

Return the normalized version of this vector.

◆ operator!=()

template<typename T , typename P , uint8 N>
constexpr bool TVectorN< T, P, N >::operator!= ( const TVectorN< T, P, N > &  iOther) const
constexpr

Compare this vector to the other vector for strict inequality.

◆ operator*=() [1/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator*= ( const TVectorN< T, P, N > &  iOther)
constexpr

Multiply this vector by the input vector and return a reference to this vector.

◆ operator*=() [2/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator*= ( iValue)
constexpr

Multiply this vector by the input value and return a reference to this vector.

◆ operator+=() [1/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator+= ( const TVectorN< T, P, N > &  iOther)
constexpr

Add the input to this vector and return a reference to this vector.

◆ operator+=() [2/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator+= ( iValue)
constexpr

Add the input value to this vector and return a reference to this vector.

◆ operator-()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > TVectorN< T, P, N >::operator- ( ) const
constexpr

Unary Negative Operator

◆ operator-=() [1/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator-= ( const TVectorN< T, P, N > &  iOther)
constexpr

Substract the input to this vector and return a reference to this vector.

◆ operator-=() [2/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator-= ( iValue)
constexpr

Substract the input value to this vector and return a reference to this vector.

◆ operator/=() [1/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator/= ( const TVectorN< T, P, N > &  iOther)
constexpr

Divide this vector by the input vector and return a reference to this vector.

◆ operator/=() [2/2]

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N > & TVectorN< T, P, N >::operator/= ( iValue)
constexpr

Divide this vector by the input value and return a reference to this vector.

◆ operator==()

template<typename T , typename P , uint8 N>
constexpr bool TVectorN< T, P, N >::operator== ( const TVectorN< T, P, N > &  iOther) const
constexpr

Compare this vector to the other vector for strict equality.

◆ operator[]() [1/2]

template<typename T , typename P , uint8 N>
constexpr T & TVectorN< T, P, N >::operator[] ( int  iIndex)
constexpr

Access component x or y by index, return a reference to the component.

◆ operator[]() [2/2]

template<typename T , typename P , uint8 N>
constexpr const T & TVectorN< T, P, N >::operator[] ( int  iIndex) const
constexpr

Access component x or y by index, return a const reference to the component.

◆ Sum()

template<typename T , typename P , uint8 N>
constexpr TVectorN< T, P, N >::tComputation TVectorN< T, P, N >::Sum ( ) const
constexpr

Return the horizontal sum of the vector.

Member Data Documentation

◆ m

template<typename T , typename P , uint8 N>
T TVectorN< T, P, N >::m[N]

The N elements of the N-Dimensional vector.