T3DVector< T > Class Template Reference
Basic data strctures and functions

A simple 3D vector type. More...

`#include <mia/3d/vector.hh>`

Inheritance diagram for T3DVector< T >:
[legend]

## Public Types

typedef T | value_type
| typedef for generic programming

## Public Member Functions

void | fill (T v)
| Fill the vector elements with value v.
double | norm () const
double | norm2 () const
| square of Euclidian norm of the vector
T3DVector< T > & | operator*= (const double a)
| inplace multiplication
T3DVector< T > & | operator*= (const T3DVector< T > &a)
| inplace component wise multiplication
T3DVector< T > & | operator+= (const T3DVector< T > &a)
| inplace addition
T3DVector | operator- () const
T3DVector< T > & | operator-= (const T3DVector< T > &a)
| inplace subtraction
T3DVector< T > & | operator/= (const double a)
| inplace divisison by a scalar
template<class in>
T3DVector< T > & | operator= (const T3DVector< in > &org)
| assignment from different vector type
T3DVector< T > & | operator= (const T3DVector< T > &other)=default
| we provide the default copy mechanisms
T & | operator[] (size_t i)
const T | operator[] (size_t i) const
double | product () const
void | read (std::istream &is)
| read the vector from a formatted string
int | size () const
| T3DVector ()
| standart constructor
| T3DVector (const T &x_, const T &y_, const T &z_)
| constructor to construct vector from values
template<class in>
| T3DVector (const T3DVector< in > &org)
| type casting copy constructor
| T3DVector (const T3DVector< T > &other)=default
| we provide the default copy mechanisms
| T3DVector (int dim)
| create a zero-vector, dim must be 3
void | write (std::ostream &os) const
| print out the formatted vector to the stream
const T3DVector< T > & | xyz () const
| swizzle operator
const T3DVector< T > | xzy () const
| swizzle operator
const T3DVector< T > | yxz () const
| swizzle operator
const T3DVector< T > | yzx () const
| swizzle operator
const T3DVector< T > | zxy () const
| swizzle operator
const T3DVector< T > | zyx () const
| swizzle operator

## Data Fields

T | x
| vector element
T | y
| vector element
T | z
| vector element

## Static Public Attributes

static T3DVector< T > | _0
| declare the vector (0,0,0)
static T3DVector< T > | _1
| declare the vector (1,1,1)
static const unsigned int | elements
| the number of elements this vector holds (=3)

## Detailed Description

template<class T>
class T3DVector< T >

A simple 3D vector type.

This class is the template for a 3D vector that provides support for some common operators.

Template Parameters

  T | element type

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

## Member Typedef Documentation

## value_type

template<class T>

typedef T T3DVector< T >::value_type

typedef for generic programming

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

## Constructor & Destructor Documentation

## T3DVector() [1/5]

template<class T>

T3DVector< T >::T3DVector | ( |  | ) |

inline

standart constructor

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

Referenced by T3DMatrix< float >::diagonal(), T3DMatrix< float >::get_eigenvalues(), T3DMatrix< float >::get_real_eigenvector(), T3DVector< std::complex< T > >::operator-(), T3DMatrix< float >::T3DMatrix(), T3DMatrix< float >::T3DMatrix(), T3DVector< std::complex< T > >::xzy(), T3DVector< std::complex< T > >::yxz(), T3DVector< std::complex< T > >::yzx(), T3DVector< std::complex< T > >::zxy(), and T3DVector< std::complex< T > >::zyx().

## T3DVector() [2/5]

template<class T>

T3DVector< T >::T3DVector | ( | int | dim | ) |

inline explicit

create a zero-vector, dim must be 3

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

## T3DVector() [3/5]

template<class T>

T3DVector< T >::T3DVector | ( | const T3DVector< T > & | other | ) |

default

we provide the default copy mechanisms

## T3DVector() [4/5]

template<class T>

T3DVector< T >::T3DVector | ( | const T & | x_,
|  | const T & | y_,
|  | const T & | z_ )

inline

constructor to construct vector from values

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

## T3DVector() [5/5]

template<class T>
template<class in>

T3DVector< T >::T3DVector | ( | const T3DVector< in > & | org | ) |

inline explicit

type casting copy constructor

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

## Member Function Documentation

## fill()

template<class T>

void T3DVector< T >::fill | ( | T | v | ) |

inline

Fill the vector elements with value v.

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

## norm()

template<class T>

double T3DVector< T >::norm | ( |  | ) | const

inline

Returns
  the Euclidian norm of the vector

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

Referenced by fabs().

## norm2()

template<class T>

double T3DVector< T >::norm2 | ( |  | ) | const

inline

square of Euclidian norm of the vector

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

Referenced by T3DVector< std::complex< T > >::norm().

## operator*=() [1/2]

template<class T>

T3DVector< T > & T3DVector< T >::operator*= | ( | const double | a | ) |

inline

inplace multiplication

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

## operator*=() [2/2]

template<class T>

T3DVector< T > & T3DVector< T >::operator*= | ( | const T3DVector< T > & | a | ) |

inline

inplace component wise multiplication

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

## operator+=()

template<class T>

T3DVector< T > & T3DVector< T >::operator+= | ( | const T3DVector< T > & | a | ) |

inline

inplace addition

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

## operator-()

template<class T>

T3DVector T3DVector< T >::operator- | ( |  | ) | const

inline

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

## operator-=()

template<class T>

T3DVector< T > & T3DVector< T >::operator-= | ( | const T3DVector< T > & | a | ) |

inline

inplace subtraction

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

## operator/=()

template<class T>

T3DVector< T > & T3DVector< T >::operator/= | ( | const double | a | ) |

inline

inplace divisison by a scalar

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

## operator=() [1/2]

template<class T>
template<class in>

T3DVector< T > & T3DVector< T >::operator= | ( | const T3DVector< in > & | org | ) |

inline

assignment from different vector type

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

## operator=() [2/2]

template<class T>

T3DVector< T > & T3DVector< T >::operator= | ( | const T3DVector< T > & | other | ) |

default

we provide the default copy mechanisms

## operator[]() [1/2]

template<class T>

T & T3DVector< T >::operator[] | ( | size_t | i | ) |

inline

Implement the writable operator [] for this type of vector

Parameters

  i | index

Returns
  reference value at index

Remarks
  the performance of this needs to be analyzed. The compiler should be able to translate this to a simple memory access.

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

## operator[]() [2/2]

template<class T>

const T T3DVector< T >::operator[] | ( | size_t | i | ) | const

inline

Implement the const operator [] for this type of vector

Parameters

  i | index

Returns
  value at index

Remarks
  the performance of this needs to be analyzed. The compiler should be able to translate this to a simple memory access.

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

## product()

template<class T>

double T3DVector< T >::product | ( |  | ) | const

inline

Returns
  the product of the vector components

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

## read()

template<class T>

void T3DVector< T >::read | ( | std::istream & | is | ) |

inline

read the vector from a formatted string

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

Referenced by operator>>().

## size()

template<class T>

int T3DVector< T >::size | ( |  | ) | const

inline

Returns
  the dimension of vector (always 3)

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

## write()

template<class T>

void T3DVector< T >::write | ( | std::ostream & | os | ) | const

inline

print out the formatted vector to the stream

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

Referenced by operator<<().

## xyz()

template<class T>

const T3DVector< T > & T3DVector< T >::xyz | ( |  | ) | const

inline

swizzle operator

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

## xzy()

template<class T>

const T3DVector< T > T3DVector< T >::xzy | ( |  | ) | const

inline

swizzle operator

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

## yxz()

template<class T>

const T3DVector< T > T3DVector< T >::yxz | ( |  | ) | const

inline

swizzle operator

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

## yzx()

template<class T>

const T3DVector< T > T3DVector< T >::yzx | ( |  | ) | const

inline

swizzle operator

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

## zxy()

template<class T>

const T3DVector< T > T3DVector< T >::zxy | ( |  | ) | const

inline

swizzle operator

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

## zyx()

template<class T>

const T3DVector< T > T3DVector< T >::zyx | ( |  | ) | const

inline

swizzle operator

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

## Field Documentation

## _0

template<class T>

T3DVector<T> T3DVector< T >::_0

static

declare the vector (0,0,0)

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

## _1

template<class T>

T3DVector<T> T3DVector< T >::_1

static

declare the vector (1,1,1)

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

## elements

template<class T>

const unsigned int T3DVector< T >::elements

static

the number of elements this vector holds (=3)

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

## x

template<class T>

T T3DVector< T >::x

vector element

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

Referenced by cross(), dot(), T3DDatafield< T >::get_gradient(), T3DDatafield< T >::get_gradient(), T3DDatafield< T >::get_gradient(), less_then< T3DVector< T > >::operator()(), range_iterator< T >::operator()(), range_iterator< T >::operator()(), T3DImage< bool >::operator()(), T3DImage< bool >::operator()(), operator*(), operator*(), operator*(), operator*(), T3DVector< std::complex< T > >::operator*=(), operator+(), T3DVector< std::complex< T > >::operator+=(), T3DMatrix< T >::operator-=(), T3DVector< std::complex< T > >::operator-=(), operator/(), operator<(), operator<=(), T3DVector< std::complex< T > >::operator=(), operator==(), operator>(), operator>=(), operator^(), and T3DMatrix< float >::T3DMatrix().

## y

template<class T>

T T3DVector< T >::y

vector element

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

Referenced by cross(), dot(), T3DDatafield< T >::get_gradient(), less_then< T3DVector< T > >::operator()(), range_iterator< T >::operator()(), range_iterator< T >::operator()(), T3DImage< bool >::operator()(), T3DImage< bool >::operator()(), operator*(), operator*(), operator*(), operator*(), T3DVector< std::complex< T > >::operator*=(), operator+(), T3DVector< std::complex< T > >::operator+=(), T3DMatrix< T >::operator-=(), T3DVector< std::complex< T > >::operator-=(), operator/(), operator<(), operator<=(), T3DVector< std::complex< T > >::operator=(), operator==(), operator>(), operator>=(), operator^(), and T3DMatrix< float >::T3DMatrix().

## z

template<class T>

T T3DVector< T >::z

vector element

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

Referenced by cross(), dot(), T3DDatafield< T >::get_gradient(), FDeformer3D::operator()(), less_then< T3DVector< T > >::operator()(), range_iterator< T >::operator()(), range_iterator< T >::operator()(), T3DImage< bool >::operator()(), T3DImage< bool >::operator()(), operator*(), operator*(), operator*(), operator*(), T3DVector< std::complex< T > >::operator*=(), operator+(), T3DVector< std::complex< T > >::operator+=(), T3DMatrix< T >::operator-=(), T3DVector< std::complex< T > >::operator-=(), operator/(), operator<(), operator<=(), T3DVector< std::complex< T > >::operator=(), operator==(), operator>(), operator>=(), operator^(), and T3DMatrix< float >::T3DMatrix().

The documentation for this class was generated from the following file:

- 3d/vector.hh