vmmlib  1.9.0
Templatized C++ vector and matrix math library
vmml::vector< M, T > Class Template Reference
+ Collaboration diagram for vmml::vector< M, T >:

Public Types

typedef T value_type
 
typedef T * iterator
 
typedef const T * const_iterator
 
typedef std::reverse_iterator< iterator > reverse_iterator
 
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
 

Public Member Functions

 vector (const T &a)
 
 vector (const T &x, const T &y)
 
 vector (const T &x, const T &y, const T &z)
 
 vector (const T &x, const T &y, const T &z, const T &w)
 
 vector (const vector< M-1, T > &vector_, T last_)
 
 vector (const T *values)
 
template<size_t N>
 vector (const vector< N, T > &source_, typename enable_if< N==M-1 >::type *=0)
 
template<size_t N>
 vector (const vector< N, T > &source_, typename enable_if< N==M+1 >::type *=0)
 
template<typename U >
 vector (const vector< M, U > &source_)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
 operator T * ()
 
 operator const T * () const
 
T & operator() (size_t index)
 
const T & operator() (size_t index) const
 
T & at (size_t index)
 
const T & at (size_t index) const
 
T & x ()
 
T & y ()
 
T & z ()
 
T & w ()
 
const T & x () const
 
const T & y () const
 
const T & z () const
 
const T & w () const
 
T & r ()
 
T & g ()
 
T & b ()
 
T & a ()
 
const T & r () const
 
const T & g () const
 
const T & b () const
 
const T & a () const
 
bool operator== (const vector &other) const
 
bool operator!= (const vector &other) const
 
bool equals (const vector &other, T tolerance=std::numeric_limits< T >::epsilon()) const
 
bool operator< (const vector &other) const
 
vectoroperator= (const T *c_array)
 
operator= (T filler)
 
vectoroperator= (const vector &other)
 
template<typename U >
void operator= (const vector< M, U > &other)
 
template<size_t N>
enable_if< N==M-1 >::type * operator= (const vector< N, T > &source_)
 
template<size_t N>
enable_if< N==M+1 >::type * operator= (const vector< N, T > &source_)
 
vector operator* (const vector &other) const
 
vector operator/ (const vector &other) const
 
vector operator+ (const vector &other) const
 
vector operator- (const vector &other) const
 
void operator*= (const vector &other)
 
void operator/= (const vector &other)
 
void operator+= (const vector &other)
 
void operator-= (const vector &other)
 
vector operator* (const T other) const
 
vector operator/ (const T other) const
 
vector operator+ (const T other) const
 
vector operator- (const T other) const
 
void operator*= (const T other)
 
void operator/= (const T other)
 
void operator+= (const T other)
 
void operator-= (const T other)
 
vector operator- () const
 
const vectornegate ()
 
void set (T a)
 
void set (const vector< M-1, T > &v, T a)
 
template<size_t N>
void set (const vector< N, T > &v)
 
void set (T x, T y)
 
void set (T x, T y, T z)
 
void set (T x, T y, T z, T w)
 
template<typename input_iterator_t >
void iter_set (input_iterator_t begin_, input_iterator_t end_)
 
template<typename TT >
vector cross (const vector< M, TT > &rhs, typename enable_if< M==3, TT >::type *=0) const
 
template<typename TT >
void cross (const vector< M, TT > &a, const vector< M, TT > &b, typename enable_if< M==3, TT >::type *=0)
 
dot (const vector &other) const
 
normalize ()
 
void set_random (int seed=-1)
 
length () const
 
squared_length () const
 
distance (const vector &other) const
 
squared_distance (const vector &other) const
 
product () const
 
template<typename TT >
vector< 3, T > rotate (const T theta, vector< M, TT > axis, typename enable_if< M==3, TT >::type *=0) const
 
void compute_normal (const vector &v0, const vector &v1, const vector &v2)
 
vector compute_normal (const vector &v1, const vector &v2) const
 
template<size_t N>
vector< N, T > & get_sub_vector (size_t offset=0, typename enable_if< M >=N >::type *=0)
 
template<size_t N>
const vector< N, T > & get_sub_vector (size_t offset=0, typename enable_if< M >=N >::type *=0) const
 
template<typename TT >
vector< 3, T > project_point_onto_sphere (const vector< 3, TT > &point, typename enable_if< M==4, TT >::type *=0) const
 
template<typename TT >
distance_to_sphere (const vector< 3, TT > &point, typename enable_if< M==4, TT >::type *=0) const
 
template<typename TT >
distance_to_plane (const vector< 3, TT > &point, typename enable_if< M==4, TT >::type *=0) const
 
template<typename TT >
vector< 3, T > project_point_onto_plane (const vector< 3, TT > &point, typename enable_if< M==4, TT >::type *=0) const
 
size_t find_min_index () const
 
size_t find_max_index () const
 
size_t find_abs_min_index () const
 
size_t find_abs_max_index () const
 
T & find_min ()
 
T & find_max ()
 
const T & find_min () const
 
const T & find_max () const
 
void clamp (const T &min=0.0, const T &max=1.0)
 
template<typename TT >
void scale_to (vector< M, TT > &scaled_vector, T min_value=-1.0, T max_value=1.0) const
 
bool is_unit_vector () const
 
void perturb (T perturbation=0.0001)
 
void sqrt_elementwise ()
 
double norm () const
 
void reciprocal ()
 
void reciprocal_safe ()
 
template<typename TT >
void cast_from (const vector< M, TT > &other)
 
size_t nnz () const
 
template<typename TT >
vector< M, T > cross (const vector< M, TT > &rhs, typename enable_if< M==3, TT >::type *) const
 
template<size_t N>
enable_if< N==M-1 >::type * operator= (const vector< N, T > &source_)
 
template<size_t N>
enable_if< N==M+1 >::type * operator= (const vector< N, T > &source_)
 

Static Public Member Functions

static size_t size ()
 

Public Attributes

array [M]
 storage
 

Static Public Attributes

static const size_t DIMENSION = M
 
static const vector FORWARD
 
static const vector BACKWARD
 
static const vector UP
 
static const vector DOWN
 
static const vector LEFT
 
static const vector RIGHT
 
static const vector ONE
 
static const vector ZERO
 
static const vector UNIT_X
 
static const vector UNIT_Y
 
static const vector UNIT_Z
 

Friends

std::ostream & operator<< (std::ostream &os, const vector &vector_)
 

Detailed Description

template<size_t M, typename T = float>
class vmml::vector< M, T >

Definition at line 53 of file vector.hpp.

Member Function Documentation

template<size_t M, typename T >
template<size_t N>
vector< N, T > & vmml::vector< M, T >::get_sub_vector ( size_t  offset = 0,
typename enable_if< M >  = N,
::type *  = 0 
)
inline
Returns
the sub vector at the given position and length.

Definition at line 1253 of file vector.hpp.

template<size_t M, typename T >
template<size_t N>
const vector< N, T > & vmml::vector< M, T >::get_sub_vector ( size_t  offset = 0,
typename enable_if< M >  = N,
::type *  = 0 
) const
inline
Returns
the sub vector at the given position and length.

Definition at line 1261 of file vector.hpp.

template<size_t M, typename T >
T vmml::vector< M, T >::product ( ) const
inline
Returns
the product of all elements of this vector

Definition at line 1163 of file vector.hpp.


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