Defines a 2-D point with arbitrary type coordinates. More...
Public Member Functions | |
Point2D () | |
Default constructor. | |
Point2D (T_ a, T_ b=T_(0)) | |
Constructor that assigns a , b to x -, y - and y -coordinates respectively. More... | |
Point2D (T_ *a) | |
Initialize point coordinates with C-array a. | |
Point2D (const Point2D< T_ > &pt) | |
Copy constructor. | |
Point2D (const Point< T_ > &pt) | |
Copy constructor from class Point. | |
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... | |
Point2D< T_ > & | operator= (const Point2D< T_ > &p) |
Operator = More... | |
Point2D< T_ > & | operator+= (const Point2D< T_ > &p) |
Operator += More... | |
Point2D< T_ > & | operator-= (const Point2D< T_ > &p) |
Operator -= More... | |
Point2D< T_ > & | operator= (const T_ &a) |
Operator = More... | |
Point2D< T_ > & | operator+= (const T_ &a) |
Operator += More... | |
Point2D< T_ > & | operator-= (const T_ &a) |
Operator -= More... | |
Point2D< T_ > & | operator*= (const T_ &a) |
Operator *= More... | |
Point2D< T_ > & | operator/= (const T_ &a) |
Operator /= More... | |
bool | operator== (const Point2D< T_ > &p) |
Operator == More... | |
bool | operator!= (const Point2D< T_ > &p) |
Operator != More... | |
real_t | CrossProduct (const Point2D< real_t > &lp, const Point2D< real_t > &rp) |
Return Cross product of two vectors lp and rp | |
real_t | NNorm () const |
Return squared norm (length) of vector. | |
real_t | Norm () const |
Return norm (length) of vector. | |
Point2D< real_t > | Director (const Point2D< real_t > &p) const |
Return Director (Normalized vector) | |
bool | isCloseTo (const Point2D< real_t > &a, real_t toler=OFELI_TOLERANCE) const |
Return true if current point is close to instance a (up to tolerance toler ) | |
Public Attributes | |
T_ | x |
First coordinate of point. | |
T_ | y |
Second coordinate of point. | |
Defines a 2-D point with arbitrary type coordinates.
Operators =
and ()
are overloaded. The actual
T_ | Data type (double, float, complex<double>, ...) |
Point2D | ( | T_ | a, |
T_ | b = T_(0) |
||
) |
Constructor that assigns a
, b
to x
-, y
- and y
-coordinates respectively.
Default value for b is 0
bool operator!= | ( | const Point2D< 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
correspond to x
and y
respectively
const T_& operator() | ( | size_t | i | ) | const |
Operator() : Constant version.
Values i=1,2
correspond to x
and y
respectively
Point2D<T_>& operator*= | ( | const T_ & | a | ) |
Operator *=
Multiply constant a
by current instance coordinates
Point2D<T_>& operator+= | ( | const T_ & | a | ) |
Operator +=
Add constant a
to current instance coordinates
Operator -=
Subtract point p
from current instance
Point2D<T_>& operator-= | ( | const T_ & | a | ) |
Operator -=
Subtract constant a
from current instance coordinates
Point2D<T_>& operator/= | ( | const T_ & | a | ) |
Operator /=
Divide current instance coordinates by a
Point2D<T_>& operator= | ( | const T_ & | a | ) |
Operator =
Assign constant a
to current instance coordinates
bool operator== | ( | const Point2D< 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
correspond to x
and y
respectively
const T_& operator[] | ( | size_t | i | ) | const |
Operator[]
Constant version.
Values i=0,1
correspond to x
and y
respectively