Vector class supporting all classic classic vector operations. More...
#include <util/vector.h>
Public Types | |
typedef const T * | const_iterator |
typedef const T * | const_pointer_type |
typedef const T & | const_reference_type |
typedef T * | iterator |
typedef T * | pointer_type |
typedef T & | reference_type |
typedef T | value_type |
Public Member Functions | |
const_iterator | begin () const |
Stl-iteration constant begin. | |
iterator | begin () |
STL-iteration begin. | |
const T * | c_data () const |
Returns a constant raw pointer on the data. | |
Vector | cross (const Vector &other) const |
Compute the cross product as this x other . | |
T * | data () |
Returns a raw pointer on the data. | |
const_iterator | end () const |
Stl-iteration constant end. | |
iterator | end () |
STL-iteration end. | |
const T & | i () const |
Short access to the first element. | |
T & | i () |
Short access to the first element. | |
void | i (const T &v) |
Short access to the first element. | |
bool | iszero (void) |
const T & | j () const |
Short access to the second element. | |
T & | j () |
Short access to the second element. | |
void | j (const T &v) |
Short access to the second element. | |
const T & | k () const |
Short access to the third element. | |
T & | k () |
Short access to the third element. | |
void | k (const T &v) |
Short access to the third element. | |
const T & | l () const |
Short access to the fourth element. | |
T & | l () |
Short access to the fourth element. | |
void | l (const T &v) |
Short access to the fourth element. | |
Vector | mult (const Vector &vec) const |
Element-wise multiplcation. | |
T | norm () const |
Euclidean norm of the vector. | |
Vector & | normalize (void) |
Normalize the vector. | |
Vector | normalized (void) const |
Returns a normalized version of the vector. | |
T | normsq () const |
Square of the Euclidean norm of the vector. | |
bool | operator!= (const Vector &vec) const |
Element-wise inequality. | |
T | operator* (const Vector &vec) const |
Dot product. | |
Vector | operator* (const T &scalar) const |
Multiplication by a scalar. | |
template<typename T1 > | |
Vector & | operator*= (const T1 &scalar) |
In-place multiplication by a scalar. | |
Vector & | operator*= (const T &scalar) |
In-place multiplication by a scalar. | |
Vector | operator+ (const Vector &vec) const |
Vector addition. | |
Vector & | operator+= (const Vector &vec) |
In-place vector addition. | |
Vector | operator- (const Vector &vec) const |
Vector subtraction. | |
Vector | operator- (void) const |
Vector negation. | |
Vector & | operator-= (const Vector &vec) |
In-place vector subtraction. | |
Vector | operator/ (const Vector &vec) const |
Element-wise division. | |
Vector | operator/ (const T &scalar) const |
Division by a scalar. | |
template<typename T1 > | |
Vector & | operator/= (const T1 &scalar) |
In-place division by a scalar. | |
Vector & | operator/= (const T &scalar) |
In-place division by a scalar. | |
Vector & | operator/= (const Vector &vec) |
In-place element-wise division by a scalar. | |
bool | operator< (const Vector &other) const |
Comparison operator. | |
bool | operator<= (const Vector &other) const |
Comparison operator. | |
Vector & | operator= (const T &value) |
Set all the elements to value . | |
Vector & | operator= (const Vector &vec) |
Vector copy. | |
bool | operator== (const Vector &vec) const |
Element-wise equality. | |
bool | operator> (const Vector &other) const |
Comparison operator. | |
bool | operator>= (const Vector &other) const |
Comparison operator. | |
T | operator[] (size_t idx) const |
Access to the element idx . | |
T & | operator[] (size_t idx) |
Access to the element idx . | |
Vector< 2, T > | projectXY (void) |
Extract the two first elements of the vector. | |
void | set (const T &x, const T &y, const T &z, const T &t) |
Set the values of a 4-D vector. | |
void | set (const T &x, const T &y, const T &z) |
Set the values of a 3-D vector. | |
void | set (const T &x, const T &y) |
Set the values of a 2-D vector. | |
void | set (const T &x) |
Set the values of a 1-D vector. | |
const T & | t () const |
Short access to the fourth element. | |
T & | t () |
Short access to the fourth element. | |
void | t (const T &v) |
Short access to the fourth element. | |
Vector (const T &x, const T &y, const T &z, const T &t) | |
Initialize a 4D vector. | |
Vector (const T &x, const T &y, const T &z) | |
Initialize a 3D vector. | |
Vector (const T &x, const T &y) | |
Initialize a 2D vector. | |
Vector (const T &x=T()) | |
Initialize a vector with all values to x . | |
template<class Vec > | |
Vector (const Vec &el) | |
Initialize a vector from any object behaving like an array. | |
template<size_t d1, class T1 > | |
Vector (const Vector< d1, T1 > &vec) | |
Copy another vector with different number of elements. | |
Vector (const Vector &vec) | |
Copy another vector. | |
const T & | x () const |
Short access to the first element. | |
T & | x () |
Short access to the first element. | |
void | x (const T &v) |
Short access to the first element. | |
const T & | y () const |
Short access to the second element. | |
T & | y () |
Short access to the second element. | |
void | y (const T &v) |
Short access to the second element. | |
const T & | z () const |
Short access to the third element. | |
T & | z () |
Short access to the third element. | |
void | z (const T &v) |
Short access to the third element. | |
Vector & | zero (void) |
Static Public Member Functions | |
static size_t | size () |
Returns the size of the vector (i.e. | |
Protected Attributes | |
T | elems [dim] |
Friends | |
Vector | operator* (const T &scalar, const Vector &vec) |
Multiplication by a scalar. | |
QTextStream & | operator<< (QTextStream &out, const Vector &vec) |
std::ostream & | operator<< (std::ostream &out, const Vector &vec) |
QTextStream & | operator>> (QTextStream &in, Vector &vec) |
std::istream & | operator>> (std::istream &in, Vector &vec) |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
double | angle (const Vector< 3, T > &v1, const Vector< 3, T > &v2, const Vector< 3, T > &ref) |
Oriented angle between v1 and v2 with ref to orient the space. | |
template<class T > | |
double | angle (const Vector< 1, T > &v1, const Vector< 1, T > &v2) |
Oriented angle between v1 and v2 . | |
template<class T > | |
double | angle (const Vector< 2, T > &v1, const Vector< 2, T > &v2) |
Oriented angle between v1 and v2 . | |
template<class T > | |
double | angle (const Vector< 3, T > &v1, const Vector< 3, T > &v2) |
Non-oriented angle between v1 and v2 . | |
template<class T > | |
double | angle (const Vector< 2, T > &v) |
Angle of the vector with (0,1). | |
template<size_t dim, typename T > | |
Vector< dim, T > | divide (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
Return the vector whose component is the ratio of the two input vectors components. | |
template<size_t dim, typename T , typename T1 , typename T2 > | |
Vector< dim, T > | map (T(*fct)(T1, T2), const Vector< dim, T1 > &v1, const Vector< dim, T2 > &v2) |
Map a function to all elements of a vector. | |
template<size_t dim, typename T , typename T1 , typename T2 > | |
Vector< dim, T > | map (T(*fct)(const T1 &, const T2 &), const Vector< dim, T1 > &v1, const Vector< dim, T2 > &v2) |
Map a function to all elements of a vector. | |
template<size_t dim, typename T , typename T1 , typename T2 > | |
Vector< dim, T > | map (const T &(*fct)(const T1 &, const T2 &), const Vector< dim, T1 > &v1, const Vector< dim, T2 > &v2) |
Map a function to all elements of a vector. | |
template<size_t dim, typename T > | |
Vector< dim, T > | map (T(*fct)(T, T), const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
Map a function to all elements of a vector. | |
template<size_t dim, typename T > | |
Vector< dim, T > | map (T(*fct)(const T &, const T &), const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
Map a function to all elements of a vector. | |
template<size_t dim, typename T > | |
Vector< dim, T > | map (const T &(*fct)(const T &, const T &), const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
Map a function to all elements of a vector. | |
template<size_t dim, typename T , typename T1 > | |
Vector< dim, T > | map (T(*fct)(T1), const Vector< dim, T1 > &v) |
Map a function to all elements of a vector. | |
template<size_t dim, typename T > | |
Vector< dim, T > | max (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
Return the vector whose component is the max of the two input vectors components. | |
template<size_t dim, typename T > | |
Vector< dim, T > | min (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
Return the vector whose component is the min of the two input vectors components. | |
template<size_t dim, typename T > | |
Vector< dim, T > | multiply (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
Return the vector whose component is the product of the two input vectors components. | |
template<size_t dim, typename T > | |
T | norm (const Vector< dim, T > &v) |
Function-version of the norm. | |
double | norm (double s) |
Euclidian norm of a real. | |
template<size_t dim, typename T > | |
Vector< dim, T > | normalized (const Vector< dim, T > &v) |
Function-version of the square norm. | |
double | normalized (double) |
Euclidian square norm of a real. | |
template<size_t dim, typename T > | |
T | normsq (const Vector< dim, T > &v) |
Function-version of the square norm. | |
double | normsq (double s) |
Euclidian square norm of a real. | |
template<class T > | |
Vector< 3, T > | operator% (const Vector< 3, T > &v1, const Vector< 3, T > &v2) |
Cross product v1 x v2 . | |
template<class T > | |
T | operator% (const Vector< 2, T > &v1, const Vector< 2, T > &v2) |
Cross product v1 x v2 . | |
template<size_t dim, typename T > | |
Vector< dim, T > | operator+ (const T &value, const Vector< dim, T > &v) |
Add a value to all elements of a vector. | |
template<size_t dim, typename T > | |
Vector< dim, T > | operator+ (const Vector< dim, T > &v, const T &value) |
Add a value to all elements of a vector. | |
template<size_t dim, typename T > | |
Vector< dim, T > | operator- (const T &value, const Vector< dim, T > &v) |
Equivalent to substracting a vector with all component the same to another one. | |
template<size_t dim, typename T > | |
Vector< dim, T > | operator- (const Vector< dim, T > &v, const T &value) |
Substact a value to all elements of a vector. | |
template<class T > | |
Vector< 3, T > | operator^ (const Vector< 3, T > &v1, const Vector< 3, T > &v2) |
Cross product v1 x v2 (French notation). | |
template<class T > | |
T | operator^ (const Vector< 1, T > &v1, const Vector< 1, T > &v2) |
Cross product v1 x v2 (French notation). | |
template<class T > | |
T | operator^ (const Vector< 2, T > &v1, const Vector< 2, T > &v2) |
Cross product v1 x v2 (French notation). | |
template<typename T > | |
util::Vector< 3, T > | orthogonal (const util::Vector< 3, T > &v) |
Find a vector orthogonal to v. |
Vector class supporting all classic classic vector operations.
Definition at line 32 of file vector.h.
util::Vector< dim, T >::Vector | ( | const Vector< dim, T > & | vec | ) | [inline] |
util::Vector< dim, T >::Vector | ( | const Vector< d1, T1 > & | vec | ) | [inline, explicit] |
Copy another vector with different number of elements.
util::Vector< dim, T >::Vector | ( | const Vec & | el | ) | [inline, explicit] |
Initialize a vector from any object behaving like an array.
The only constraints are:
T
dim
util::Vector< dim, T >::Vector | ( | const T & | x = T() |
) | [inline] |
util::Vector< dim, T >::Vector | ( | const T & | x, | |
const T & | y | |||
) | [inline, explicit] |
Initialize a 2D vector.
Definition at line 109 of file vector.h.
00110 { 00111 STATIC_ASSERT( dim == 2, "Constructor with 2 arguments can be used only for 2D vectors" ); 00112 elems[ 0 ] = x; 00113 elems[ 1 ] = y; 00114 }
util::Vector< dim, T >::Vector | ( | const T & | x, | |
const T & | y, | |||
const T & | z | |||
) | [inline, explicit] |
util::Vector< dim, T >::Vector | ( | const T & | x, | |
const T & | y, | |||
const T & | z, | |||
const T & | t | |||
) | [inline, explicit] |
const_iterator util::Vector< dim, T >::begin | ( | ) | const [inline] |
iterator util::Vector< dim, T >::begin | ( | ) | [inline] |
const T* util::Vector< dim, T >::c_data | ( | ) | const [inline] |
Returns a constant raw pointer on the data.
Reimplemented in util::Point< T >.
Definition at line 170 of file vector.h.
Referenced by util::Matrix< nb_vars, nb_vars, double >::c_data(), tissue::Tissue< Model, CellContent, JunctionContent, WallContent, CellEdgeContent, CellJunctionContent, JunctionCellContent, compact, LeafClass >::drawCell(), algorithms::drawSymetricVVGraph(), and tissue::Tissue< Model, CellContent, JunctionContent, WallContent, CellEdgeContent, CellJunctionContent, JunctionCellContent, compact, LeafClass >::drawWalledCell().
Vector util::Vector< dim, T >::cross | ( | const Vector< dim, T > & | other | ) | const [inline] |
Compute the cross product as this
x other
.
Definition at line 498 of file vector.h.
00499 { 00500 STATIC_ASSERT( dim == 3, "Cross product is only defined for 3D vectors." ); 00501 return ( *this ) ^ other; 00502 }
T* util::Vector< dim, T >::data | ( | ) | [inline] |
Returns a raw pointer on the data.
Definition at line 147 of file vector.h.
Referenced by util::Matrix< nb_vars, nb_vars, double >::data().
const_iterator util::Vector< dim, T >::end | ( | ) | const [inline] |
iterator util::Vector< dim, T >::end | ( | ) | [inline] |
const T& util::Vector< dim, T >::i | ( | ) | const [inline] |
Short access to the first element.
Definition at line 588 of file vector.h.
00588 { STATIC_ASSERT( dim > 0, "Accessing i requires at least a 1D vector." ); return elems[0]; }
T& util::Vector< dim, T >::i | ( | ) | [inline] |
Short access to the first element.
Definition at line 572 of file vector.h.
Referenced by util::Vector< nCols, double >::mult(), util::Vector< nCols, double >::normsq(), util::Vector< nCols, double >::operator*(), util::Vector< nCols, double >::operator*=(), geometry::Quaternion::operator*=(), util::Vector< nCols, double >::operator+=(), geometry::Quaternion::operator+=(), util::Vector< nCols, double >::operator-(), util::Vector< nCols, double >::operator-=(), util::Vector< nCols, double >::operator/=(), geometry::Quaternion::operator/=(), util::Vector< nCols, double >::operator<(), util::Vector< nCols, double >::operator<=(), util::Vector< nCols, double >::operator=(), util::Vector< nCols, double >::operator==(), util::Vector< nCols, double >::operator>(), util::Vector< nCols, double >::operator>=(), and util::Vector< nCols, double >::Vector().
00572 { STATIC_ASSERT( dim > 0, "Accessing i requires at least a 1D vector." ); return elems[0]; }
void util::Vector< dim, T >::i | ( | const T & | v | ) | [inline] |
Short access to the first element.
Definition at line 556 of file vector.h.
00556 { STATIC_ASSERT( dim > 0, "Accessing i requires at least a 1D vector." ); elems[0] = v; }
const T& util::Vector< dim, T >::j | ( | ) | const [inline] |
Short access to the second element.
Definition at line 592 of file vector.h.
00592 { STATIC_ASSERT( dim > 1, "Accessing j requires at least a 2D vector." ); return elems[1]; }
T& util::Vector< dim, T >::j | ( | ) | [inline] |
Short access to the second element.
Definition at line 576 of file vector.h.
00576 { STATIC_ASSERT( dim > 1, "Accessing j requires at least a 2D vector." ); return elems[1]; }
void util::Vector< dim, T >::j | ( | const T & | v | ) | [inline] |
Short access to the second element.
Definition at line 560 of file vector.h.
00560 { STATIC_ASSERT( dim > 1, "Accessing j requires at least a 2D vector." ); elems[1] = v; }
const T& util::Vector< dim, T >::k | ( | ) | const [inline] |
Short access to the third element.
Definition at line 596 of file vector.h.
00596 { STATIC_ASSERT( dim > 2, "Accessing k requires at least a 3D vector." ); return elems[2]; }
T& util::Vector< dim, T >::k | ( | ) | [inline] |
Short access to the third element.
Definition at line 580 of file vector.h.
00580 { STATIC_ASSERT( dim > 2, "Accessing k requires at least a 3D vector." ); return elems[2]; }
void util::Vector< dim, T >::k | ( | const T & | v | ) | [inline] |
Short access to the third element.
Definition at line 564 of file vector.h.
00564 { STATIC_ASSERT( dim > 2, "Accessing k requires at least a 3D vector." ); elems[2] = v; }
const T& util::Vector< dim, T >::l | ( | ) | const [inline] |
Short access to the fourth element.
Definition at line 600 of file vector.h.
00600 { STATIC_ASSERT( dim > 3, "Accessing l requires at least a 4D vector." ); return elems[3]; }
T& util::Vector< dim, T >::l | ( | ) | [inline] |
Short access to the fourth element.
Definition at line 584 of file vector.h.
00584 { STATIC_ASSERT( dim > 3, "Accessing l requires at least a 4D vector." ); return elems[3]; }
void util::Vector< dim, T >::l | ( | const T & | v | ) | [inline] |
Short access to the fourth element.
Definition at line 568 of file vector.h.
00568 { STATIC_ASSERT( dim > 3, "Accessing l requires at least a 4D vector." ); elems[3] = v; }
Vector util::Vector< dim, T >::mult | ( | const Vector< dim, T > & | vec | ) | const [inline] |
T util::Vector< dim, T >::norm | ( | ) | const [inline] |
Euclidean norm of the vector.
Definition at line 391 of file vector.h.
Referenced by util::Vector< dim, T >::norm(), and util::Vector< nCols, double >::normalize().
00392 { 00393 return std::sqrt(normsq()); 00394 }
Vector& util::Vector< dim, T >::normalize | ( | void | ) | [inline] |
Normalize the vector.
Definition at line 411 of file vector.h.
Referenced by util::Vector< nCols, double >::normalized(), complex_factory::objreader(), cell_system::CellSystem< TissueClass, RealModel >::step_cellsystem_division(), and util::Contour::tangent().
00412 { 00413 T sz = norm(); 00414 return ((*this) /= sz); 00415 }
Vector util::Vector< dim, T >::normalized | ( | void | ) | const [inline] |
Returns a normalized version of the vector.
Definition at line 420 of file vector.h.
Referenced by util::Vector< dim, T >::normalized().
00421 { 00422 Vector ans(*this); 00423 return ans.normalize(); 00424 }
T util::Vector< dim, T >::normsq | ( | ) | const [inline] |
Square of the Euclidean norm of the vector.
Definition at line 399 of file vector.h.
Referenced by geometry::Quaternion::inverse(), util::Vector< nCols, double >::norm(), and util::Vector< dim, T >::normsq().
bool util::Vector< dim, T >::operator!= | ( | const Vector< dim, T > & | vec | ) | const [inline] |
T util::Vector< dim, T >::operator* | ( | const Vector< dim, T > & | vec | ) | const [inline] |
Vector util::Vector< dim, T >::operator* | ( | const T & | scalar | ) | const [inline] |
Vector& util::Vector< dim, T >::operator*= | ( | const T1 & | scalar | ) | [inline] |
Vector& util::Vector< dim, T >::operator*= | ( | const T & | scalar | ) | [inline] |
Vector util::Vector< dim, T >::operator+ | ( | const Vector< dim, T > & | vec | ) | const [inline] |
Vector& util::Vector< dim, T >::operator+= | ( | const Vector< dim, T > & | vec | ) | [inline] |
Vector util::Vector< dim, T >::operator- | ( | const Vector< dim, T > & | vec | ) | const [inline] |
Vector util::Vector< dim, T >::operator- | ( | void | ) | const [inline] |
Vector& util::Vector< dim, T >::operator-= | ( | const Vector< dim, T > & | vec | ) | [inline] |
Vector util::Vector< dim, T >::operator/ | ( | const Vector< dim, T > & | vec | ) | const [inline] |
Vector util::Vector< dim, T >::operator/ | ( | const T & | scalar | ) | const [inline] |
Division by a scalar.
Reimplemented in util::Point< T >.
Definition at line 228 of file vector.h.
00229 { 00230 Vector ans(*this); 00231 ans /= scalar; 00232 return ans; 00233 }
Vector& util::Vector< dim, T >::operator/= | ( | const T1 & | scalar | ) | [inline] |
Vector& util::Vector< dim, T >::operator/= | ( | const T & | scalar | ) | [inline] |
Vector& util::Vector< dim, T >::operator/= | ( | const Vector< dim, T > & | vec | ) | [inline] |
bool util::Vector< dim, T >::operator< | ( | const Vector< dim, T > & | other | ) | const [inline] |
bool util::Vector< dim, T >::operator<= | ( | const Vector< dim, T > & | other | ) | const [inline] |
Vector& util::Vector< dim, T >::operator= | ( | const T & | value | ) | [inline] |
Set all the elements to value
.
Reimplemented in util::Color< T >, and util::Color< GLfloat >.
Vector& util::Vector< dim, T >::operator= | ( | const Vector< dim, T > & | vec | ) | [inline] |
bool util::Vector< dim, T >::operator== | ( | const Vector< dim, T > & | vec | ) | const [inline] |
bool util::Vector< dim, T >::operator> | ( | const Vector< dim, T > & | other | ) | const [inline] |
bool util::Vector< dim, T >::operator>= | ( | const Vector< dim, T > & | other | ) | const [inline] |
T util::Vector< dim, T >::operator[] | ( | size_t | idx | ) | const [inline] |
T& util::Vector< dim, T >::operator[] | ( | size_t | idx | ) | [inline] |
Vector<2,T> util::Vector< dim, T >::projectXY | ( | void | ) | [inline] |
Extract the two first elements of the vector.
Definition at line 605 of file vector.h.
00606 { 00607 STATIC_ASSERT( dim>1, "2D projection requires at least a 2D vector." ); 00608 return Vector<2,T>(elems[0],elems[1]); 00609 }
void util::Vector< dim, T >::set | ( | const T & | x, | |
const T & | y, | |||
const T & | z, | |||
const T & | t | |||
) | [inline] |
void util::Vector< dim, T >::set | ( | const T & | x, | |
const T & | y, | |||
const T & | z | |||
) | [inline] |
void util::Vector< dim, T >::set | ( | const T & | x, | |
const T & | y | |||
) | [inline] |
Set the values of a 2-D vector.
Definition at line 453 of file vector.h.
00454 { 00455 STATIC_ASSERT( dim == 2, "Set method with 2 arguments can be used only for 2D vectors." ); 00456 elems[ 0 ] = x; 00457 elems[ 1 ] = y; 00458 }
void util::Vector< dim, T >::set | ( | const T & | x | ) | [inline] |
Set the values of a 1-D vector.
Definition at line 444 of file vector.h.
00445 { 00446 STATIC_ASSERT( dim == 1, "Set method with 1 argument can be used only for 1D vectors." ); 00447 elems[ 0 ] = x; 00448 }
static size_t util::Vector< dim, T >::size | ( | ) | [inline, static] |
Returns the size of the vector (i.e.
the number of elements)
Definition at line 142 of file vector.h.
Referenced by complex_factory::objreader().
const T& util::Vector< dim, T >::t | ( | ) | const [inline] |
Short access to the fourth element.
Definition at line 551 of file vector.h.
00551 { STATIC_ASSERT( dim > 3, "Accessing t requires at least a 4D vector." ); return elems[3]; }
T& util::Vector< dim, T >::t | ( | ) | [inline] |
Short access to the fourth element.
Definition at line 535 of file vector.h.
Referenced by util::Vector< nCols, double >::set().
00535 { STATIC_ASSERT( dim > 3, "Accessing t requires at least a 4D vector." ); return elems[3]; }
void util::Vector< dim, T >::t | ( | const T & | v | ) | [inline] |
Short access to the fourth element.
Definition at line 519 of file vector.h.
Referenced by util::Matrix< nb_vars, nb_vars, double >::rotation().
00519 { STATIC_ASSERT( dim > 3, "Accessing t requires at least a 4D vector." ); elems[3] = v; }
const T& util::Vector< dim, T >::x | ( | ) | const [inline] |
Short access to the first element.
Definition at line 539 of file vector.h.
00539 { STATIC_ASSERT( dim > 0, "Accessing x requires at least a 1D vector." ); return elems[0]; }
T& util::Vector< dim, T >::x | ( | ) | [inline] |
Short access to the first element.
Definition at line 523 of file vector.h.
Referenced by geometry::Quaternion::conjugate(), geometry::Quaternion::inverse(), util::Vector< nCols, double >::set(), and util::Vector< nCols, double >::Vector().
00523 { STATIC_ASSERT( dim > 0, "Accessing x requires at least a 1D vector." ); return elems[0]; }
void util::Vector< dim, T >::x | ( | const T & | v | ) | [inline] |
Short access to the first element.
Definition at line 507 of file vector.h.
Referenced by util::Vector< dim, T >::angle(), tissue_model::TissueModel< RealModel, TissueClass >::draw(), complex_factory::hex_grid(), util::Contour::normal(), util::Function::normalizeX(), util::Function::normalizeY(), complex_factory::objreader(), util::Function::operator()(), util::Vector< dim, T >::orthogonal(), util::Function::reread(), util::Matrix< nb_vars, nb_vars, double >::rotation(), solver::Solver< nb_vars, identifier >::solveAdaptiveCrankNicholson(), and complex_factory::square_grid().
00507 { STATIC_ASSERT( dim > 0, "Accessing x requires at least a 1D vector." ); elems[0] = v; }
const T& util::Vector< dim, T >::y | ( | ) | const [inline] |
Short access to the second element.
Definition at line 543 of file vector.h.
00543 { STATIC_ASSERT( dim > 1, "Accessing y requires at least a 2D vector." ); return elems[1]; }
T& util::Vector< dim, T >::y | ( | ) | [inline] |
Short access to the second element.
Definition at line 527 of file vector.h.
Referenced by geometry::Quaternion::conjugate(), geometry::Quaternion::inverse(), and util::Vector< nCols, double >::set().
00527 { STATIC_ASSERT( dim > 1, "Accessing y requires at least a 2D vector." ); return elems[1]; }
void util::Vector< dim, T >::y | ( | const T & | v | ) | [inline] |
Short access to the second element.
Definition at line 511 of file vector.h.
Referenced by util::Vector< dim, T >::angle(), tissue_model::TissueModel< RealModel, TissueClass >::draw(), complex_factory::hex_grid(), util::Contour::normal(), complex_factory::objreader(), util::Vector< dim, T >::orthogonal(), util::Function::reread(), util::Matrix< nb_vars, nb_vars, double >::rotation(), and complex_factory::square_grid().
00511 { STATIC_ASSERT( dim > 1, "Accessing y requires at least a 2D vector." ); elems[1] = v; }
const T& util::Vector< dim, T >::z | ( | ) | const [inline] |
Short access to the third element.
Definition at line 547 of file vector.h.
00547 { STATIC_ASSERT( dim > 2, "Accessing z requires at least a 3D vector." ); return elems[2]; }
T& util::Vector< dim, T >::z | ( | ) | [inline] |
Short access to the third element.
Definition at line 531 of file vector.h.
Referenced by geometry::Quaternion::conjugate(), geometry::Quaternion::inverse(), and util::Vector< nCols, double >::set().
00531 { STATIC_ASSERT( dim > 2, "Accessing z requires at least a 3D vector." ); return elems[2]; }
void util::Vector< dim, T >::z | ( | const T & | v | ) | [inline] |
Short access to the third element.
Definition at line 515 of file vector.h.
Referenced by tissue_model::TissueModel< RealModel, TissueClass >::draw(), complex_factory::objreader(), util::Vector< dim, T >::orthogonal(), and util::Matrix< nb_vars, nb_vars, double >::rotation().
00515 { STATIC_ASSERT( dim > 2, "Accessing z requires at least a 3D vector." ); elems[2] = v; }
double angle | ( | const Vector< 2, T > & | v | ) | [related] |
Angle of the vector with (0,1).
Definition at line 777 of file vector.h.
References util::Vector< dim, T >::x(), and util::Vector< dim, T >::y().
T norm | ( | const Vector< dim, T > & | v | ) | [related] |
Function-version of the norm.
Definition at line 879 of file vector.h.
References util::Vector< dim, T >::norm().
double norm | ( | double | s | ) | [related] |
Vector< dim, T > normalized | ( | const Vector< dim, T > & | v | ) | [related] |
Function-version of the square norm.
Definition at line 903 of file vector.h.
References util::Vector< dim, T >::normalized().
double normalized | ( | double | ) | [related] |
T normsq | ( | const Vector< dim, T > & | v | ) | [related] |
Function-version of the square norm.
Definition at line 891 of file vector.h.
References util::Vector< dim, T >::normsq().
double normsq | ( | double | s | ) | [related] |
util::Vector< 3, T > orthogonal | ( | const util::Vector< 3, T > & | v | ) | [related] |
Find a vector orthogonal to v.
Definition at line 982 of file vector.h.
References util::Vector< dim, T >::x(), util::Vector< dim, T >::y(), and util::Vector< dim, T >::z().
00983 { 00984 const double ratio = 1-1e-8; 00985 if ((std::abs(v.y()) >= ratio*std::abs(v.x())) && (std::abs(v.z()) >= ratio*std::abs(v.x()))) 00986 return util::Vector<3,T>(0, -v.z(), v.y()); 00987 else 00988 if ((std::abs(v.x()) >= ratio*std::abs(v.y())) && (std::abs(v.z()) >= ratio*std::abs(v.y()))) 00989 return util::Vector<3,T>(-v.z(), 0, v.x()); 00990 else 00991 return util::Vector<3,T>(-v.y(), v.x(), 0); 00992 }