ISeeML  1.0
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
iSeeML::geom::Point Class Reference

This class defines 2D geometric points, defined by their Cartesian coordinates. More...

#include <Point.hpp>

Inheritance diagram for iSeeML::geom::Point:
Inheritance graph
[legend]
Collaboration diagram for iSeeML::geom::Point:
Collaboration graph
[legend]

Public Member Functions

 Point ()
 The default constructor, returning the frame origin (0,0).
 
 Point (const double &x, const double &y)
 The main constructor, creating a point from its Cartesian coordinates (Polar coordinates are not used for points in ISeeML). More...
 
iSeeML::Objectclone () const
 Description method, giving a copy of the current point. More...
 
void writeTo (ostream &O) const
 Description method, writing a description of the point into a stream: Cartesian coordinate in each dimension is written, between paranthesis and separated by commas. More...
 
const double & xCoord () const
 Description method, giving the point's first coordinate. More...
 
const double & yCoord () const
 Description method, giving the point's second coordinate. More...
 
PointmoveTo (const double &x, const double &y)
 Modification method, moving the point to a given position. More...
 
Pointtranslate (const iSeeML::geom::Vector &v)
 Modification method, translating the point along a vector. More...
 
bool operator== (const Point &other) const
 Equality operator between points. More...
 
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 vector. More...
 
Point operator- (const iSeeML::geom::Vector &v) const
 Difference operator between a point and a vector, giving the translation of the current point along the opposite of the vector. More...
 
iSeeML::geom::Vector operator- (const Point &other) const
 Difference operator between two points, giving the vector connecting these points. More...
 
double distance (const Point &other) const
 Various method, giving the distance between two points. More...
 
double sqrDist (const Point &other) const
 Gives the square of the distance between two points. More...
 
- Public Member Functions inherited from iSeeML::geom::Object
virtual bool operator== (const iSeeML::geom::Object &other) const
 Equality operator between geometric objects. More...
 
- Public Member Functions inherited from iSeeML::Object
virtual ~Object ()
 This virtual class needs a virtual destructor.
 
virtual const string className () const
 Description method, giving the object's class name. More...
 
bool sameClass (const iSeeML::Object &other)
 Method verifying that a given object has the same type (same class name) than the current one. More...
 

Static Public Attributes

static const string ClassName
 The class name is public, as this class can be instanced. More...
 

Protected Member Functions

int algDimension () const
 Description method, giving the dimension of the containing space (2) when this point is considered as an algebraic vector. More...
 
double algCoord (const int i) const
 Description method, giving Cartesian coordinate of given index of the point. More...
 
- Protected Member Functions inherited from iSeeML::Object
virtual void algWriteTo (ostream &O) const
 Description method for algebraic vectors, writing this vector in a given output stream: coordinates for each dimension are written, between paranthesis and separated by commas. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from iSeeML::Object
template<class T >
static const T & min (const T &a, const T &b)
 Method giving the minimum of two elements. More...
 
template<class T >
static const T & max (const T &a, const T &b)
 Method giving the maximum of two elements. More...
 
static double sqr (const double &x)
 Method giving the square of a double. More...
 
static double mod2pi (const double &theta)
 Method giving the angle between - $\pi$ (excluded) and $\pi$ (included), which is equal to a given angle modulo 2 $\pi$. More...
 
static double rad2deg (const double &theta)
 Method transforming an angle in radian, $x \pi$ with $x$ between -1 (excluded) and 1 (included), into its equivalent in degree, i.e. More...
 
static double deg2rad (const double &theta)
 Method transforming an angle in degree, $90 x$ with $x$ between -1 (excluded) and 1 (included), into its equivalent in radian, i.e. More...
 
static bool isPositive (const double &x)
 Method telling whether a double is strictly positive. More...
 
static bool isNegative (const double &x)
 Method telling whether a double is strictly negative. More...
 
static bool isZero (const double &x)
 Method comparing a double to zero. More...
 
static int sign (const double &x)
 Method giving the sign of a double. More...
 

Detailed Description

This class defines 2D geometric points, defined by their Cartesian coordinates.

This class contains description methods giving Cartesian coordinates as well as the writeTo method, a modification method giving translation of the point, the corresponding operator as well as the equality operator and difference operators between a point and a vector or between two points,and at last a method computing the distance separating two points.

Author
Alexis Scheuer.
Version
1.0
Examples:
wxGuiFwd.cpp.

Constructor & Destructor Documentation

iSeeML::geom::Point::Point ( const double &  x,
const double &  y 
)
inline

The main constructor, creating a point from its Cartesian coordinates (Polar coordinates are not used for points in ISeeML).

Parameters
xthe first Cartesian coordinate of the point,
ythe second Cartesian coordinate of the point.
See also
xCoord, yCoord.

Member Function Documentation

double iSeeML::geom::Point::algCoord ( const int  i) const
inlineprotectedvirtual

Description method, giving Cartesian coordinate of given index of the point.

Parameters
ithe index of the searched Cartesian coordinate.
Precondition
the parameter is an index, and should be equal to one or two. If not, and if ISEEML_CHECK_GEOM_POINT_PRECOND is defined (see CompilerFlags.h), an error is generated.
Returns
the double coordinate associated to the index if this one is between 1 and dimension, or 0.
See also
xCoord, yCoord, algDimension.

Reimplemented from iSeeML::Object.

int iSeeML::geom::Point::algDimension ( ) const
inlineprotectedvirtual

Description method, giving the dimension of the containing space (2) when this point is considered as an algebraic vector.

This representation is mainly used to define a unified writeTo. Dimension cannot be static, as it is virtual.

Reimplemented from iSeeML::Object.

iSeeML::Object& iSeeML::geom::Point::clone ( ) const
inlinevirtual

Description method, giving a copy of the current point.

This clone is dynamically allocated (using default copy constructor), it has to be deleted later.

Returns
a copy/clone of the current point.

Implements iSeeML::Object.

double iSeeML::geom::Point::distance ( const Point other) const
inline

Various method, giving the distance between two points.

It simply computes the length of the connecting vector.

Parameters
otheranother point.
Returns
the distance between the two points.
See also
operator-(const iSeeML::geom::Point&), iSeeML::geom::Vector::length.
Point& iSeeML::geom::Point::moveTo ( const double &  x,
const double &  y 
)
inline

Modification method, moving the point to a given position.

The original point is changed.

Parameters
xthe first coordinate of the position,
ythe second coordinate of the position.
Returns
the point, after tranformation.
See also
xCoord, yCoord.
Point iSeeML::geom::Point::operator+ ( const iSeeML::geom::Vector v) const
inline

Sum operator between a point and a vector, giving the translation of the current point along the vector.

Parameters
vthe vector of the translation.
Returns
the translated point.
See also
translate.
Point iSeeML::geom::Point::operator- ( const iSeeML::geom::Vector v) const
inline

Difference operator between a point and a vector, giving the translation of the current point along the opposite of the vector.

Parameters
vthe opposite vector of the translation.
Returns
the translated point.
See also
operator+, iSeeML::geom::Vector::operator-().
iSeeML::geom::Vector iSeeML::geom::Point::operator- ( const Point other) const
inline

Difference operator between two points, giving the vector connecting these points.

Parameters
otheranother point.
Returns
the vector going from the second given point to the first one (the current).
bool iSeeML::geom::Point::operator== ( const Point other) const
inline

Equality operator between points.

Parameters
otheranother point.
Returns
whether the two points are equal.
See also
xCoord, yCoord, iSeeML::Object::isZero.
double iSeeML::geom::Point::sqrDist ( const Point other) const
inline

Gives the square of the distance between two points.

It simply computes the square length of the connecting vector.

Parameters
otheranother point.
Returns
the square of the distance between the two points.
See also
operator-(const iSeeML::geom::Point&), iSeeML::geom::Vector::sqrLength.
Point& iSeeML::geom::Point::translate ( const iSeeML::geom::Vector v)
inlinevirtual

Modification method, translating the point along a vector.

The original point is changed (addition without modification is obtained using operator+(const iSeeML::geom::Vector&) const).

Parameters
vthe vector of the translation.
Returns
the point, after translation.

Implements iSeeML::geom::Object.

void iSeeML::geom::Point::writeTo ( ostream &  O) const
inlinevirtual

Description method, writing a description of the point into a stream: Cartesian coordinate in each dimension is written, between paranthesis and separated by commas.

Parameters
Othe output stream in which description is written.

Implements iSeeML::Object.

const double& iSeeML::geom::Point::xCoord ( ) const
inline

Description method, giving the point's first coordinate.

Returns
the point's first coordinate.
Examples:
wxGuiFwd.cpp.
const double& iSeeML::geom::Point::yCoord ( ) const
inline

Description method, giving the point's second coordinate.

Returns
the point's second coordinate.
Examples:
wxGuiFwd.cpp.

Member Data Documentation

const string iSeeML::geom::Point::ClassName
static

The class name is public, as this class can be instanced.

See also
className.

The documentation for this class was generated from the following file: