Point< T_ > Class Template Reference

Defines a point with arbitrary type coordinates. More...

#include <Point.h>

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.
 
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.
 
Point< T_ > & operator+= (const Point< T_ > &p)
 Operator +=
 
Point< T_ > & operator-= (const Point< T_ > &p)
 Operator -=
 
Point< T_ > & operator= (const T_ &a)
 Operator =
 
Point< T_ > & operator+= (const T_ &a)
 Operator +=
 
Point< T_ > & operator-= (const T_ &a)
 Operator -=
 
Point< T_ > & operator*= (const T_ &a)
 Operator *=
 
Point< T_ > & operator/= (const T_ &a)
 Operator /=
 
bool operator== (const Point< T_ > &p)
 Operator ==
 
bool operator!= (const Point< T_ > &p)
 Operator !=
 
real_t NNorm () const
 Return squared euclidean norm of vector.
 
real_t Norm () const
 Return norm (length) of vector.
 
void Normalize ()
 Normalize vector.
 
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)
 
T_ operator, (const Point< T_ > &p) const
 Return Dot (scalar) product of two vectors.
 

Public Attributes

T_ x
 Point coordinates.
 

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

Member Function Documentation

◆ isCloseTo()

template<class T_ >
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()

template<class T_ >
void Normalize ( )

Normalize vector.

Divide vector components by its 2-norm

◆ operator!=()

template<class T_ >
bool operator!= ( const Point< T_ > &  p)

Operator !=

Return false if current instance is equal to p, true otherwise.

◆ operator()() [1/2]

template<class T_ >
T_ & operator() ( size_t  i)

Operator (): Non constant version.

Values i = 1, 2, 3 correspond to x, y and z respectively

◆ operator()() [2/2]

template<class T_ >
const T_ & operator() ( size_t  i) const

Operator (): Constant version.

Values i = 1, 2, 3 correspond to x, y and z respectively

◆ operator*=()

template<class T_ >
Point< T_ > & operator*= ( const T_ &  a)

Operator *=

Multiply constant a by current instance coordinates

◆ operator+=() [1/2]

template<class T_ >
Point< T_ > & operator+= ( const Point< T_ > &  p)

Operator +=

Add point p to current instance

◆ operator+=() [2/2]

template<class T_ >
Point< T_ > & operator+= ( const T_ &  a)

Operator +=

Add constant a to current instance coordinates

◆ operator,()

template<class T_ >
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]pPoint instance by which the current instance is multiplied

◆ operator-=() [1/2]

template<class T_ >
Point< T_ > & operator-= ( const Point< T_ > &  p)

Operator -=

Subtract point p from current instance

◆ operator-=() [2/2]

template<class T_ >
Point< T_ > & operator-= ( const T_ &  a)

Operator -=

Subtract constant a from current instance coordinates

◆ operator/=()

template<class T_ >
Point< T_ > & operator/= ( const T_ &  a)

Operator /=

Divide current instance coordinates by a

◆ operator=()

template<class T_ >
Point< T_ > & operator= ( const T_ &  a)

Operator =

Assign constant a to current instance coordinates

◆ operator==()

template<class T_ >
bool operator== ( const Point< T_ > &  p)

Operator ==

Return true if current instance is equal to p, false otherwise.

◆ operator[]() [1/2]

template<class T_ >
T_ & operator[] ( size_t  i)

Operator []: Non constant version.

Values i = 0, 1, 2 correspond to x, y and z respectively

◆ operator[]() [2/2]

template<class T_ >
const T_ & operator[] ( size_t  i) const

Operator []: Constant version.

Values i = 0, 1, 2 correspond to x, y and z respectively