Developer Documentation
Centre for Vision, Speech & Signal Processing
USER IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
Point2dC::Point2dC(istream &)
Point2dC::Point2dC(void)
Point2dC::Point2dC(SizeT)
Point2dC::Point2dC(const CoordT,const CoordT)
Point2dC::Point2dC(const Point2dC &)
Point2dC::Point2dC(const Tuple2C &)
Point2dC::Point2dC(const Index2dC &)
Point2dC::operator=(const Point2dC &)
Point2dC::operator[](IndexT) const
Point2dC::operator[](IndexT)
Point2dC::X(void) const
Point2dC::Y(void) const
Point2dC::X(void)
Point2dC::Y(void)
Point2dC::Point(void) const
Point2dC::Point(void)
Point2dC::operator==(const Point2dC &) const
Point2dC::operator!=(const Point2dC &) const
Point2dC::operator>(const Point2dC &) const
Point2dC::operator<(const Point2dC &) const
Point2dC::operator>=(const Point2dC &) const
Point2dC::operator<=(const Point2dC &) const
Point2dC::OneBigger(const Point2dC &) const
Point2dC::SetZero(void)
Point2dC::Set(const Point2dC &)
Point2dC::Set(const CoordT,const CoordT)
Point2dC::SetMinimum(const Point2dC &)
Point2dC::SetMaximum(const Point2dC &)
Point2dC::MinIndex(void) const
Point2dC::MaxIndex(void) const
Point2dC::AbsMinIndex(void) const
Point2dC::AbsMaxIndex(void) const
Point2dC::Min(void) const
Point2dC::Max(void) const
Point2dC::operator+=(const Point2dC &)
Point2dC::operator-=(const Point2dC &)
Point2dC::operator*=(const Point2dC &)
Point2dC::operator/=(const Point2dC &)
Point2dC::operator*=(const RealT)
Point2dC::operator/=(const RealT)
Point2dC::operator+(const Point2dC &) const
Point2dC::operator-(const Point2dC &) const
Point2dC::operator*(const Point2dC &) const
Point2dC::operator/(const Point2dC &) const
Point2dC::operator*(const RealT) const
Point2dC::operator/(const RealT) const
Point2dC::operator+(const Vector2dC &) const
Point2dC::operator&(const Point2dC &) const
Point2dC::Translation(const Point2dC &) const
Point2dC::SqrEuclidDistance(const Point2dC &) const
Point2dC::EuclidDistance(const Point2dC &) const
Point2dC::EDistanceFromOrigin(void) const
Point2dC::CosAngle(const Point2dC &,const Point2dC &) const
Point2dC::Angle(const Point2dC &,const Point2dC &) const
Point2dC::AngleOrigin(const Point2dC &) const
Point2dC::MidPoint(const Point2dC &) const
Point2dC::Center(const Point2dC &) const
Point2dC::N(void) const
Point2dC::AbsDistance(const Point2dC &) const
Point2dC::MahalanobisDistance(const Point2dC &,const Matrix2d2C &)
Point2dC::Sum(void) const
Point2dC::SumAbs(void) const
Point2dC::Sqrt(void)
Point2dC::Abs(void)
Point2dC::Normalize(void)
Point2dC::NormalizeSum(void)
Point2dC::MakeUnit(const IndexT)
Point2dC::SlopeAndIntercept(const Point2dC &) const
Point2dC::SlopeAndInterceptY(const Point2dC &) const
Point2dC::Bisector(const Point2dC &) const
Point2dC::Area2(const Point2dC &,const Point2dC &) const
Point2dC::IsToLeft(const Point2dC &,const Point2dC &) const
Point2dC::IsToLeftOn(const Point2dC &,const Point2dC &) const
Point2dC::IsCollinear(const Point2dC &,const Point2dC &) const
Point2dC::IsExactlyCollinear(const Point2dC &,const Point2dC &) const
Point2dC::IsProperIntersection(const Point2dC &,const Point2dC &,const Point2dC &) const
Point2dC::IsBetween(const Point2dC &,const Point2dC &) const
Point2dC::IsIntersected(const Point2dC &,const Point2dC &,const Point2dC &) const
Point2dC::FixAlmostZero(void)
Point2dC::SetZeroDistance(RealT)
Point2dC::IsAlmostZero(RealT)
Point2dC::SetRelZero(RealT)
Point2dC::IsRelZero(RealT)
Point2dC::RAbs(RealT)
Point2dC::operator>>(istream &,Point2dC &)
Point2dC::Set(const RealT,const RealT)
Point2dC
 
Point in 2D space
 
include "amma/Point2d.hh"
User Level:Default
Library:Mag2
Example:ex_kutta.cc
Section:Geometry.2-D
In Scope:std

Comments:
The class represents the mathematical entity point (or a pair of numbers) in 2 dimensional space. The point contains 2 real numbers which serve as its coordinates. There is no assumption about the space metric.

Derived Classes: Enumerated types:
enum anon_enum?12 { dim = 2 } ;
the dimension of the point space

Typedefs:
typedef StdTypeC::RealT CoordT;
A point coordinate.

typedef StdTypeC::RealT DistanceT;
Distance of points.

typedef StdTypeC::RealT AngleT;
Angle of three points (rad).

typedef StdTypeC::RealT CosAngleT;
The cosinus of an angle of three points.

Variables:
const RealT defRelZero;
default value of 'relZero'

RealT relZero;
small relative error

const RealT defZeroDistance;
default value of 'zeroDistance'

RealT zeroDistance;
distance of 2 points smaller than 'zeroDistance' is treated as zero.

RealT sqrZeroDistance;
square of 'zeroDistance'.

CoordT a[];

Methods:
Point2dC(istream & inS)
Reads and creates the point from the input stream.

Point2dC()
Constructs the point whose coordinates are zeros.

explicit Point2dC(SizeT dim)
Construct a new 2-d point.
For compatability with N-D Points.

Point2dC(const CoordT xCoor,const CoordT yCoor)
Constructs the point (xCoor, yCoor).

Point2dC(const Point2dC & point)
Copy constructor.

Point2dC(const Tuple2C<RealT,RealT> & point)
Constructor.

Point2dC(const Index2dC & ind)
Converts the grid coordinates into the coordinates of point.
The Mpxl library is required for this constructor.

const Point2dC & operator=(const Point2dC & point)
Assigment of point.
Access to the coordinates. --------------------------

const CoordT & operator[](IndexT i) const
Returns the value of the (i+1)-th coordinate.

CoordT & operator[](IndexT i)
Access the value of the (i+1)-th coordinate.

const CoordT & X() const
Returns the value of the 1-st coordinate.

const CoordT & Y() const
Returns the value of the 2-st coordinate.

CoordT & X()
Access the value of the 1-st coordinate.

CoordT & Y()
Access the value of the 2-nd coordinate.

const Point2dC & Point() const
Access to this constant object.

Point2dC & Point()
Access to the point.
Logical conditions. -------------------

BooleanT operator==(const Point2dC & point) const
Returns TRUE if 2 points are the same point.
Two points are claimed to be same iff their relative distance error is small (under 'relZero' threshold). If both points are close to the origin of the coordinate system, their absolute distance error is compared to 'zeroDistance'.

BooleanT operator!=(const Point2dC & point) const
Returns TRUE if 2 points are different.
2 points are different iff they are not equal in the sense of the operator '=='.

BooleanT operator>(const Point2dC & point) const
Returns TRUE if both coordinates are bigger than the coordinates of the point.

BooleanT operator<(const Point2dC & point) const
Returns TRUE if both coordinates are smaller than the coordinates of the point.

BooleanT operator>=(const Point2dC & point) const
Returns TRUE if both coordinates are bigger or exactly equal to the coordinates of the point.

BooleanT operator<=(const Point2dC & point) const
Returns TRUE if both coordinates are smaller or exactly equal to the coordinates of the point.

BooleanT OneBigger(const Point2dC & point) const
Returns TRUE if one coordinate is bigger then the related one of the point.
Setting of the coordinates. ---------------------------

Point2dC & SetZero()
Sets both coordinates to be 0.

void Set(const Point2dC & point)
Sets both coordinates according to the values of 'point'.

void Set(const CoordT xCoor,const CoordT yCoor)
Sets the 1-st coordinate to be 'xCoor' and the 2nd one to be 'yCoor'.

Point2dC & SetMinimum(const Point2dC & point)
Sets the point coordinates to minimal value from both points.

Point2dC & SetMaximum(const Point2dC & point)
Sets the point coordinates to maximal value from both points.
Information about extrems. --------------------------

IndexT MinIndex() const
Returns the index of the minimum coordinate.

IndexT MaxIndex() const
Returns the index of the maximum coordinate.

IndexT AbsMinIndex() const
Returns the index of the minimum coordinate in absolute value.

IndexT AbsMaxIndex() const
Returns the index of the maximum coordinate in absolute value.

CoordT Min() const
Returns the minimum coordinate.

CoordT Max() const
Returns the maximum coordinate.
Arithmetical operations. ------------------------

const Point2dC & operator+=(const Point2dC & point)
Adds the values of the coordinates of the 'point' to this point.

const Point2dC & operator-=(const Point2dC & point)
Subtracts the values of the coordinates of the 'point' from this point.

const Point2dC & operator*=(const Point2dC & point)
Multiplies items by point items.

const Point2dC & operator/=(const Point2dC & point)
Divides items by point items.

const Point2dC & operator*=(const RealT alpha)
Multiplies both coordinates by 'alpha'.

const Point2dC & operator/=(const RealT alpha)
Divides both coordinates by 'alpha'.

Point2dC operator+(const Point2dC & point) const
Returns the point which is the sum of this point and the 'point'.

Vector2dC operator-(const Point2dC & p) const
Returns the difference between 2 points.

Point2dC operator*(const Point2dC & v) const
Returns the points which coordinates are results of multiplication of this point and 'v' points item by item.

Point2dC operator/(const Point2dC & v) const
Returns the points which coordinates are results of division of this point and 'v' points item by item.

Point2dC operator*(const RealT alpha) const
Returns the point which coordinates are multiplied by 'alpha'.

Point2dC operator/(const RealT alpha) const
Returns the point which coordinates are divided by 'alpha'.

Point2dC operator+(const Vector2dC & v) const
Returns the point which is determined by A+v, where A is this point.

RealT operator&(const Point2dC & p) const
Returns the sum X()*p.X() + Y()*p.Y().
In 2 dimensional Euclidian vector space the result is equivalent to dot product of 2 vectors. Euclidian geometry. -------------------

Point2dC Translation(const Point2dC & newOrigin) const
Returns the point with coordinates related to the new origin 'newOrigin'.

RealT SqrEuclidDistance(const Point2dC & point) const
Returns the square of the Euclid distance between two points.

RealT EuclidDistance(const Point2dC & point) const
Returns the Euclid distance between two points.

RealT EDistanceFromOrigin() const
Returns the Euclid distance from the origin of coordinate system.

CosAngleT CosAngle(const Point2dC & m,const Point2dC & b) const
Returns the cosinus of the angle (this point, m, b).

AngleT Angle(const Point2dC & m,const Point2dC & b) const
Returns the angle (this point, m, b).
The angle in the range 0 to PI is not oriented.

AngleT AngleOrigin(const Point2dC & p) const
Returns the angle in rad between points 'this point', (0,0,0), and the point 'p'.
The angle in the range 0 to PI is not oriented.

Point2dC MidPoint(const Point2dC & p) const
Returns the point which is in the middle of this point and the point 'p'.

Point2dC Center(const Point2dC & point) const
Returns the point which is in the middle of 2 points.
Useful functions with points. -----------------------------

SizeT N() const
Returns the number of coordinates of this point.

RealT AbsDistance(const Point2dC & point) const
Returns the block distance between this point and 'point'.

RealT MahalanobisDistance(const Point2dC & mean,const Matrix2d2C & invCov)
Returns the Mahalanobis distance from the 'mean'. The 'invCov' is the inversion of the covariance matrix.

CoordT Sum() const
Returns the sum of coordinates.

CoordT SumAbs() const
Returns the sum of absolute value of coordinates.

Point2dC & Sqrt()
Changes all coordinates into their square root values.

Point2dC & Abs()
Changes all coordinates into their absolute values.

Point2dC & Normalize()
Scales the coordinates of the point to have the distance from the origin equal to 1.
The point is supposed to be different from the origin.

Point2dC & NormalizeSum()
Scales the coordinates of the point to have unit sum.
The point is supposed to be different from the origin.

Point2dC & MakeUnit(const IndexT i)
Scales the coordinates of the point that the i-th coordinate will be equal to 1.
The range of the index i is not checked. Line characteristics --------------------

Point2dC SlopeAndIntercept(const Point2dC & p) const
Returns the slope and the intercept according to the axis x of the line passing through
this point and the point p. The slope is the X() coordinate and the intercept is the Y() coordinate of the result point representing the line. The function does not check the singular case if both X() coordinate are equal.

Point2dC SlopeAndInterceptY(const Point2dC & p) const
Returns the slope and the intercept according to the axis y of the line passing through
this point and the point p. The slope is the X() coordinate and the intercept is the Y() coordinate of the result point representing the line. The function does not check the singular case if both X() coordinate are equal.

LineABC2dC Bisector(const Point2dC & point) const
Returns the line which is the bisector of both points.
Relative position of points ---------------------------

RealT Area2(const Point2dC & second,const Point2dC & third) const
Returns twice the signed area of the triangle determined by this, the second, and the third points.
Positive if 'this', 'second', 'third' are oriented counter-clockwise, and negative if clockwise. Ref.: - O'Rourke,J.: Computatinal geometry in C; Cambridge University Press, 1994, pp. 19-20

BooleanT IsToLeft(const Point2dC & from,const Point2dC & to) const
Returns TRUE if 'this' point is to the left of the directed line ('from', 'to') and not on this line.
Ref.: - O'Rourke,J.: Computatinal geometry in C; Cambridge University Press, 1994, pp. 30-31

BooleanT IsToLeftOn(const Point2dC & from,const Point2dC & to) const
Returns TRUE if 'this' point is to the left of or on the directed line ('from', 'to').
Ref.: - O'Rourke,J.: Computatinal geometry in C; Cambridge University Press, 1994, pp. 30-31

BooleanT IsCollinear(const Point2dC & p1,const Point2dC & p2) const
Returns TRUE if 'this' point is collinear with the points 'p1' and 'p2'.
Three points are collinear iff the smallest relative deviation of a point from the line created by the other points is smaller than 'relZero'.

BooleanT IsExactlyCollinear(const Point2dC & p1,const Point2dC & p2) const
Returns TRUE if 'this' point is collinear with the points 'p1' and 'p2'.
Three points are collinear iff the area of the created triangle is zero. Ref.: - O'Rourke,J.: Computatinal geometry in C; Cambridge University Press, 1994, pp. 30-31

BooleanT IsProperIntersection(const Point2dC & this2,const Point2dC & second1,const Point2dC & second2) const
Returns TRUE iff the line segment (this, this2) properly intersects the line segment (second1, second2): they share a point interior to both segments.
Ref.: - O'Rourke,J.: Computatinal geometry in C; Cambridge University Press, 1994, pp. 32-33

BooleanT IsBetween(const Point2dC & a,const Point2dC & b) const
Returns TRUE iff (*this, a, b) are collinear and
:'this' point lies on the closed segment . Ref.: - O'Rourke,J.: Computatinal geometry in C; Cambridge University Press, 1994, pp. 33-34

BooleanT IsIntersected(const Point2dC & this2,const Point2dC & second1,const Point2dC & second2) const
Returns TRUE iff segments and intersect, properly or improperly (one endpoint of one segment lies between the two endpoints of the other segment.
Ref.: - O'Rourke,J.: Computatinal geometry in C; Cambridge University Press, 1994, pp. 33-34 Computational precision. ------------------------

void FixAlmostZero()
If the absolute value of a coordinate is smaller than zeroDistance the function sets the coordinate to be zero.

RealT SetZeroDistance(RealT zero)
Sets the precision of the test of zero distance of points.
The function returns the previous value.

BooleanT IsAlmostZero(RealT a)
Returns TRUE if 'a' is smaller or equal to zeroDistance.

RealT SetRelZero(RealT zero)
Sets the precision of the relative error test.
The function returns the previous value.

BooleanT IsRelZero(RealT a)
Returns TRUE if 'a' is smaller than or equal to 'relZero'.

RealT RAbs(RealT t)
Returns the absolute value of the parameter t.

istream & operator>>(istream & inS,Point2dC & point)

void Set(const RealT xCoor,const RealT yCoor)


Programmer:Radek Marik, Documentation by CxxDoc: Tue Mar 20 10:49:27 2001