3d/vector.hh File Reference
#include <typeinfo>
#include <assert.h>
#include <stdexcept>
#include <math.h>
#include <complex>
#include <iostream>
#include <type_traits>
#include <mia/core/defines.hh>
#include <mia/core/type_traits.hh>
#include <mia/core/attributetype.hh>
#include <mia/3d/defines3d.hh>
Include dependency graph for 3d/vector.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  attribute_type< T3DVector< T > >
 
struct  EAttributeType_3d
 
struct  less_then< T3DVector< T > >
 
class  T3DVector< T >
 A simple 3D vector type. More...
 

Typedefs

typedef T3DVector< unsigned int > C3DBounds
 A unsinged int 3D Vector (used for 3D field sizes) More...
 
typedef T3DVector< double > C3DDVector
 A double 3D Vector. More...
 
typedef T3DVector< float > C3DFVector
 A float 3D Vector. More...
 

Functions

template<typename T >
T3DVector< T > cross (const T3DVector< T > &a, const T3DVector< T > &b)
 
template<class T >
double dot (const T3DVector< T > &a, const T3DVector< T > &b)
 
template<class T >
double fabs (const T3DVector< T > &t)
 A way to get the norm of a T3DVector using faba syntax. More...
 
template<class T >
bool operator!= (const T3DVector< T > &a, const T3DVector< T > &b)
 comparison operator not equal More...
 
template<class T >
const T3DVector< T > operator* (const T3DVector< T > &a, const T3DVector< T > &b)
 vector scalar product More...
 
template<class T >
const T3DVector< T > operator* (const T3DVector< T > &a, double f)
 vector multiplication with scalar More...
 
template<class T >
const T3DVector< T > operator* (double f, const T3DVector< T > &a)
 vector multiplication with scalar reverse order More...
 
template<class T >
const T3DVector< T > operator+ (const T3DVector< T > &a, const T3DVector< T > &b)
 vector addition More...
 
template<typename T , typename S >
T3DVector< T > operator+ (const T3DVector< T > &a, const T3DVector< S > &b)
 
template<class T >
const T3DVector< T > operator- (const T3DVector< T > &a, const T3DVector< T > &b)
 vector subtraction More...
 
template<class T >
const T3DVector< T > operator/ (const T3DVector< T > &a, double f)
 vector division by scalar More...
 
template<class T >
const T3DVector< T > operator/ (const T3DVector< T > &a, const T3DVector< T > &b)
 
template<class T >
bool operator< (const T3DVector< T > &a, const T3DVector< T > &b)
 comparison less, returns true if all components of a are less then those of b More...
 
template<class T >
std::ostream & operator<< (std::ostream &os, const T3DVector< T > &v)
 stream output operator for 3DVector More...
 
template<class T >
bool operator<= (const T3DVector< T > &b, const T3DVector< T > &a)
 comparison less or equal, returns true if all components of a are less or equal then those of b More...
 
template<class T >
bool operator== (const T3DVector< T > &a, const T3DVector< T > &b)
 comparison operator equal More...
 
template<class T >
bool operator> (const T3DVector< T > &b, const T3DVector< T > &a)
 comparison greater, returns true if all components of a are greater then those of b More...
 
template<class T >
bool operator>= (const T3DVector< T > &b, const T3DVector< T > &a)
 comparison greater or equal, returns true if all components of a are greater or equal then those of b More...
 
template<class T >
std::istream & operator>> (std::istream &is, T3DVector< T > &v)
 stream input operator for 3DVector More...
 
template<class T >
const T3DVector< T > operator^ (const T3DVector< T > &a, const T3DVector< T > &b)
 3D vector cross product More...
 

Typedef Documentation

◆ C3DBounds

typedef T3DVector<unsigned int> C3DBounds

A unsinged int 3D Vector (used for 3D field sizes)

Definition at line 352 of file 3d/vector.hh.

◆ C3DDVector

typedef T3DVector<double> C3DDVector

A double 3D Vector.

Definition at line 349 of file 3d/vector.hh.

◆ C3DFVector

typedef T3DVector<float> C3DFVector

A float 3D Vector.

Definition at line 346 of file 3d/vector.hh.

Function Documentation

◆ cross()

template<typename T >
T3DVector<T> cross ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)

Cross product of two 3D vectors

Parameters
a
b
Returns
cross product a x b

Definition at line 322 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ dot()

template<class T >
double dot ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
Returns
the dot product of input vectors a and b

Definition at line 339 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ fabs()

template<class T >
double fabs ( const T3DVector< T > &  t)

A way to get the norm of a T3DVector using faba syntax.

Definition at line 333 of file 3d/vector.hh.

References T3DVector< T >::norm().

Referenced by kmeans_step(), kmeans_step_with_fixed_centers(), and FMedianMAD::operator()().

◆ operator!=()

template<class T >
bool operator!= ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
inline

comparison operator not equal

Definition at line 469 of file 3d/vector.hh.

◆ operator*() [1/3]

template<class T >
const T3DVector<T> operator* ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
inline

vector scalar product

Definition at line 406 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ operator*() [2/3]

template<class T >
const T3DVector<T> operator* ( const T3DVector< T > &  a,
double  f 
)
inline

vector multiplication with scalar

Definition at line 435 of file 3d/vector.hh.

◆ operator*() [3/3]

template<class T >
const T3DVector<T> operator* ( double  f,
const T3DVector< T > &  a 
)
inline

vector multiplication with scalar reverse order

Definition at line 445 of file 3d/vector.hh.

◆ operator+() [1/2]

template<class T >
const T3DVector<T> operator+ ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
inline

vector addition

Definition at line 375 of file 3d/vector.hh.

◆ operator+() [2/2]

template<typename T , typename S >
T3DVector<T> operator+ ( const T3DVector< T > &  a,
const T3DVector< S > &  b 
)

Add operator for two 3D vectors that hold different data types Target type is taken from the lhs operator

Template Parameters
typeof the vector values
Parameters
a
b
Returns
a+b

Definition at line 390 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ operator-()

template<class T >
const T3DVector<T> operator- ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
inline

vector subtraction

Definition at line 398 of file 3d/vector.hh.

◆ operator/() [1/2]

template<class T >
const T3DVector<T> operator/ ( const T3DVector< T > &  a,
double  f 
)
inline

vector division by scalar

Definition at line 413 of file 3d/vector.hh.

◆ operator/() [2/2]

template<class T >
const T3DVector<T> operator/ ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
inline

component wise division of two vectors

Definition at line 426 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ operator<()

template<class T >
bool operator< ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)

comparison less, returns true if all components of a are less then those of b

Definition at line 476 of file 3d/vector.hh.

◆ operator<<()

template<class T >
std::ostream& operator<< ( std::ostream &  os,
const T3DVector< T > &  v 
)

stream output operator for 3DVector

Definition at line 358 of file 3d/vector.hh.

References T3DVector< T >::write().

◆ operator<=()

template<class T >
bool operator<= ( const T3DVector< T > &  b,
const T3DVector< T > &  a 
)

comparison less or equal, returns true if all components of a are less or equal then those of b

Definition at line 482 of file 3d/vector.hh.

◆ operator==()

template<class T >
bool operator== ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
inline

comparison operator equal

Definition at line 462 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ operator>()

template<class T >
bool operator> ( const T3DVector< T > &  b,
const T3DVector< T > &  a 
)

comparison greater, returns true if all components of a are greater then those of b

Definition at line 488 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ operator>=()

template<class T >
bool operator>= ( const T3DVector< T > &  b,
const T3DVector< T > &  a 
)

comparison greater or equal, returns true if all components of a are greater or equal then those of b

Definition at line 494 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

◆ operator>>()

template<class T >
std::istream& operator>> ( std::istream &  is,
T3DVector< T > &  v 
)

stream input operator for 3DVector

Definition at line 366 of file 3d/vector.hh.

References T3DVector< T >::read().

◆ operator^()

template<class T >
const T3DVector<T> operator^ ( const T3DVector< T > &  a,
const T3DVector< T > &  b 
)
inline

3D vector cross product

Definition at line 453 of file 3d/vector.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.