Defines a point with arbitrary type coordinates. More...
#include <Point.h>
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... | |
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 |
First coordinate. | |
T_ | y |
Second coordinate. | |
T_ | z |
Third coordinate. | |
Detailed Description
class OFELI::Point< T_ >
Defines a point with arbitrary type coordinates.
Operators =
and ()
are overloaded.
- Template Parameters
-
T_ Data type (double, float, complex<double>, ...)
- Copyright
- GNU Lesser Public License
Constructor & Destructor Documentation
◆ Point()
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
◆ isCloseTo()
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.
◆ Normalize()
void Normalize | ( | ) |
Normalize vector.
Divide vector components by its 2-norm
◆ operator!=()
bool operator!= | ( | const Point< T_ > & | p | ) |
Operator !=
Return false
if current instance is equal to p
, true
otherwise.
◆ operator()() [1/2]
T_ & operator() | ( | size_t | i | ) |
Operator ()
: Non constant version.
Values i = 1, 2, 3
correspond to x
, y
and z
respectively
◆ operator()() [2/2]
const T_ & operator() | ( | size_t | i | ) | const |
Operator ()
: Constant version.
Values i = 1, 2, 3
correspond to x
, y
and z
respectively
◆ operator*=()
Point< T_ > & operator*= | ( | const T_ & | a | ) |
Operator *=
Multiply constant a
by current instance coordinates
◆ operator+=() [1/2]
◆ operator+=() [2/2]
Point< T_ > & operator+= | ( | const T_ & | a | ) |
Operator +=
Add constant a
to current instance coordinates
◆ operator,()
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>
- Parameters
-
[in] p Point instance by which the current instance is multiplied
◆ operator-=() [1/2]
Operator -=
Subtract point p
from current instance
◆ operator-=() [2/2]
Point< T_ > & operator-= | ( | const T_ & | a | ) |
Operator -=
Subtract constant a
from current instance coordinates
◆ operator/=()
Point< T_ > & operator/= | ( | const T_ & | a | ) |
Operator /=
Divide current instance coordinates by a
◆ operator=()
Point< T_ > & operator= | ( | const T_ & | a | ) |
Operator =
Assign constant a
to current instance coordinates
◆ operator==()
bool operator== | ( | const Point< T_ > & | p | ) |
Operator ==
Return true
if current instance is equal to p
, false
otherwise.
◆ operator[]() [1/2]
T_ & operator[] | ( | size_t | i | ) |
Operator []
: Non constant version.
Values i = 0, 1, 2
correspond to x
, y
and z
respectively
◆ operator[]() [2/2]
const T_ & operator[] | ( | size_t | i | ) | const |
Operator []
: Constant version.
Values i = 0, 1, 2
correspond to x
, y
and z
respectively