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).
typedef T3DVector< double > | C3DDVector
| A double 3D Vector.
typedef T3DVector< float > | C3DFVector
| A float 3D Vector.

## 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.
template<class T>
bool | operator!= (const T3DVector< T > &a, const T3DVector< T > &b)
| comparison operator not equal
template<class T>
const T3DVector< T > | operator* (const T3DVector< T > &a, const T3DVector< T > &b)
| vector scalar product
template<class T>
const T3DVector< T > | operator* (const T3DVector< T > &a, double f)
| vector multiplication with scalar
template<class T>
const T3DVector< T > | operator* (double f, const T3DVector< T > &a)
| vector multiplication with scalar reverse order
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 addition
template<class T>
const T3DVector< T > | operator- (const T3DVector< T > &a, const T3DVector< T > &b)
| vector subtraction
template<class T>
const T3DVector< T > | operator/ (const T3DVector< T > &a, const T3DVector< T > &b)
template<class T>
const T3DVector< T > | operator/ (const T3DVector< T > &a, double f)
| vector division by scalar
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
template<class T>
std::ostream & | operator<< (std::ostream &os, const T3DVector< T > &v)
| stream output operator for 3DVector
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
template<class T>
bool | operator== (const T3DVector< T > &a, const T3DVector< T > &b)
| comparison operator equal
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
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
template<class T>
std::istream & | operator>> (std::istream &is, T3DVector< T > &v)
| stream input operator for 3DVector
template<class T>
const T3DVector< T > | operator^ (const T3DVector< T > &a, const T3DVector< T > &b)
| 3D vector cross product

## Variables

template<typename T>
T3DVector< T > | T3DVector< T >::_0 = T3DVector<T>(0, 0, 0)
template<typename T>
T3DVector< T > | T3DVector< T >::_1 = T3DVector<T>(1, 1, 1)

## Typedef Documentation

## C3DBounds

typedef T3DVector<unsigned int> C3DBounds

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

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

## C3DDVector

typedef T3DVector<double> C3DDVector

A double 3D Vector.

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

## C3DFVector

typedef T3DVector<float> C3DFVector

A float 3D Vector.

Definition at line 409 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 385 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 402 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 396 of file 3d/vector.hh.

References T3DVector< T >::norm().

Referenced by kmeans_step(), and kmeans_step_with_fixed_centers().

## operator!=()

template<class T>

bool operator!= | ( | const T3DVector< T > & | a,
|  | const T3DVector< T > & | b )

inline

comparison operator not equal

Definition at line 534 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 471 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 500 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 510 of file 3d/vector.hh.

## operator+() [1/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

  type | of the vector values

Parameters

  a |
  b |

Returns
  a+b

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

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

## operator+() [2/2]

template<class T>

const T3DVector< T > operator+ | ( | const T3DVector< T > & | a,
|  | const T3DVector< T > & | b )

inline

vector addition

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

## operator-()

template<class T>

const T3DVector< T > operator- | ( | const T3DVector< T > & | a,
|  | const T3DVector< T > & | b )

inline

vector subtraction

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

## operator/() [1/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 491 of file 3d/vector.hh.

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

## operator/() [2/2]

template<class T>

const T3DVector< T > operator/ | ( | const T3DVector< T > & | a,
|  | double | f )

inline

vector division by scalar

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

## 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 541 of file 3d/vector.hh.

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

## operator<<()

template<class T>

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

stream output operator for 3DVector

Definition at line 421 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 548 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 )

inline

comparison operator equal

Definition at line 527 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 555 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 562 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 429 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 518 of file 3d/vector.hh.

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

## Variable Documentation

## T3DVector< T >::_0

template<typename T>

T3DVector<T> T3DVector< T >::_0 = T3DVector<T>(0, 0, 0)

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

## T3DVector< T >::_1

template<typename T>

T3DVector<T> T3DVector< T >::_1 = T3DVector<T>(1, 1, 1)

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