7 #ifndef ISEEML_GEOM_POINT_HH
8 #define ISEEML_GEOM_POINT_HH
12 #include <iSeeML/geom/Vector.hpp>
46 Point() : XCoord(0), YCoord(0) {}
57 Point(
const double& x,
const double& y) :
58 XCoord(x), YCoord(y) {}
90 const double&
xCoord()
const {
return XCoord; }
96 const double&
yCoord()
const {
return YCoord; }
124 switch (i) {
case 1 :
return xCoord();
125 case 2 :
return yCoord();
default:
126 #ifdef ISEEML_CHECK_GEOM_POINT_PRECOND
127 cerr <<
ClassName <<
"::coord: parameter " << i << endl
128 <<
" outside allowed values (1 or 2), returning zero..."
148 { XCoord = x; YCoord = y;
return *
this; }
160 { XCoord += v.
xCoord(); YCoord += v.
yCoord();
return *
this; }
201 {
return( *
this + (-v) ); }
231 {
return( (other - *
this).length() ); }
245 {
return( (other - *
this).sqrLength() ); }
249 #endif // end of definition
double algCoord(const int i) const
Description method, giving Cartesian coordinate of given index of the point.
Definition: Point.hpp:123
virtual void algWriteTo(ostream &O) const
Description method for algebraic vectors, writing this vector in a given output stream: coordinates f...
Definition: Object.hpp:161
double distance(const Point &other) const
Various method, giving the distance between two points.
Definition: Point.hpp:230
Point()
The default constructor, returning the frame origin (0,0).
Definition: Point.hpp:46
const double & yCoord() const
Description method, giving the point's second coordinate.
Definition: Point.hpp:96
static const string ClassName
The class name is public, as this class can be instanced.
Definition: Point.hpp:40
const double & xCoord() const
Description method, giving the point's first coordinate.
Definition: Point.hpp:90
bool operator==(const Point &other) const
Equality operator between points.
Definition: Point.hpp:173
iSeeML::Object & clone() const
Description method, giving a copy of the current point.
Definition: Point.hpp:72
Point & translate(const iSeeML::geom::Vector &v)
Modification method, translating the point along a vector.
Definition: Point.hpp:159
Point operator-(const iSeeML::geom::Vector &v) const
Difference operator between a point and a vector, giving the translation of the current point along t...
Definition: Point.hpp:200
void writeTo(ostream &O) const
Description method, writing a description of the point into a stream: Cartesian coordinate in each di...
Definition: Point.hpp:83
iSeeML::geom::Vector operator-(const Point &other) const
Difference operator between two points, giving the vector connecting these points.
Definition: Point.hpp:212
static bool isZero(const double &x)
Method comparing a double to zero.
Definition: Object.hpp:292
double sqrDist(const Point &other) const
Gives the square of the distance between two points.
Definition: Point.hpp:244
This class defines 2D geometric vectors, which can be defined by their Polar or Cartesian coordinates...
Definition: Vector.hpp:34
This class is the base class of ISeeML: every class of ISeeML inherits this one.
Definition: Object.hpp:47
int algDimension() const
Description method, giving the dimension of the containing space (2) when this point is considered as...
Definition: Point.hpp:107
This class defines basic 2D geometric objects, from which compound geometric objects are built.
Definition: BasicObject.hpp:21
Point & moveTo(const double &x, const double &y)
Modification method, moving the point to a given position.
Definition: Point.hpp:147
This class defines 2D geometric points, defined by their Cartesian coordinates.
Definition: Point.hpp:29
Point operator+(const iSeeML::geom::Vector &v) const
Sum operator between a point and a vector, giving the translation of the current point along the vect...
Definition: Point.hpp:187
Point(const double &x, const double &y)
The main constructor, creating a point from its Cartesian coordinates (Polar coordinates are not used...
Definition: Point.hpp:57
const double & yCoord() const
Description method, giving the vector's second Cartesian coordinate.
Definition: Vector.hpp:118
const double & xCoord() const
Description method, giving the vector's first Cartesian coordinate.
Definition: Vector.hpp:111