Defines a point with arbitrary type coordinates. More...
Public Member Functions | |
Point () | |
Default constructor. | |
Point (T_ a) | |
Constructor that assigns a to first coordinate. | |
Point (T_ a, T_ b) | |
Constructor that assigns a and b to first and second coordinates respectively. | |
Point (T_ a, T_ b, T_ c) | |
Constructor that assigns a , b and c to first, second and third coordinates respectively. | |
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... | |
real_t | NNorm () const |
Return squared euclidean norm of vector. | |
real_t | Norm () const |
Return norm (length) of vector. | |
void | Normalize () |
Normalize vector. More... | |
Point< real_t > | Director (const Point< real_t > &p) const |
Return Director (Normalized vector) | |
bool | isCloseTo (const Point< real_t > &a, real_t 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 |
Point coordinates. | |
Defines a point with arbitrary type coordinates.
Operators =
and ()
are overloaded.
T_ | Data type (double, float, complex<double>, ...) |
bool isCloseTo | ( | const Point< real_t > & | a, |
real_t | 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.
void Normalize | ( | ) |
Normalize vector.
Divide vector components by its 2-norm
bool operator!= | ( | const Point< T_ > & | p | ) |
Operator !=
Return false
if current instance is equal to p
, true
otherwise.
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
Point<T_>& operator*= | ( | const T_ & | a | ) |
Operator *=
Multiply constant a
by current instance coordinates
Point<T_>& operator+= | ( | const T_ & | a | ) |
Operator +=
Add constant a
to current instance coordinates
T_ operator, | ( | const Point< T_ > & | p | ) | const |
Return Dot (scalar) product of two vectors.
A typical use of this operator is double a = (p,q)
where p
and q
are 2 instances of Point<double>
[in] | p | Point instance by which the current instance is multiplied |
Point<T_>& operator-= | ( | const T_ & | a | ) |
Operator -=
Subtract constant a
from current instance coordinates
Point<T_>& operator/= | ( | const T_ & | a | ) |
Operator /=
Divide current instance coordinates by a
Point<T_>& operator= | ( | const T_ & | a | ) |
Operator =
Assign constant a
to current instance coordinates
bool operator== | ( | const Point< T_ > & | p | ) |
Operator ==
Return true
if current instance is equal to p
, false
otherwise.
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