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. | |
| 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. | |
| const T_ & | operator() (size_t i) const |
| Operator() : Constant version. | |
| T_ & | operator[] (size_t i) |
| Operator[] : Non constant version. | |
| const T_ & | operator[] (size_t i) const |
| Operator[] : Constant version. | |
| Point2D< T_ > & | operator= (const Point2D< T_ > &p) |
| Operator =. | |
| Point2D< T_ > & | operator+= (const Point2D< T_ > &p) |
| Operator +=. | |
| Point2D< T_ > & | operator-= (const Point2D< T_ > &p) |
| Operator -=. | |
| Point2D< T_ > & | operator= (const T_ &a) |
| Operator =. | |
| Point2D< T_ > & | operator+= (const T_ &a) |
| Operator +=. | |
| Point2D< T_ > & | operator-= (const T_ &a) |
| Operator -=. | |
| Point2D< T_ > & | operator*= (const T_ &a) |
| Operator *=. | |
| Point2D< T_ > & | operator/= (const T_ &a) |
| Operator /=. | |
| bool | operator== (const Point2D< T_ > &p) |
| Operator ==. | |
| bool | operator!= (const Point2D< T_ > &p) |
| Operator !=. | |
| double | CrossProduct (const Point2D< double > &lp, const Point2D< double > &rp) |
| Return Cross product of two vectors lp and rp. | |
| double | NNorm () const |
| Return squared norm (length) of vector. | |
| double | Norm () const |
| Return norm (length) of vector. | |
| Point2D< double > | Director (const Point2D< double > &p) const |
| Return Director (Normalized vector) | |
| bool | isCloseTo (const Point2D< double > &a, double toler=DBL_EPSILON *10000) 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. | |
Detailed Description
template<class T_>
class OFELI::Point2D< T_ >
Defines a 2-D point with arbitrary type coordinates.
Operators = and () are overloaded. The actual
- Template Parameters:
-
<T_> Data type (double, float, complex<double>, ...)
Constructor & Destructor Documentation
| 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
Member Function Documentation
| 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
| 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
Operator -=.
Subtract point p from current instance
| Point2D<T_>& operator= | ( | const T_ & | a | ) |
Operator =.
Assign constant a to current instance coordinates
| Point2D<T_>& operator+= | ( | const T_ & | a | ) |
Operator +=.
Add constant a to current instance coordinates
| Point2D<T_>& operator-= | ( | const T_ & | a | ) |
Operator -=.
Subtract constant from current instance coordinates
| Point2D<T_>& operator*= | ( | const T_ & | a | ) |
Operator *=.
Multiply constant by current instance coordinates
| Point2D<T_>& operator/= | ( | const T_ & | a | ) |
Operator /=.
Divide current instance coordinates by a
| bool operator== | ( | const Point2D< T_ > & | p | ) |
Operator ==.
Return true if current instance is equal to p, false otherwise.
| bool operator!= | ( | const Point2D< T_ > & | p | ) |
Operator !=.
Return false if current instance is equal to p, true otherwise.
- OFELI
- Point2D