(9)

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_tDirector (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.
 

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()

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]

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

Operator +=

Add point p to current instance

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

◆ operator-=() [1/2]

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

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