Public Types | Public Member Functions | Public Attributes | Static Public Attributes
_Vector< N, Base > Struct Template Reference

#include <vector_n.h>

List of all members.

Public Types

typedef Base BaseType
typedef Base BaseType

Public Member Functions

 _Vector (int s=N)
 _Vector (int s=N)
template<typename Base2 >
 _Vector (const _Vector< N, Base2 > &v)
template<typename Base2 >
 _Vector (const _Vector< N, Base2 > &v)
 _Vector (Base v0, Base v1)
 _Vector (Base v0, Base v1)
 _Vector (Base v0, Base v1, Base v2)
 _Vector (Base v0, Base v1, Base v2)
 _Vector (Base v0, Base v1, Base v2, Base v3)
 _Vector (Base v0, Base v1, Base v2, Base v3)
void fill (Base scalar)
void fill (Base scalar)
Base norm () const
Base norm () const
void normalize ()
void normalize ()
_Vector< N, Basenormalized () const
_Vector< N, Basenormalized () const
 operator _Matrix< N, 1, Base > () const
 operator _Matrix< N, 1, Base > () const
Base operator* (const _Vector< N, Base > &v) const
Base operator* (const _Vector< N, Base > &v) const
_Vector< N, Baseoperator* (Base c) const
_Vector< N, Baseoperator* (Base c) const
_Vector< N, Base > & operator*= (Base c)
_Vector< N, Base > & operator*= (Base c)
_Vector< N, Baseoperator+ (const _Vector< N, Base > &v) const
_Vector< N, Baseoperator+ (const _Vector< N, Base > &v) const
_Vector< N, Base > & operator+= (const _Vector< N, Base > &v)
_Vector< N, Base > & operator+= (const _Vector< N, Base > &v)
_Vector< N, Baseoperator- (const _Vector< N, Base > &v) const
_Vector< N, Baseoperator- (const _Vector< N, Base > &v) const
_Vector< N, Base > & operator-= (const _Vector< N, Base > &v)
_Vector< N, Base > & operator-= (const _Vector< N, Base > &v)
bool operator== (const _Vector< N, Base > &other) const
bool operator== (const _Vector< N, Base > &other) const
const Baseoperator[] (int i) const
const Baseoperator[] (int i) const
Baseoperator[] (int i)
Baseoperator[] (int i)
const Basepitch () const
const Basepitch () const
Basepitch ()
Basepitch ()
const Baseroll () const
const Baseroll () const
Baseroll ()
Baseroll ()
int size () const
int size () const
Base squaredNorm () const
Base squaredNorm () const
const Basew () const
const Basew () const
Basew ()
Basew ()
const Basex () const
const Basex () const
Basex ()
Basex ()
const Basey () const
const Basey () const
Basey ()
Basey ()
const Baseyaw () const
const Baseyaw () const
Baseyaw ()
Baseyaw ()
const Basez () const
const Basez () const
Basez ()
Basez ()

Public Attributes

_ArrayAllocator< N, Base_allocator

Static Public Attributes

static const int TemplateSize = N

Detailed Description

template<int N, typename Base = double>
struct _Vector< N, Base >

This class represents an n-dimensional vector and implements the basic operations on vectors. There are two memory models involved: fixed size and variable size. The memory model is implemented by a member of type _ArrayAllocator. Whenever it is possible use the fixed size memory model because the compiler can do nice things when unrolling loops.

You can delclare a vector of fixed size by writing _Vector<X,T> when X!=0 and T is tye type of the vecotr's element.

A vector of variable size can be declared as _Vector<0,T>.

Vectors having different memory models are effectively *different* types, and performing operations which will result in an illegal size results in a compilation error.

Definition at line 47 of file include/hogman_minimal/math/vector_n.h.


Member Typedef Documentation

template<int N, typename Base = double>
typedef Base _Vector< N, Base >::BaseType

Definition at line 48 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
typedef Base _Vector< N, Base >::BaseType

Definition at line 48 of file src/math/vector_n.h.


Constructor & Destructor Documentation

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( int  s = N) [inline]

constructs a vector of size N. For fized size vectors N should not be specified

Definition at line 63 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base >
template<typename Base2 >
_Vector< N, Base >::_Vector ( const _Vector< N, Base2 > &  v)

constructs a vector from a vector having a different, but convertible cell type (i.e. float and double)

Definition at line 22 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( Base  v0,
Base  v1 
) [inline]

helper constructor for a 2d vector.

Parameters:
x,:v[0]
y,:v[1]

Definition at line 76 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( Base  v0,
Base  v1,
Base  v2 
) [inline]

helper constructor for a 3d vector.

Parameters:
x,:v[0]
y,:v[1]
z,:v[2]

Definition at line 83 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( Base  v0,
Base  v1,
Base  v2,
Base  v3 
) [inline]

helper constructor for a 4d vector (often used for quaternions).

Parameters:
x,:v[0]
y,:v[1]
z,:v[2]
w,:v[3]

Definition at line 91 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( int  s = N) [inline]

constructs a vector of size N. For fized size vectors N should not be specified

Definition at line 63 of file src/math/vector_n.h.

template<int N, typename Base = double>
template<typename Base2 >
_Vector< N, Base >::_Vector ( const _Vector< N, Base2 > &  v)

constructs a vector from a vector having a different, but convertible cell type (i.e. float and double)

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( Base  v0,
Base  v1 
) [inline]

helper constructor for a 2d vector.

Parameters:
x,:v[0]
y,:v[1]

Definition at line 76 of file src/math/vector_n.h.

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( Base  v0,
Base  v1,
Base  v2 
) [inline]

helper constructor for a 3d vector.

Parameters:
x,:v[0]
y,:v[1]
z,:v[2]

Definition at line 83 of file src/math/vector_n.h.

template<int N, typename Base = double>
_Vector< N, Base >::_Vector ( Base  v0,
Base  v1,
Base  v2,
Base  v3 
) [inline]

helper constructor for a 4d vector (often used for quaternions).

Parameters:
x,:v[0]
y,:v[1]
z,:v[2]
w,:v[3]

Definition at line 91 of file src/math/vector_n.h.


Member Function Documentation

template<int N, typename Base>
void _Vector< N, Base >::fill ( Base  scalar)

sets all emements of a vector to the same value.

Parameters:
scalar,:the value

Definition at line 130 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
void _Vector< N, Base >::fill ( Base  scalar)

sets all emements of a vector to the same value.

Parameters:
scalar,:the value
template<int N, typename Base >
Base _Vector< N, Base >::norm ( ) const

vector norm

Definition at line 96 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
Base _Vector< N, Base >::norm ( ) const

vector norm

template<int N, typename Base >
void _Vector< N, Base >::normalize ( )

scales the vector to have norm 1.

Reimplemented in _Quaternion< Base >, _Quaternion< Base >, _Quaternion< double >, and _Quaternion< double >.

Definition at line 102 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
void _Vector< N, Base >::normalize ( )

scales the vector to have norm 1.

Reimplemented in _Quaternion< Base >, _Quaternion< Base >, _Quaternion< double >, and _Quaternion< double >.

template<int N, typename Base >
_Vector< N, Base > _Vector< N, Base >::normalized ( ) const

returns the normalized vector.

Reimplemented in _Quaternion< Base >, _Quaternion< Base >, _Quaternion< double >, and _Quaternion< double >.

Definition at line 113 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector<N,Base> _Vector< N, Base >::normalized ( ) const

returns the normalized vector.

Reimplemented in _Quaternion< Base >, _Quaternion< Base >, _Quaternion< double >, and _Quaternion< double >.

template<int N, typename Base = double>
_Vector< N, Base >::operator _Matrix< N, 1, Base > ( ) const

returns a column matrix representing the vector.

template<int N, typename Base >
_Vector< N, Base >::operator _Matrix< N, 1, Base > ( ) const

returns a column matrix representing the vector.

Definition at line 400 of file include/hogman_minimal/math/matrix_n.hpp.

template<int N, typename Base = double>
Base _Vector< N, Base >::operator* ( const _Vector< N, Base > &  v) const

Dot product

template<int N, typename Base>
Base _Vector< N, Base >::operator* ( const _Vector< N, Base > &  v) const

Dot product

Definition at line 59 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base>
_Vector< N, Base > _Vector< N, Base >::operator* ( Base  c) const

Product by a scalar without side effect

Definition at line 74 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector<N,Base> _Vector< N, Base >::operator* ( Base  c) const

Product by a scalar without side effect

template<int N, typename Base>
_Vector< N, Base > & _Vector< N, Base >::operator*= ( Base  c)

Product by a scalar with side effect

Definition at line 67 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector<N,Base>& _Vector< N, Base >::operator*= ( Base  c)

Product by a scalar with side effect

template<int N, typename Base>
_Vector< N, Base > _Vector< N, Base >::operator+ ( const _Vector< N, Base > &  v) const

vector sum

Returns:
*this + v

Definition at line 31 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector<N,Base> _Vector< N, Base >::operator+ ( const _Vector< N, Base > &  v) const

vector sum

Returns:
*this + v
template<int N, typename Base>
_Vector< N, Base > & _Vector< N, Base >::operator+= ( const _Vector< N, Base > &  v)

vector accumulation. Always use v+=v2 instead of v=v+v2 because is more efficient;

Definition at line 38 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector<N,Base>& _Vector< N, Base >::operator+= ( const _Vector< N, Base > &  v)

vector accumulation. Always use v+=v2 instead of v=v+v2 because is more efficient;

template<int N, typename Base>
_Vector< N, Base > _Vector< N, Base >::operator- ( const _Vector< N, Base > &  v) const

vector difference

Returns:
*this - v

Definition at line 45 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector<N,Base> _Vector< N, Base >::operator- ( const _Vector< N, Base > &  v) const

vector difference

Returns:
*this - v
template<int N, typename Base>
_Vector< N, Base > & _Vector< N, Base >::operator-= ( const _Vector< N, Base > &  v)

vector cumulateve subtraction. The same considerations as for the cumulattive sum hold.

Definition at line 52 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
_Vector<N,Base>& _Vector< N, Base >::operator-= ( const _Vector< N, Base > &  v)

vector cumulateve subtraction. The same considerations as for the cumulattive sum hold.

template<int N, typename Base = double>
bool _Vector< N, Base >::operator== ( const _Vector< N, Base > &  other) const [inline]
template<int N, typename Base>
bool _Vector< N, Base >::operator== ( const _Vector< N, Base > &  other) const [inline]

Definition at line 81 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::operator[] ( int  i) const [inline]

returns the ith element of a vector

Definition at line 56 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::operator[] ( int  i) const [inline]

returns the ith element of a vector

Definition at line 56 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::operator[] ( int  i) [inline]

returns the ith element of a vector

Definition at line 60 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::operator[] ( int  i) [inline]

returns the ith element of a vector

Definition at line 60 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::pitch ( ) const [inline]

returns the v[1], when the vector represents a rotation in euler angles

Definition at line 124 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::pitch ( ) const [inline]

returns the v[1], when the vector represents a rotation in euler angles

Definition at line 124 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::pitch ( ) [inline]

returns the v[1], when the vector represents a rotation in euler angles

Definition at line 133 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::pitch ( ) [inline]

returns the v[1], when the vector represents a rotation in euler angles

Definition at line 133 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::roll ( ) const [inline]

returns the v[0], when the vector represents a rotation in euler angles

Definition at line 121 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::roll ( ) const [inline]

returns the v[0], when the vector represents a rotation in euler angles

Definition at line 121 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::roll ( ) [inline]

returns the v[0], when the vector represents a rotation in euler angles

Definition at line 130 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::roll ( ) [inline]

returns the v[0], when the vector represents a rotation in euler angles

Definition at line 130 of file src/math/vector_n.h.

template<int N, typename Base = double>
int _Vector< N, Base >::size ( void  ) const [inline]

returns the size of a vector

Definition at line 52 of file src/math/vector_n.h.

template<int N, typename Base = double>
int _Vector< N, Base >::size ( void  ) const [inline]

returns the size of a vector

Definition at line 52 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base >
Base _Vector< N, Base >::squaredNorm ( ) const

returns the scalar product of a vector by itself

Definition at line 88 of file include/hogman_minimal/math/vector_n.hpp.

template<int N, typename Base = double>
Base _Vector< N, Base >::squaredNorm ( ) const

returns the scalar product of a vector by itself

template<int N, typename Base = double>
const Base& _Vector< N, Base >::w ( ) const [inline]

returns the v[3]

Definition at line 105 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::w ( ) const [inline]

returns the v[3]

Definition at line 105 of file src/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::w ( ) [inline]

returns the v[3], which can be modified

Definition at line 117 of file src/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::w ( ) [inline]

returns the v[3], which can be modified

Definition at line 117 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::x ( ) const [inline]

returns the v[0]

Definition at line 96 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::x ( ) const [inline]

returns the v[0]

Definition at line 96 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::x ( ) [inline]

returns the v[0], which can be modified

Definition at line 108 of file src/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::x ( ) [inline]

returns the v[0], which can be modified

Definition at line 108 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::y ( ) const [inline]

returns the v[1]

Definition at line 99 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::y ( ) const [inline]

returns the v[1]

Definition at line 99 of file src/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::y ( ) [inline]

returns the v[1], which can be modified

Definition at line 111 of file src/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::y ( ) [inline]

returns the v[1], which can be modified

Definition at line 111 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::yaw ( ) const [inline]

returns the v[2], when the vector represents a rotation in euler angles

Definition at line 127 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::yaw ( ) const [inline]

returns the v[2], when the vector represents a rotation in euler angles

Definition at line 127 of file src/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::yaw ( ) [inline]

returns the v[2], when the vector represents a rotation in euler angles

Definition at line 137 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::yaw ( ) [inline]

returns the v[2], when the vector represents a rotation in euler angles

Definition at line 137 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::z ( ) const [inline]

returns the v[2]

Definition at line 102 of file src/math/vector_n.h.

template<int N, typename Base = double>
const Base& _Vector< N, Base >::z ( ) const [inline]

returns the v[2]

Definition at line 102 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::z ( ) [inline]

returns the v[2], which can be modified

Definition at line 114 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
Base& _Vector< N, Base >::z ( ) [inline]

returns the v[2], which can be modified

Definition at line 114 of file src/math/vector_n.h.


Member Data Documentation

template<int N, typename Base = double>
_ArrayAllocator< N, Base > _Vector< N, Base >::_allocator

this is the memory model.

Definition at line 199 of file include/hogman_minimal/math/vector_n.h.

template<int N, typename Base = double>
static const int _Vector< N, Base >::TemplateSize = N [static]

Definition at line 64 of file include/hogman_minimal/math/vector_n.h.


The documentation for this struct was generated from the following files:


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Mon Oct 6 2014 00:07:00