version 3.3

VRS::Vec< DIM, T > Class Template Reference

This template class represents a DIM component vector with component type T. More...

#include <vrs/vec.h>

List of all members.

Public Types

typedef T value_type
 STL style value_type declaration.

Public Member Functions

 Vec (T all=T(0))
 Initialize all components to the given value.
template<unsigned int DIM2, typename S>
 Vec (Vec< DIM2, S > const &other)
 Copy constructor with type conversion from type S to type T and possible component truncation, i.e., DIM2 must be equal or larger than DIM.
 Vec (T x, T y, T z, T w)
 Initialize all 4 components with individual values (only for Vec<4, T>).
 Vec (Vec< 3, T > const &xyz, T w)
 Initialize all 4 components with individual values (only for Vec<4, T>).
 Vec (T x, Vec< 3, T > const &yzw)
 Initialize all 4 components with individual values (only for Vec<4, T>).
 Vec (Vec< 2, T > const &xy, T z, T w)
 Initialize all 4 components with individual values (only for Vec<4, T>).
 Vec (Vec< 2, T > const &xy, Vec< 2, T > const &zw)
 Initialize all 4 components with individual values (only for Vec<4, T>).
 Vec (T x, T y, Vec< 2, T > const &zw)
 Initialize all 4 components with individual values (only for Vec<4, T>).
 Vec (T x, Vec< 2, T > const &yz, T w)
 Initialize all 4 components with individual values (only for Vec<4, T>).
 Vec (T x, T y, T z)
 Initialize all 3 components with individual values (only for Vec<3, T>).
 Vec (Vec< 2, T > const &xy, T z)
 Initialize all 3 components with individual values (only for Vec<3, T>).
 Vec (T x, Vec< 2, T > const &yz)
 Initialize all 3 components with individual values (only for Vec<3, T>).
 Vec (T x, T y)
 Initialize all 2 components with individual values (only for Vec<2, T>).
T const & operator[] (size_t index) const
 Gives direct read access to the index-th element of the vector.
T & operator[] (size_t index)
 Gives direct read/write access to the index-th element of the vector.
T const & x () const
 Gives direct read access to the x component of the vector.
T & x ()
 Gives direct read/write access to the x component of the vector.
T const & y () const
 Gives direct read access to the y component of the vector.
T & y ()
 Gives direct read/write access to the y component of the vector.
T const & z () const
 Gives direct read access to the z component of the vector.
T & z ()
 Gives direct read/write access to the z component of the vector.
T const & w () const
 Gives direct read access to the w component of the vector.
T & w ()
 Gives direct read/write access to the w component of the vector.
Vec< 2, T > xy () const
 Gives read access to the xy components of the vector.
Vec< 3, T > xyz () const
 Gives read access to the xyz components of the vector.
Vec< 4, T > xyzw () const
 Gives read access to the xyz components of the vector.
bool operator== (Vec< DIM, T > const &other) const
 Operator ==.
bool operator< (Vec< DIM, T > const &other) const
 Operator < (lexicographic ordering of the components).
Vec< DIM, T > & operator+= (Vec< DIM, T > const &other)
 Operator +=.
Vec< DIM, T > & operator-= (Vec< DIM, T > const &other)
 Operator -=.
Vec< DIM, T > & operator*= (Vec< DIM, T > const &other)
 Operator *=.
Vec< DIM, T > & operator/= (Vec< DIM, T > const &other)
 Operator /=.
Vec< DIM, T > & operator+= (T s)
 Operator +=.
Vec< DIM, T > & operator-= (T s)
 Operator -=.
Vec< DIM, T > & operator*= (T s)
 Operator *=.
Vec< DIM, T > & operator/= (T s)
 Operator /=.


Detailed Description

template<unsigned int DIM, typename T>
class VRS::Vec< DIM, T >

This template class represents a DIM component vector with component type T.

Implementation is based on GLSL found here: http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf


Member Typedef Documentation

template<unsigned int DIM, typename T>
typedef T VRS::Vec< DIM, T >::value_type

STL style value_type declaration.


Constructor & Destructor Documentation

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( all = T(0)  )  [inline, explicit]

Initialize all components to the given value.

template<unsigned int DIM, typename T>
template<unsigned int DIM2, typename S>
VRS::Vec< DIM, T >::Vec ( Vec< DIM2, S > const &  other  )  [inline, explicit]

Copy constructor with type conversion from type S to type T and possible component truncation, i.e., DIM2 must be equal or larger than DIM.

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( x,
y,
z,
w 
) [inline]

Initialize all 4 components with individual values (only for Vec<4, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( Vec< 3, T > const &  xyz,
w 
) [inline]

Initialize all 4 components with individual values (only for Vec<4, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( x,
Vec< 3, T > const &  yzw 
) [inline]

Initialize all 4 components with individual values (only for Vec<4, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( Vec< 2, T > const &  xy,
z,
w 
) [inline]

Initialize all 4 components with individual values (only for Vec<4, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( Vec< 2, T > const &  xy,
Vec< 2, T > const &  zw 
) [inline]

Initialize all 4 components with individual values (only for Vec<4, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( x,
y,
Vec< 2, T > const &  zw 
) [inline]

Initialize all 4 components with individual values (only for Vec<4, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( x,
Vec< 2, T > const &  yz,
w 
) [inline]

Initialize all 4 components with individual values (only for Vec<4, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( x,
y,
z 
) [inline]

Initialize all 3 components with individual values (only for Vec<3, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( Vec< 2, T > const &  xy,
z 
) [inline]

Initialize all 3 components with individual values (only for Vec<3, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( x,
Vec< 2, T > const &  yz 
) [inline]

Initialize all 3 components with individual values (only for Vec<3, T>).

template<unsigned int DIM, typename T>
VRS::Vec< DIM, T >::Vec ( x,
y 
) [inline]

Initialize all 2 components with individual values (only for Vec<2, T>).


Member Function Documentation

template<unsigned int DIM, typename T>
T const& VRS::Vec< DIM, T >::operator[] ( size_t  index  )  const [inline]

Gives direct read access to the index-th element of the vector.

template<unsigned int DIM, typename T>
T& VRS::Vec< DIM, T >::operator[] ( size_t  index  )  [inline]

Gives direct read/write access to the index-th element of the vector.

template<unsigned int DIM, typename T>
T const& VRS::Vec< DIM, T >::x (  )  const [inline]

Gives direct read access to the x component of the vector.

template<unsigned int DIM, typename T>
T& VRS::Vec< DIM, T >::x (  )  [inline]

Gives direct read/write access to the x component of the vector.

template<unsigned int DIM, typename T>
T const& VRS::Vec< DIM, T >::y (  )  const [inline]

Gives direct read access to the y component of the vector.

template<unsigned int DIM, typename T>
T& VRS::Vec< DIM, T >::y (  )  [inline]

Gives direct read/write access to the y component of the vector.

template<unsigned int DIM, typename T>
T const& VRS::Vec< DIM, T >::z (  )  const [inline]

Gives direct read access to the z component of the vector.

template<unsigned int DIM, typename T>
T& VRS::Vec< DIM, T >::z (  )  [inline]

Gives direct read/write access to the z component of the vector.

template<unsigned int DIM, typename T>
T const& VRS::Vec< DIM, T >::w (  )  const [inline]

Gives direct read access to the w component of the vector.

template<unsigned int DIM, typename T>
T& VRS::Vec< DIM, T >::w (  )  [inline]

Gives direct read/write access to the w component of the vector.

template<unsigned int DIM, typename T>
Vec<2, T> VRS::Vec< DIM, T >::xy (  )  const [inline]

Gives read access to the xy components of the vector.

template<unsigned int DIM, typename T>
Vec<3, T> VRS::Vec< DIM, T >::xyz (  )  const [inline]

Gives read access to the xyz components of the vector.

template<unsigned int DIM, typename T>
Vec<4, T> VRS::Vec< DIM, T >::xyzw (  )  const [inline]

Gives read access to the xyz components of the vector.

template<unsigned int DIM, typename T>
bool VRS::Vec< DIM, T >::operator== ( Vec< DIM, T > const &  other  )  const [inline]

Operator ==.

template<unsigned int DIM, typename T>
bool VRS::Vec< DIM, T >::operator< ( Vec< DIM, T > const &  other  )  const [inline]

Operator < (lexicographic ordering of the components).

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator+= ( Vec< DIM, T > const &  other  )  [inline]

Operator +=.

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator-= ( Vec< DIM, T > const &  other  )  [inline]

Operator -=.

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator*= ( Vec< DIM, T > const &  other  )  [inline]

Operator *=.

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator/= ( Vec< DIM, T > const &  other  )  [inline]

Operator /=.

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator+= ( s  )  [inline]

Operator +=.

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator-= ( s  )  [inline]

Operator -=.

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator*= ( s  )  [inline]

Operator *=.

template<unsigned int DIM, typename T>
Vec<DIM, T>& VRS::Vec< DIM, T >::operator/= ( s  )  [inline]

Operator /=.


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

Generated on Wed May 23 06:00:31 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact