#include <vector_n.h>
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, Base > | normalized () const |
_Vector< N, Base > | normalized () 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, Base > | operator* (Base c) const |
_Vector< N, Base > | operator* (Base c) const |
_Vector< N, Base > & | operator*= (Base c) |
_Vector< N, Base > & | operator*= (Base c) |
_Vector< N, Base > | operator+ (const _Vector< N, Base > &v) const |
_Vector< N, Base > | operator+ (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, Base > | operator- (const _Vector< N, Base > &v) const |
_Vector< N, Base > | operator- (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 Base & | operator[] (int i) const |
const Base & | operator[] (int i) const |
Base & | operator[] (int i) |
Base & | operator[] (int i) |
const Base & | pitch () const |
const Base & | pitch () const |
Base & | pitch () |
Base & | pitch () |
const Base & | roll () const |
const Base & | roll () const |
Base & | roll () |
Base & | roll () |
int | size () const |
int | size () const |
Base | squaredNorm () const |
Base | squaredNorm () const |
const Base & | w () const |
const Base & | w () const |
Base & | w () |
Base & | w () |
const Base & | x () const |
const Base & | x () const |
Base & | x () |
Base & | x () |
const Base & | y () const |
const Base & | y () const |
Base & | y () |
Base & | y () |
const Base & | yaw () const |
const Base & | yaw () const |
Base & | yaw () |
Base & | yaw () |
const Base & | z () const |
const Base & | z () const |
Base & | z () |
Base & | z () |
Public Attributes | |
_ArrayAllocator< N, Base > | _allocator |
Static Public Attributes | |
static const int | TemplateSize = N |
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.
Definition at line 48 of file include/hogman_minimal/math/vector_n.h.
Definition at line 48 of file src/math/vector_n.h.
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.
_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.
helper constructor for a 2d vector.
x,: | v[0] |
y,: | v[1] |
Definition at line 76 of file include/hogman_minimal/math/vector_n.h.
_Vector< N, Base >::_Vector | ( | Base | v0, |
Base | v1, | ||
Base | v2 | ||
) | [inline] |
helper constructor for a 3d vector.
x,: | v[0] |
y,: | v[1] |
z,: | v[2] |
Definition at line 83 of file include/hogman_minimal/math/vector_n.h.
_Vector< N, Base >::_Vector | ( | Base | v0, |
Base | v1, | ||
Base | v2, | ||
Base | v3 | ||
) | [inline] |
helper constructor for a 4d vector (often used for quaternions).
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.
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.
_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)
helper constructor for a 2d vector.
x,: | v[0] |
y,: | v[1] |
Definition at line 76 of file src/math/vector_n.h.
_Vector< N, Base >::_Vector | ( | Base | v0, |
Base | v1, | ||
Base | v2 | ||
) | [inline] |
helper constructor for a 3d vector.
x,: | v[0] |
y,: | v[1] |
z,: | v[2] |
Definition at line 83 of file src/math/vector_n.h.
_Vector< N, Base >::_Vector | ( | Base | v0, |
Base | v1, | ||
Base | v2, | ||
Base | v3 | ||
) | [inline] |
helper constructor for a 4d vector (often used for quaternions).
x,: | v[0] |
y,: | v[1] |
z,: | v[2] |
w,: | v[3] |
Definition at line 91 of file src/math/vector_n.h.
sets all emements of a vector to the same value.
scalar,: | the value |
Definition at line 130 of file include/hogman_minimal/math/vector_n.hpp.
sets all emements of a vector to the same value.
scalar,: | the value |
vector norm
Definition at line 96 of file include/hogman_minimal/math/vector_n.hpp.
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.
scales the vector to have norm 1.
Reimplemented in _Quaternion< Base >, _Quaternion< Base >, _Quaternion< double >, and _Quaternion< double >.
_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.
_Vector<N,Base> _Vector< N, Base >::normalized | ( | ) | const |
returns the normalized vector.
Reimplemented in _Quaternion< Base >, _Quaternion< Base >, _Quaternion< double >, and _Quaternion< double >.
_Vector< N, Base >::operator _Matrix< N, 1, Base > | ( | ) | const |
returns a column matrix representing the vector.
returns a column matrix representing the vector.
Definition at line 400 of file include/hogman_minimal/math/matrix_n.hpp.
Base _Vector< N, Base >::operator* | ( | const _Vector< N, Base > & | v | ) | const |
Dot product
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.
Product by a scalar without side effect
Definition at line 74 of file include/hogman_minimal/math/vector_n.hpp.
_Vector<N,Base> _Vector< N, Base >::operator* | ( | Base | c | ) | const |
Product by a scalar without side effect
Product by a scalar with side effect
Definition at line 67 of file include/hogman_minimal/math/vector_n.hpp.
Product by a scalar with side effect
_Vector< N, Base > _Vector< N, Base >::operator+ | ( | const _Vector< N, Base > & | v | ) | const |
vector sum
Definition at line 31 of file include/hogman_minimal/math/vector_n.hpp.
_Vector<N,Base> _Vector< N, Base >::operator+ | ( | const _Vector< N, Base > & | v | ) | const |
vector sum
_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.
_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;
_Vector< N, Base > _Vector< N, Base >::operator- | ( | const _Vector< N, Base > & | v | ) | const |
vector difference
Definition at line 45 of file include/hogman_minimal/math/vector_n.hpp.
_Vector<N,Base> _Vector< N, Base >::operator- | ( | const _Vector< N, Base > & | v | ) | const |
vector difference
_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.
_Vector<N,Base>& _Vector< N, Base >::operator-= | ( | const _Vector< N, Base > & | v | ) |
vector cumulateve subtraction. The same considerations as for the cumulattive sum hold.
bool _Vector< N, Base >::operator== | ( | const _Vector< N, Base > & | other | ) | const [inline] |
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.
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.
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.
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.
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.
returns the v[1], when the vector represents a rotation in euler angles
Definition at line 124 of file src/math/vector_n.h.
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.
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.
returns the v[1], when the vector represents a rotation in euler angles
Definition at line 133 of file src/math/vector_n.h.
returns the v[0], when the vector represents a rotation in euler angles
Definition at line 121 of file src/math/vector_n.h.
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.
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.
returns the v[0], when the vector represents a rotation in euler angles
Definition at line 130 of file src/math/vector_n.h.
returns the size of a vector
Definition at line 52 of file src/math/vector_n.h.
returns the size of a vector
Definition at line 52 of file include/hogman_minimal/math/vector_n.h.
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.
Base _Vector< N, Base >::squaredNorm | ( | ) | const |
returns the scalar product of a vector by itself
returns the v[3]
Definition at line 105 of file include/hogman_minimal/math/vector_n.h.
returns the v[3]
Definition at line 105 of file src/math/vector_n.h.
returns the v[3], which can be modified
Definition at line 117 of file src/math/vector_n.h.
returns the v[3], which can be modified
Definition at line 117 of file include/hogman_minimal/math/vector_n.h.
returns the v[0]
Definition at line 96 of file src/math/vector_n.h.
returns the v[0]
Definition at line 96 of file include/hogman_minimal/math/vector_n.h.
returns the v[0], which can be modified
Definition at line 108 of file src/math/vector_n.h.
returns the v[0], which can be modified
Definition at line 108 of file include/hogman_minimal/math/vector_n.h.
returns the v[1]
Definition at line 99 of file include/hogman_minimal/math/vector_n.h.
returns the v[1]
Definition at line 99 of file src/math/vector_n.h.
returns the v[1], which can be modified
Definition at line 111 of file src/math/vector_n.h.
returns the v[1], which can be modified
Definition at line 111 of file include/hogman_minimal/math/vector_n.h.
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.
returns the v[2], when the vector represents a rotation in euler angles
Definition at line 127 of file src/math/vector_n.h.
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.
returns the v[2], when the vector represents a rotation in euler angles
Definition at line 137 of file src/math/vector_n.h.
returns the v[2]
Definition at line 102 of file src/math/vector_n.h.
returns the v[2]
Definition at line 102 of file include/hogman_minimal/math/vector_n.h.
returns the v[2], which can be modified
Definition at line 114 of file include/hogman_minimal/math/vector_n.h.
returns the v[2], which can be modified
Definition at line 114 of file src/math/vector_n.h.
_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.
static const int _Vector< N, Base >::TemplateSize = N [static] |
Definition at line 64 of file include/hogman_minimal/math/vector_n.h.