soma-io
5.0.5
|
The template class to implement basic vectors. More...
#include <soma-io/vector/vector.h>
Public Member Functions | |
std::vector< T > | toStdVector () const |
Constructors and Destructor | |
AimsVector () | |
The constructor allocates an appropriate amount of memory. More... | |
AimsVector (const std::vector< T > &value) | |
AimsVector (const T &value) | |
The constructor fills the D items of vector with value. More... | |
AimsVector (const T value[]) | |
The constructor copy the D item of value[]. More... | |
AimsVector (const T &x, const T &y) | |
Constructor for D=2. More... | |
AimsVector (const T &x, const T &y, const T &z) | |
Constructor for D=3. More... | |
AimsVector (const T &x, const T &y, const T &z, const T &t) | |
Constructor for D=4. More... | |
AimsVector (const AimsVector< T, D > &other) | |
Copy constructor. More... | |
template<class U > | |
AimsVector (const AimsVector< U, D > &other) | |
Type conversion. More... | |
~AimsVector () | |
The destructor deletes the allocated memory space. More... | |
Manipulators and methods | |
AimsVector< T, D > & | operator= (const AimsVector< T, D > &other) |
AimsVector< T, D > & | operator+= (const AimsVector< T, D > &other) |
AimsVector< T, D > & | operator-= (const AimsVector< T, D > &other) |
AimsVector< T, D > & | operator*= (double val) |
AimsVector< T, D > & | operator/= (double val) |
AimsVector< T, D > & | normalize () |
const T & | item (int d) const |
Get a const reference to the dth item. More... | |
const T & | operator[] (int d) const |
Get a const reference to the dth item. More... | |
T & | item (int d) |
Get a non const reference to the dth item. More... | |
T & | operator[] (int d) |
Get a const reference to the dth item. More... | |
int | size () const |
bool | isNull () const |
Test if the vector is the null vector. More... | |
float | norm () const |
Return the magnitude of the vector. More... | |
float | norm2 () const |
Return the square magnitude of the vector. More... | |
double | dnorm () const |
Return the magnitude of the vector. More... | |
double | dnorm2 () const |
Return the square magnitude of the vector. More... | |
T | dot (const AimsVector< T, D > &other) const |
Get the dot product between 2 vectors. More... | |
Protected Attributes | |
T | _value [D] |
Memory space allocated. More... | |
Iterators | |
typedef T * | iterator |
typedef const T * | const_iterator |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
The template class to implement basic vectors.
The first template argument provides the type of stored items and the second template argument provides the size of the vector.
typedef const T* AimsVector< T, D >::const_iterator |
typedef T* AimsVector< T, D >::iterator |
|
inline |
The constructor allocates an appropriate amount of memory.
Definition at line 433 of file vector.h.
Referenced by operator!=().
|
inlineexplicit |
Definition at line 457 of file vector.h.
References AimsVector< T, D >::_value.
|
inline |
The constructor fills the D items of vector with value.
Definition at line 440 of file vector.h.
References AimsVector< T, D >::_value.
|
inlineexplicit |
The constructor copy the D item of value[].
Definition at line 449 of file vector.h.
References AimsVector< T, D >::_value.
|
inline |
Constructor for D=2.
Definition at line 584 of file vector.h.
References AimsVector< T, D >::_value, and internal::fill_aimsvector2< T, D >::doit().
|
inline |
Constructor for D=3.
Definition at line 592 of file vector.h.
References AimsVector< T, D >::_value, and internal::fill_aimsvector3< T, D >::doit().
|
inline |
Constructor for D=4.
Definition at line 600 of file vector.h.
References AimsVector< T, D >::_value, and internal::fill_aimsvector4< T, D >::doit().
|
inline |
|
inlineexplicit |
|
inline |
The destructor deletes the allocated memory space.
Definition at line 637 of file vector.h.
Referenced by operator!=().
|
inline |
Definition at line 202 of file vector.h.
References AimsVector< T, D >::_value.
|
inline |
Definition at line 203 of file vector.h.
References AimsVector< T, D >::_value.
|
inline |
Return the magnitude of the vector.
Definition at line 768 of file vector.h.
References AimsVector< T, D >::item().
Referenced by dnorm(), and operator!=().
|
inline |
Return the square magnitude of the vector.
Definition at line 778 of file vector.h.
References AimsVector< T, D >::item().
Referenced by dnorm2(), and operator!=().
|
inline |
Get the dot product between 2 vectors.
Definition at line 789 of file vector.h.
References AimsVector< T, D >::item().
Referenced by operator!=().
|
inline |
Definition at line 204 of file vector.h.
References AimsVector< T, D >::_value.
|
inline |
Definition at line 205 of file vector.h.
References AimsVector< T, D >::_value, and AimsVector< T, D >::toStdVector().
|
inline |
Test if the vector is the null vector.
Definition at line 738 of file vector.h.
References AimsVector< T, D >::_value.
Referenced by operator!=().
|
inline |
Get a const reference to the dth item.
Definition at line 696 of file vector.h.
References AimsVector< T, D >::_value, and ASSERT.
Referenced by AimsVector< T, D >::dnorm(), AimsVector< T, D >::dnorm2(), AimsVector< T, D >::dot(), AimsVector< T, D >::norm(), AimsVector< T, D >::norm2(), operator!=(), operator<<(), operator==(), operator>>(), and AimsVector< T, D >::toStdVector().
|
inline |
Get a non const reference to the dth item.
Definition at line 714 of file vector.h.
References AimsVector< T, D >::_value, and ASSERT.
|
inline |
Return the magnitude of the vector.
Definition at line 748 of file vector.h.
References AimsVector< T, D >::item().
Referenced by norm(), AimsVector< T, D >::normalize(), and operator!=().
|
inline |
Return the square magnitude of the vector.
Definition at line 758 of file vector.h.
References AimsVector< T, D >::item().
Referenced by norm2(), and operator!=().
|
inline |
Definition at line 684 of file vector.h.
References AimsVector< T, D >::norm(), and AimsVector< T, D >::operator/=().
Referenced by operator!=(), and soma::AffineTransformation3dBase::transformUnitNormal().
|
inline |
Definition at line 664 of file vector.h.
References AimsVector< T, D >::_value.
Referenced by operator!=().
|
inline |
Definition at line 644 of file vector.h.
References AimsVector< T, D >::_value.
Referenced by operator!=().
|
inline |
Definition at line 654 of file vector.h.
References AimsVector< T, D >::_value.
Referenced by operator!=().
|
inline |
Definition at line 674 of file vector.h.
References AimsVector< T, D >::_value.
Referenced by AimsVector< T, D >::normalize(), and operator!=().
|
inline |
Definition at line 625 of file vector.h.
References AimsVector< T, D >::_value.
Referenced by operator!=().
|
inline |
Get a const reference to the dth item.
Definition at line 705 of file vector.h.
References AimsVector< T, D >::_value, and ASSERT.
Referenced by operator!=().
|
inline |
Get a const reference to the dth item.
Definition at line 723 of file vector.h.
References AimsVector< T, D >::_value, and ASSERT.
|
inline |
Definition at line 731 of file vector.h.
Referenced by operator!=().
|
inline |
Definition at line 800 of file vector.h.
References AimsVector< T, D >::item().
Referenced by AimsVector< T, D >::end().
|
protected |
Memory space allocated.
Definition at line 212 of file vector.h.
Referenced by AimsVector< T, D >::AimsVector(), AimsVector< T, D >::begin(), internal::fill_aimsvector2< T, D >::doit(), internal::fill_aimsvector3< T, D >::doit(), internal::fill_aimsvector4< T, D >::doit(), AimsVector< T, D >::end(), AimsVector< T, D >::isNull(), AimsVector< T, D >::item(), AimsVector< T, D >::operator*=(), AimsVector< T, D >::operator+=(), AimsVector< T, D >::operator-=(), AimsVector< T, D >::operator/=(), AimsVector< T, D >::operator=(), and AimsVector< T, D >::operator[]().