#include <TinyVector.hpp>

Public Member Functions | |
| size_t | size () const |
| T & | operator[] (const size_t &i) |
| const T & | operator[] (const size_t &i) const |
| const TinyVector< 3, T > & | operator= (const TinyVector< 3, T > &V) |
| const TinyVector< 3, T > & | operator= (const T &t) |
| TinyVector< 3, T > | operator* (const T &t) const |
| real_t | operator* (const TinyVector< 3, T > &V) const |
| TinyVector< 3, T > & | operator*= (const T &t) |
| TinyVector< 3, T > & | operator/= (const T &t) |
| TinyVector< 3, T > | operator- (const TinyVector< 3, T > &V) const |
| TinyVector< 3, T > | operator- () const |
| const TinyVector< 3, T > & | operator-= (const TinyVector< 3, T > &V) |
| TinyVector< 3, T > | operator^ (const TinyVector< 3, T > &V) const |
| TinyVector< 3, T > | operator+ (const TinyVector< 3, T > &V) const |
| const TinyVector< 3, T > & | operator+= (const TinyVector< 3, T > &V) |
| bool | operator== (const TinyVector< 3, T > &V) const |
| bool | operator!= (const TinyVector< 3, T > &V) const |
| bool | operator< (const TinyVector< 3, T > &V) const |
| TinyVector (const T &x1, const T &x2, const T &x3) | |
| TinyVector () | |
| TinyVector (const T &t) | |
| TinyVector (const TinyVector< 3, T > &V) | |
| ~TinyVector () | |
Protected Attributes | |
| T | __x [3] |
| stored data | |
Private Types | |
| enum | { Dimension = 3 } |
| typedef T | ValueType |
| The type of values stored in the TinyVector. | |
Friends | |
| TinyVector< 3, T > | sqrt (const TinyVector< 3, T > &V) |
| real_t | Norm (const TinyVector< 3, T > &V) |
| TinyVector< 3, T > | operator* (const real_t &a, const TinyVector< 3, T > &V) |
| std::ostream & | operator<< (std::ostream &os, const TinyVector< 3, T > &V) |
Definition at line 429 of file TinyVector.hpp.
typedef T TinyVector< 3, T >::ValueType [private] |
anonymous enum [private] |
| TinyVector< 3, T >::TinyVector | ( | const T & | x1, | |
| const T & | x2, | |||
| const T & | x3 | |||
| ) | [inline] |
Constructs the vector using three values
| x1 | first component | |
| x2 | second component | |
| x3 | third component |
Definition at line 771 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
| TinyVector< 3, T >::TinyVector | ( | ) | [inline] |
| TinyVector< 3, T >::TinyVector | ( | const T & | t | ) | [inline] |
Construct the vector setting its coordinates to t.
| t | the given value |
Definition at line 793 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00794 { 00795 for (size_t i=0; i<3; i++) 00796 __x[i] = t; 00797 }
| TinyVector< 3, T >::TinyVector | ( | const TinyVector< 3, T > & | V | ) | [inline] |
Copy constructor.
| V | the original vector |
Definition at line 804 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
| TinyVector< 3, T >::~TinyVector | ( | ) | [inline] |
| size_t TinyVector< 3, T >::size | ( | ) | const [inline] |
Read-only access to the dimension of the TinyVector.
Definition at line 449 of file TinyVector.hpp.
| T& TinyVector< 3, T >::operator[] | ( | const size_t & | i | ) | [inline] |
Access to the i th coordinate.
| i | the component number |
Definition at line 461 of file TinyVector.hpp.
References TinyVector< N, T >::__x, and ASSERT.
| const T& TinyVector< 3, T >::operator[] | ( | const size_t & | i | ) | const [inline] |
Read-only access to the i th component.
| i | the component number |
Definition at line 474 of file TinyVector.hpp.
References TinyVector< N, T >::__x, and ASSERT.
| const TinyVector<3, T>& TinyVector< 3, T >::operator= | ( | const TinyVector< 3, T > & | V | ) | [inline] |
Makes the current vector equal to a given one
| V | the vector to copy |
Definition at line 487 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
| const TinyVector<3, T>& TinyVector< 3, T >::operator= | ( | const T & | t | ) | [inline] |
Copies the value t to every component of the vector
| t | the value to copy |
Definition at line 501 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00502 { 00503 for (size_t i=0; i<3; i++) 00504 __x[i] = t; 00505 return (*this); 00506 }
| TinyVector<3, T> TinyVector< 3, T >::operator* | ( | const T & | t | ) | const [inline] |
Returns multiplication by a T from the right ...
| t | the value |
where
is the current vector Definition at line 515 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00516 { 00517 TinyVector<3,T> W; 00518 for (size_t i=0; i<3; i++) { 00519 W.__x[i] = __x[i] * t; 00520 } 00521 return W; 00522 }
| real_t TinyVector< 3, T >::operator* | ( | const TinyVector< 3, T > & | V | ) | const [inline] |
Computes the scalar product with another vector
| V | the other vector |
Definition at line 531 of file TinyVector.hpp.
References TinyVector< N, T >::__x, and ASSERT.
00532 { 00533 ASSERT(typeid(T) == typeid(real_t)); 00534 real_t s=0; 00535 for (size_t i=0; i<3; i++) 00536 s += __x[i] * V.__x[i]; 00537 return s; 00538 }
| TinyVector<3, T>& TinyVector< 3, T >::operator*= | ( | const T & | t | ) | [inline] |
Multiplies the TinyVector by a T
| t | the given value |
Definition at line 547 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00548 { 00549 for (size_t i=0; i<3; i++) 00550 __x[i] *= t; 00551 return (*this); 00552 }
| TinyVector<3, T>& TinyVector< 3, T >::operator/= | ( | const T & | t | ) | [inline] |
Multiplies the TinyVector by the inverse of a T
| t | the given value |
Definition at line 561 of file TinyVector.hpp.
References TinyVector< N, T >::operator*=().
00562 { 00563 const T temp = 1./t; 00564 this->operator*=(temp); 00565 return (*this); 00566 }

| TinyVector<3, T> TinyVector< 3, T >::operator- | ( | const TinyVector< 3, T > & | V | ) | const [inline] |
Computes the difference with an other vector
| V | the other vector |
Definition at line 575 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00576 { 00577 TinyVector<3, T> v = 0; 00578 for (size_t i=0; i<3; i++) 00579 v[i] = __x[i] - V.__x[i]; 00580 return v; 00581 }
| TinyVector<3, T> TinyVector< 3, T >::operator- | ( | ) | const [inline] |
Returns the opposed TinyVector.
Definition at line 589 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00590 { 00591 return (TinyVector<3, T> (-__x[0],-__x[1],-__x[2])); 00592 }
| const TinyVector<3, T>& TinyVector< 3, T >::operator-= | ( | const TinyVector< 3, T > & | V | ) | [inline] |
Substracts a vector.
| V | the vector to remove |
Definition at line 601 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
| TinyVector<3, T> TinyVector< 3, T >::operator^ | ( | const TinyVector< 3, T > & | V | ) | const [inline] |
Computes the vectorial product with a vector
| V | the given vector |
Definition at line 615 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00616 { 00617 TinyVector<3, T> W(0); 00618 for (size_t i=0; i<3; i++) 00619 W[i] += __x[(i+1)%3] * V.__x[(i+2)%3] - __x[(i+2)%3] * V.__x[(i+1)%3]; 00620 return W; 00621 }
| TinyVector<3, T> TinyVector< 3, T >::operator+ | ( | const TinyVector< 3, T > & | V | ) | const [inline] |
Computes the sum with another vector
| V | the other vector |
Definition at line 630 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00631 { 00632 TinyVector<3, T> W(*this); 00633 for (size_t i=0; i<3; i++) 00634 W.__x[i] += V.__x[i]; 00635 return W; 00636 }
| const TinyVector<3, T>& TinyVector< 3, T >::operator+= | ( | const TinyVector< 3, T > & | V | ) | [inline] |
Adds a vector
| V | the vector to add |
Definition at line 645 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
| bool TinyVector< 3, T >::operator== | ( | const TinyVector< 3, T > & | V | ) | const [inline] |
Compares two vectors
| V | the vector to compare with |
Definition at line 662 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
| bool TinyVector< 3, T >::operator!= | ( | const TinyVector< 3, T > & | V | ) | const [inline] |
Compares 2 vectors. true if they are not exactly the same
| V | the vector to compare with |
Definition at line 674 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
| bool TinyVector< 3, T >::operator< | ( | const TinyVector< 3, T > & | V | ) | const [inline] |
Compares two vectors
| V | the vector to compare with |
Definition at line 688 of file TinyVector.hpp.
References TinyVector< N, T >::__x.
00689 { 00690 for (size_t i=0; i<3; ++i) { 00691 if(__x[i] != V.__x[i]) { 00692 return (__x[i] < V.__x[i]); 00693 } 00694 } 00695 return false; 00696 }
| TinyVector<3, T> sqrt | ( | const TinyVector< 3, T > & | V | ) | [friend] |
Returns the square root of a vector. (ie: it returns the vector whoose componnents are square roots of arg)
| V | the given vector |
Definition at line 706 of file TinyVector.hpp.
00707 { 00708 using namespace std; 00709 TinyVector<3, T> W; 00710 for (size_t i=0; i<3; i++) 00711 W.__x[i] = sqrt(V.__x[i]); 00712 return W; 00713 }
| real_t Norm | ( | const TinyVector< 3, T > & | V | ) | [friend] |
Returns the Euclidean norm of the vector.
| V | the vector which norm is to compute |
Definition at line 722 of file TinyVector.hpp.
00723 { 00724 ASSERT(typeid(T) == typeid(real_t)); 00725 real_t d = 0; 00726 for (size_t i=0; i<3; i++) 00727 d += V.__x[i]*V.__x[i]; 00728 using namespace std; 00729 return sqrt(d); 00730 }
| TinyVector<3, T> operator* | ( | const real_t & | a, | |
| const TinyVector< 3, T > & | V | |||
| ) | [friend] |
Returns the multiplication of a TinyVector by a T on the left.
| a | the multiplicative constant | |
| V | the vector to multiply |
Definition at line 740 of file TinyVector.hpp.
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const TinyVector< 3, T > & | V | |||
| ) | [friend] |
Prints out the transposed of a vector in a stream
| os | the given stream | |
| V | the vector |
Definition at line 754 of file TinyVector.hpp.
00756 { 00757 os << '('; 00758 for (size_t i=0; i<3-1; i++) 00759 os << V[i] << ", "; 00760 os << V[3-1] << ')'; 00761 return os; 00762 }
T TinyVector< 3, T >::__x[3] [protected] |
1.5.6