A.I.M.S


AimsVector< T, D > Class Template Reference

The template class to implement basic vectors. More...

#include <aims/vector/vector.h>

Inheritance diagram for AimsVector< T, D >:
Collaboration diagram for AimsVector< T, D >:

Public Member Functions

Constructors and Destructor
 AimsVector ()
 The constructor allocates an appropriate amount of memory. More...
 
 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...
 
dot (const AimsVector< T, D > &other) const
 Get the dot product between 2 vectors. More...
 

Protected Attributes

_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
 

Detailed Description

template<class T, int D>
class AimsVector< T, D >

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.

Definition at line 48 of file vector.h.

Member Typedef Documentation

template<class T, int D>
typedef const T* AimsVector< T, D >::const_iterator

Definition at line 195 of file vector.h.

template<class T, int D>
typedef T* AimsVector< T, D >::iterator

Definition at line 194 of file vector.h.

Constructor & Destructor Documentation

template<class T , int D>
AimsVector< T, D >::AimsVector ( )
inline

The constructor allocates an appropriate amount of memory.

Definition at line 363 of file vector.h.

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T &  value)
inline

The constructor fills the D items of vector with value.

Definition at line 370 of file vector.h.

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T  value[])
inlineexplicit

The constructor copy the D item of value[].

Definition at line 379 of file vector.h.

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T &  x,
const T &  y 
)
inline

Constructor for D=2.

Definition at line 497 of file vector.h.

References internal::fill_aimsvector2< T, D >::doit().

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T &  x,
const T &  y,
const T &  z 
)
inline

Constructor for D=3.

Definition at line 505 of file vector.h.

References internal::fill_aimsvector3< T, D >::doit().

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T &  x,
const T &  y,
const T &  z,
const T &  t 
)
inline

Constructor for D=4.

Definition at line 513 of file vector.h.

References internal::fill_aimsvector4< T, D >::doit().

template<class T, int D>
AimsVector< T, D >::AimsVector ( const AimsVector< T, D > &  other)
inline

Copy constructor.

Definition at line 521 of file vector.h.

References AimsVector< T, D >::_value.

template<class T , int D>
template<class U >
AimsVector< T, D >::AimsVector ( const AimsVector< U, D > &  other)
inlineexplicit

Type conversion.

Definition at line 529 of file vector.h.

References AimsVector< T, D >::_value.

template<class T , int D>
AimsVector< T, D >::~AimsVector ( )
inline

The destructor deletes the allocated memory space.

Definition at line 550 of file vector.h.

Member Function Documentation

template<class T, int D>
iterator AimsVector< T, D >::begin ( )
inline

Definition at line 196 of file vector.h.

template<class T, int D>
const_iterator AimsVector< T, D >::begin ( ) const
inline

Definition at line 197 of file vector.h.

template<class T , int D>
double AimsVector< T, D >::dnorm ( ) const
inline

Return the magnitude of the vector.

Definition at line 677 of file vector.h.

Referenced by dnorm().

template<class T , int D>
double AimsVector< T, D >::dnorm2 ( ) const
inline

Return the square magnitude of the vector.

Definition at line 687 of file vector.h.

Referenced by dnorm2().

template<class T, int D>
T AimsVector< T, D >::dot ( const AimsVector< T, D > &  other) const
inline

Get the dot product between 2 vectors.

Definition at line 698 of file vector.h.

References AimsVector< T, D >::item().

Referenced by Trieder::dot(), and aims::SurfaceManip::sortPolygonsAlongDirection().

template<class T, int D>
iterator AimsVector< T, D >::end ( )
inline

Definition at line 198 of file vector.h.

template<class T, int D>
const_iterator AimsVector< T, D >::end ( ) const
inline

Definition at line 199 of file vector.h.

template<class T , int D>
bool AimsVector< T, D >::isNull ( ) const
inline

Test if the vector is the null vector.

Definition at line 647 of file vector.h.

template<class T , int D>
const T & AimsVector< T, D >::item ( int  d) const
inline
template<class T , int D>
T & AimsVector< T, D >::item ( int  d)
inline

Get a non const reference to the dth item.

Definition at line 623 of file vector.h.

References ASSERT.

template<class T , int D>
float AimsVector< T, D >::norm ( ) const
inline

Return the magnitude of the vector.

Definition at line 657 of file vector.h.

Referenced by norm(), and aims::SurfaceManip::rasterizeMeshWireframe().

template<class T , int D>
float AimsVector< T, D >::norm2 ( ) const
inline

Return the square magnitude of the vector.

Definition at line 667 of file vector.h.

Referenced by norm2().

template<class T , int D>
AimsVector< T, D > & AimsVector< T, D >::normalize ( )
inline
template<class T , int D>
AimsVector< T, D > & AimsVector< T, D >::operator*= ( double  val)
inline

Definition at line 577 of file vector.h.

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator+= ( const AimsVector< T, D > &  other)
inline

Definition at line 557 of file vector.h.

References AimsVector< T, D >::_value.

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator-= ( const AimsVector< T, D > &  other)
inline

Definition at line 567 of file vector.h.

References AimsVector< T, D >::_value.

template<class T , int D>
AimsVector< T, D > & AimsVector< T, D >::operator/= ( double  val)
inline

Definition at line 587 of file vector.h.

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator= ( const AimsVector< T, D > &  other)
inline

Definition at line 538 of file vector.h.

References AimsVector< T, D >::_value.

template<class T , int D>
const T & AimsVector< T, D >::operator[] ( int  d) const
inline

Get a const reference to the dth item.

Definition at line 614 of file vector.h.

References ASSERT.

template<class T , int D>
T & AimsVector< T, D >::operator[] ( int  d)
inline

Get a const reference to the dth item.

Definition at line 632 of file vector.h.

References ASSERT.

Member Data Documentation

template<class T, int D>
T AimsVector< T, D >::_value[D]
protected

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