Defines a point with arbitrary type coordinates. More...
Public Member Functions | |
| Point () | |
| Default constructor. | |
| Point (T_ a, T_ b=T_(0), T_ c=T_(0)) | |
Constructor that assigns a, b to x-, y- and z-coordinates respectively. More... | |
| Point (const Point< T_ > &p) | |
| Copy constructor. | |
| T_ & | operator() (size_t i) |
Operator (): Non constant version. More... | |
| const T_ & | operator() (size_t i) const |
Operator (): Constant version. More... | |
| T_ & | operator[] (size_t i) |
Operator []: Non constant version. More... | |
| const T_ & | operator[] (size_t i) const |
Operator []: Constant version. More... | |
| Point< T_ > & | operator+= (const Point< T_ > &p) |
Operator += More... | |
| Point< T_ > & | operator-= (const Point< T_ > &p) |
Operator -= More... | |
| Point< T_ > & | operator= (const T_ &a) |
Operator = More... | |
| Point< T_ > & | operator+= (const T_ &a) |
Operator += More... | |
| Point< T_ > & | operator-= (const T_ &a) |
Operator -= More... | |
| Point< T_ > & | operator*= (const T_ &a) |
Operator *= More... | |
| Point< T_ > & | operator/= (const T_ &a) |
Operator /= More... | |
| bool | operator== (const Point< T_ > &p) |
Operator == More... | |
| bool | operator!= (const Point< T_ > &p) |
Operator != More... | |
| double | NNorm () const |
| Return squared euclidean norm of vector. | |
| double | Norm () const |
| Return norm (length) of vector. | |
| void | Normalize () |
| Normalize vector. More... | |
| Point< double > | Director (const Point< double > &p) const |
| Return Director (Normalized vector) | |
| bool | isCloseTo (const Point< double > &a, double toler=OFELI_TOLERANCE) const |
Return true if current point is close to instance a (up to tolerance toler) More... | |
| T_ | operator, (const Point< T_ > &p) const |
| Return Dot (scalar) product of two vectors. More... | |
Public Attributes | |
| T_ | x |
| First coordinate. | |
| T_ | y |
| Second coordinate. | |
| T_ | z |
| Third coordinate. | |
Detailed Description
template<class T_>
class OFELI::Point< T_ >
Defines a point with arbitrary type coordinates.
Operators = and () are overloaded.
- Template Parameters
-
T_ Data type (double, float, complex<double>, ...)
- Author
- Rachid Touzani
- Copyright
- GNU Lesser Public License
Constructor & Destructor Documentation
| Point | ( | T_ | a, |
| T_ | b = T_(0), |
||
| T_ | c = T_(0) |
||
| ) |
Constructor that assigns a, b to x-, y- and z-coordinates respectively.
Default values for b and c are 0
Member Function Documentation
| T_& operator() | ( | size_t | i | ) |
Operator (): Non constant version.
Values i = 1, 2, 3 correspond to x, y and z respectively
| const T_& operator() | ( | size_t | i | ) | const |
Operator (): Constant version.
Values i = 1, 2, 3 correspond to x, y and z respectively
| T_& operator[] | ( | size_t | i | ) |
Operator []: Non constant version.
Values i = 0, 1, 2 correspond to x, y and z respectively
| const T_& operator[] | ( | size_t | i | ) | const |
Operator []: Constant version.
Values i = 0, 1, 2 correspond to x, y and z respectively
| Point<T_>& operator= | ( | const T_ & | a | ) |
Operator =
Assign constant a to current instance coordinates
| Point<T_>& operator+= | ( | const T_ & | a | ) |
Operator +=
Add constant a to current instance coordinates
| Point<T_>& operator-= | ( | const T_ & | a | ) |
Operator -=
Subtract constant a from current instance coordinates
| Point<T_>& operator*= | ( | const T_ & | a | ) |
Operator *=
Multiply constant a by current instance coordinates
| Point<T_>& operator/= | ( | const T_ & | a | ) |
Operator /=
Divide current instance coordinates by a
| bool operator== | ( | const Point< T_ > & | p | ) |
Operator ==
Return true if current instance is equal to p, false otherwise.
| bool operator!= | ( | const Point< T_ > & | p | ) |
Operator !=
Return false if current instance is equal to p, true otherwise.
| void Normalize | ( | ) |
Normalize vector.
Divide vector components by its 2-norm
| bool isCloseTo | ( | const Point< double > & | a, |
| double | toler = OFELI_TOLERANCE |
||
| ) | const |
Return true if current point is close to instance a (up to tolerance toler)
Default value for toler is the OFELI_TOLERANCE constant.