Flumy [Free API]
Process based model for meandering chanelized systems
Public Member Functions | Protected Attributes | Friends | List of all members
Point2D Class Reference

Storage class for 2D points. More...

Detailed Description

Storage class for 2D points.

This class stores abscissa and ordinate of a 2D point.
At any time, the user should known:

Public Member Functions

 Point2D (const MP_real &x=0., const MP_real &y=0.)
 Default constructor. More...
 
 Point2D (const Point2D &)
 Copy constructor. More...
 
virtual ~Point2D ()
 Destructor. More...
 
MP_real distance (const Point2D &) const
 Return distance between current point and given point reference. More...
 
Point2Dtransform (const Point2D &translate, const Point2D &dilate, bool do_round=false)
 Return new point dilated. More...
 
MP_real scalar (const Point2D &) const
 Return the scalar product (_x*x + _y*y) between current point and given point reference. More...
 
MP_real vectorial (const Point2D &) const
 Return the vectorial product (_x*y - _y*x) between current point and given point reference. More...
 
Point2Dreset (const MP_real &x=0., const MP_real &y=0.)
 Reset current point coordinates to new values. More...
 
Point2Drotate_half_pi ()
 Rotate 90° current point anticlockwise. More...
 
Point2Drotate_pi ()
 Rotate 180° current point anticlockwise. More...
 
Point2Drotate (const Point2D &center, const MP_real &angle)
 Rotate a point around a center (angle in radian) More...
 
Point2Drotate (const Point2D &center, const MP_real &cosinus, const MP_real &sinus)
 Rotate a point around a center given the cosinus and the sinus of the angle. More...
 
Point2Drotate_inv (const Point2D &center, const MP_real &angle)
 Inverse rotate a point around a center (angle in radian) More...
 
Point2Drotate_inv (const Point2D &center, const MP_real &cosinus, const MP_real &sinus)
 Inverse rotate a point around a center given the cosinus and the sinus of the angle. More...
 
Point2Doperator= (const Point2D &)
 Affect current point by given reference point. More...
 
Point2Doperator+= (const Point2D &)
 Affect current point adding given reference point. More...
 
Point2Doperator-= (const Point2D &)
 Affect current point substracting given reference point. More...
 
Point2Doperator*= (const MP_real &)
 Affect current point multipling coordinates by given real value. More...
 
Point2Doperator/= (const MP_real &)
 Affect current point dividing coordinates by given real value. More...
 
bool operator== (const Point2D &) const
 Return true if current point coordinates are equal to given point ones. More...
 
bool operator!= (const Point2D &) const
 Return true if current point coordinates are different from given point ones. More...
 
MP_real get_abscissa () const
 Assessors get to the _x protected member variable. More...
 
void set_abscissa (MP_real x)
 Assessors set to the _x protected member variable. More...
 
MP_real get_ordinate () const
 Assessors get to the _y protected member variable. More...
 
void set_ordinate (MP_real y)
 Assessors set to the _y protected member variable. More...
 
MP_string debug () const
 Get debug information. More...
 

Protected Attributes

MP_real _x
 Point abscissa. More...
 
MP_real _y
 Point ordinate. More...
 

Friends

Point2D operator- (const Point2D &)
 Return a new point where _x = -x and _y = -y. More...
 
Point2D operator+ (const Point2D &, const Point2D &)
 Add two points. More...
 
Point2D operator- (const Point2D &, const Point2D &)
 Subtract two points. More...
 
Point2D operator* (const Point2D &, const Point2D &)
 Multiply coordinates of two points (_x*x, _y*y) More...
 
Point2D operator* (const MP_real &, const Point2D &)
 Multiply given point coordinates by the given real value. More...
 
Point2D operator* (const Point2D &, const MP_real &)
 Multiply given point coordinates by the given real value. More...
 
Point2D operator/ (const Point2D &, const Point2D &)
 Divide coordinates of two points (_x/x, _y/y) More...
 
Point2D operator/ (const MP_real &, const Point2D &)
 Divide given point coordinates by the given real value. More...
 
Point2D operator/ (const Point2D &, const MP_real &)
 Divide given point coordinates by the given real value. More...
 
MP_real sqnorm (const Point2D &)
 Return the square norm of segment between origin and given point. More...
 
MP_real lgth (const Point2D &)
 Return the distance of the segment between origin and given point. More...
 
MP_real arc_tan (const Point2D &)
 Return the arc tangante between origin and given point. More...
 
std::ostream & operator<< (std::ostream &, const Point2D &)
 Print given point coordinates into an output stream. More...
 
std::istream & operator>> (std::istream &, Point2D &)
 Initialize given point coordinates from an input stream. More...
 

Constructor & Destructor Documentation

◆ Point2D() [1/2]

Point2D::Point2D ( const MP_real &  x = 0.,
const MP_real &  y = 0. 
)

Default constructor.

◆ Point2D() [2/2]

Point2D::Point2D ( const Point2D )

Copy constructor.

◆ ~Point2D()

virtual Point2D::~Point2D ( )
virtual

Destructor.

Member Function Documentation

◆ debug()

MP_string Point2D::debug ( ) const

Get debug information.

◆ distance()

MP_real Point2D::distance ( const Point2D ) const

Return distance between current point and given point reference.

◆ get_abscissa()

MP_real Point2D::get_abscissa ( ) const
inline

Assessors get to the _x protected member variable.

◆ get_ordinate()

MP_real Point2D::get_ordinate ( ) const
inline

Assessors get to the _y protected member variable.

◆ operator!=()

bool Point2D::operator!= ( const Point2D ) const

Return true if current point coordinates are different from given point ones.

◆ operator*=()

Point2D& Point2D::operator*= ( const MP_real &  )

Affect current point multipling coordinates by given real value.

◆ operator+=()

Point2D& Point2D::operator+= ( const Point2D )

Affect current point adding given reference point.

◆ operator-=()

Point2D& Point2D::operator-= ( const Point2D )

Affect current point substracting given reference point.

◆ operator/=()

Point2D& Point2D::operator/= ( const MP_real &  )

Affect current point dividing coordinates by given real value.

◆ operator=()

Point2D& Point2D::operator= ( const Point2D )

Affect current point by given reference point.

◆ operator==()

bool Point2D::operator== ( const Point2D ) const

Return true if current point coordinates are equal to given point ones.

◆ reset()

Point2D& Point2D::reset ( const MP_real &  x = 0.,
const MP_real &  y = 0. 
)

Reset current point coordinates to new values.

◆ rotate() [1/2]

Point2D& Point2D::rotate ( const Point2D center,
const MP_real &  angle 
)

Rotate a point around a center (angle in radian)

◆ rotate() [2/2]

Point2D& Point2D::rotate ( const Point2D center,
const MP_real &  cosinus,
const MP_real &  sinus 
)

Rotate a point around a center given the cosinus and the sinus of the angle.

◆ rotate_half_pi()

Point2D& Point2D::rotate_half_pi ( )

Rotate 90° current point anticlockwise.

◆ rotate_inv() [1/2]

Point2D& Point2D::rotate_inv ( const Point2D center,
const MP_real &  angle 
)

Inverse rotate a point around a center (angle in radian)

◆ rotate_inv() [2/2]

Point2D& Point2D::rotate_inv ( const Point2D center,
const MP_real &  cosinus,
const MP_real &  sinus 
)

Inverse rotate a point around a center given the cosinus and the sinus of the angle.

◆ rotate_pi()

Point2D& Point2D::rotate_pi ( )

Rotate 180° current point anticlockwise.

◆ scalar()

MP_real Point2D::scalar ( const Point2D ) const

Return the scalar product (_x*x + _y*y) between current point and given point reference.

◆ set_abscissa()

void Point2D::set_abscissa ( MP_real  x)
inline

Assessors set to the _x protected member variable.

◆ set_ordinate()

void Point2D::set_ordinate ( MP_real  y)
inline

Assessors set to the _y protected member variable.

◆ transform()

Point2D& Point2D::transform ( const Point2D translate,
const Point2D dilate,
bool  do_round = false 
)

Return new point dilated.

◆ vectorial()

MP_real Point2D::vectorial ( const Point2D ) const

Return the vectorial product (_x*y - _y*x) between current point and given point reference.

Friends And Related Function Documentation

◆ arc_tan

MP_real arc_tan ( const Point2D )
friend

Return the arc tangante between origin and given point.

◆ lgth

MP_real lgth ( const Point2D )
friend

Return the distance of the segment between origin and given point.

◆ operator* [1/3]

Point2D operator* ( const MP_real &  ,
const Point2D  
)
friend

Multiply given point coordinates by the given real value.

◆ operator* [2/3]

Point2D operator* ( const Point2D ,
const MP_real &   
)
friend

Multiply given point coordinates by the given real value.

◆ operator* [3/3]

Point2D operator* ( const Point2D ,
const Point2D  
)
friend

Multiply coordinates of two points (_x*x, _y*y)

◆ operator+

Point2D operator+ ( const Point2D ,
const Point2D  
)
friend

Add two points.

◆ operator- [1/2]

Point2D operator- ( const Point2D )
friend

Return a new point where _x = -x and _y = -y.

◆ operator- [2/2]

Point2D operator- ( const Point2D ,
const Point2D  
)
friend

Subtract two points.

◆ operator/ [1/3]

Point2D operator/ ( const MP_real &  ,
const Point2D  
)
friend

Divide given point coordinates by the given real value.

◆ operator/ [2/3]

Point2D operator/ ( const Point2D ,
const MP_real &   
)
friend

Divide given point coordinates by the given real value.

◆ operator/ [3/3]

Point2D operator/ ( const Point2D ,
const Point2D  
)
friend

Divide coordinates of two points (_x/x, _y/y)

◆ operator<<

std::ostream& operator<< ( std::ostream &  ,
const Point2D  
)
friend

Print given point coordinates into an output stream.

◆ operator>>

std::istream& operator>> ( std::istream &  ,
Point2D  
)
friend

Initialize given point coordinates from an input stream.

◆ sqnorm

MP_real sqnorm ( const Point2D )
friend

Return the square norm of segment between origin and given point.

Member Data Documentation

◆ _x

MP_real Point2D::_x
protected

Point abscissa.

◆ _y

MP_real Point2D::_y
protected

Point ordinate.