LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::tpoint< T > Class Template Reference
[Geometry Data Structures]

Two dimensional point, containing the coordinates x, y. More...

#include <ltiPoint.h>

Inheritance diagram for lti::tpoint< T >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef T value_type
typedef int size_type

Public Member Functions

 tpoint (const T newx=0, const T newy=0)
template<class U >
 tpoint (const tpoint< U > &p)
template<class U >
tpoint< T > & castFrom (const tpoint< U > &p)
tpoint< T > & set (const T tx, const T ty)
distanceTo (const tpoint< T > &c) const
distanceSqr (const tpoint< T > &c) const
absSqr () const
template<class U >
tpoint< T > & multiply (const U c)
template<class U >
tpoint< T > & multiply (const tpoint< T > &other, const U c)
template<class U >
tpoint< T > operator* (const U c) const
template<class U >
tpoint< T > & operator*= (const U c)
tpoint< T > operator* (const tpoint< T > &c) const
tpoint< T > & operator*= (const tpoint< T > &c)
tpoint< T > & emultiply (const tpoint< T > &a, const tpoint< T > &b)
tpoint< T > & emultiply (const tpoint< T > &c)
template<class U >
tpoint< T > & divide (const U c)
template<class U >
tpoint< T > & divide (const tpoint< T > &other, const U c)
template<class U >
tpoint< T > operator/ (const U c) const
template<class U >
tpoint< T > & operator/= (const U c)
tpoint< T > operator/ (const tpoint< T > &c) const
tpoint< T > & operator/= (const tpoint< T > &c)
tpoint< T > & edivide (const tpoint< T > &c)
tpoint< T > & edivide (const tpoint< T > &a, const tpoint< T > &b)
tpoint< T > operator% (const int c) const
tpoint< T > & add (const tpoint< T > &p)
tpoint< T > & add (const tpoint< T > &a, const tpoint< T > &b)
tpoint< T > operator+ (const tpoint< T > &p) const
tpoint< T > & operator+= (const tpoint< T > &p)
tpoint< T > & subtract (const tpoint< T > &p)
tpoint< T > & subtract (const tpoint< T > &a, const tpoint< T > &b)
tpoint< T > operator- (const tpoint< T > &p) const
tpoint< T > & operator-= (const tpoint< T > &p)
dot (const tpoint< T > &p) const
tpoint< T > & copy (const tpoint< T > &p)
tpoint< T > & operator= (const tpoint< T > &p)
bool operator== (const tpoint< T > &p) const
bool operator!= (const tpoint< T > &p) const
bool operator< (const tpoint< T > &p) const
bool operator> (const tpoint< T > &p) const
Access as vector



T & operator[] (const int i)
const T & operator[] (const int i) const
int size () const

Public Attributes

x
y

Detailed Description

template<class T>
class lti::tpoint< T >

Two dimensional point, containing the coordinates x, y.

The template type T will be the one used for each coordinate. For example tpoint<float> uses float for x and y.

This data structure simplifies the manipulation of 2D points providing simple interfaces for adding, substracting, distance (L2), and more.


Member Typedef Documentation

template<class T>
typedef int lti::tpoint< T >::size_type

Return type of the size() member.

template<class T>
typedef T lti::tpoint< T >::value_type

Used for the template-based interface for pixels as vectors.


Constructor & Destructor Documentation

template<class T>
lti::tpoint< T >::tpoint ( const T  newx = 0,
const T  newy = 0 
) [inline, explicit]

Default constructor.

template<class T>
template<class U >
lti::tpoint< T >::tpoint ( const tpoint< U > &  p  )  [inline]

Copy constructor.


Member Function Documentation

template<class T >
T lti::tpoint< T >::absSqr (  )  const [inline]

Return the square of the magnitude of the point.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

Referenced by lti::tpoint< T >::distanceSqr(), and lti::tpoint< T >::distanceTo().

template<class T>
tpoint< T > & lti::tpoint< T >::add ( const tpoint< T > &  a,
const tpoint< T > &  b 
) [inline]

Add the two other points and leave the result here.

Parameters:
a first point to be added
b second point to be added
Returns:
a reference to this point, which will contain a+b

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::add ( const tpoint< T > &  p  )  [inline]

Add given point to this point and leave the result here.

Parameters:
p the other point to be added to this one
Returns:
a reference to this point

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

Referenced by lti::tpoint< T >::operator+=().

template<class T>
template<class U >
tpoint<T>& lti::tpoint< T >::castFrom ( const tpoint< U > &  p  )  [inline]

Copy constructor.

template<class T>
tpoint< T > & lti::tpoint< T >::copy ( const tpoint< T > &  p  )  [inline]
template<class T>
T lti::tpoint< T >::distanceSqr ( const tpoint< T > &  c  )  const [inline]

Calculate square of distance to the point c.

This method is faster than distanceTo (because it does not compute the square root of a*a + b*b).

References lti::tpoint< T >::absSqr().

Referenced by lti::distanceSqr().

template<class T>
T lti::tpoint< T >::distanceTo ( const tpoint< T > &  c  )  const [inline]

Calculate distance to the point c.

References lti::tpoint< T >::absSqr(), and lti::sqrt().

template<class T>
template<class U >
tpoint<T>& lti::tpoint< T >::divide ( const tpoint< T > &  other,
const U  c 
) [inline]

Divide each component of other other tpoint<T> with a given factor.

template<class T>
template<class U >
tpoint<T>& lti::tpoint< T >::divide ( const U  c  )  [inline]

Divide each component of tpoint<T> with a given factor.

template<class T>
T lti::tpoint< T >::dot ( const tpoint< T > &  p  )  const [inline]

Dot product with another point.

Returns:
this->x*p.x + this->y*p.y.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::edivide ( const tpoint< T > &  a,
const tpoint< T > &  b 
) [inline]

Elementwise division of each component of the points.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::edivide ( const tpoint< T > &  c  )  [inline]

Elementwise division of each component of the points.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::emultiply ( const tpoint< T > &  c  )  [inline]

Multiplies elementwise the components of this and the point c, and leave the result here.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::emultiply ( const tpoint< T > &  a,
const tpoint< T > &  b 
) [inline]

Multiplies elementwise the components of a and b and leave the result here.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
template<class U >
tpoint<T>& lti::tpoint< T >::multiply ( const tpoint< T > &  other,
const U  c 
) [inline]

Multiply the other point tpoint<T> with a given factor.

template<class T>
template<class U >
tpoint<T>& lti::tpoint< T >::multiply ( const U  c  )  [inline]

Multiply tpoint<T> with a given factor.

template<class T>
bool lti::tpoint< T >::operator!= ( const tpoint< T > &  p  )  const [inline]

Operator !=.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T >
tpoint< T > lti::tpoint< T >::operator% ( const int  c  )  const [inline]

Modulo c of the integer part of each component of the point.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > lti::tpoint< T >::operator* ( const tpoint< T > &  c  )  const [inline]

Multiplies elementwise the components of this and the point c.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
template<class U >
tpoint<T> lti::tpoint< T >::operator* ( const U  c  )  const [inline]

Multiply tpoint<T> with a given factor.

template<class T>
tpoint< T > & lti::tpoint< T >::operator*= ( const tpoint< T > &  c  )  [inline]

Multiplies elementwise the components of this and the point c.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
template<class U >
tpoint<T>& lti::tpoint< T >::operator*= ( const U  c  )  [inline]

Multiply tpoint<T> with a given factor.

template<class T>
tpoint< T > lti::tpoint< T >::operator+ ( const tpoint< T > &  p  )  const [inline]

Operator + is simmilar to add, but a new point is returned, i.e.

this point will not change.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::operator+= ( const tpoint< T > &  p  )  [inline]

Operator += is an alias for add().

References lti::tpoint< T >::add().

template<class T>
tpoint< T > lti::tpoint< T >::operator- ( const tpoint< T > &  p  )  const [inline]

Operator -.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::operator-= ( const tpoint< T > &  p  )  [inline]

Operator -=.

References lti::tpoint< T >::subtract().

template<class T>
tpoint< T > lti::tpoint< T >::operator/ ( const tpoint< T > &  c  )  const [inline]

Elementwise division of each component of the points.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
template<class U >
tpoint<T> lti::tpoint< T >::operator/ ( const U  c  )  const [inline]

Divide each component of tpoint<T> by a given factor.

template<class T>
tpoint< T > & lti::tpoint< T >::operator/= ( const tpoint< T > &  c  )  [inline]

Elementwise division of each component of the points.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
template<class U >
tpoint<T>& lti::tpoint< T >::operator/= ( const U  c  )  [inline]

Divide each component of tpoint<T> by a given factor.

template<class T>
bool lti::tpoint< T >::operator< ( const tpoint< T > &  p  )  const [inline]

Operator < a point is "smaller" than another one if its coordinates produce an earlier display of the point in the monitor.

i.e. if it has a smaller y component or (if the y components are the same) if the x component is smaller

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint<T>& lti::tpoint< T >::operator= ( const tpoint< T > &  p  )  [inline]

Operator =.

template<class T>
bool lti::tpoint< T >::operator== ( const tpoint< T > &  p  )  const [inline]

Operator ==.

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
bool lti::tpoint< T >::operator> ( const tpoint< T > &  p  )  const [inline]

Operator > a point is "bigger" than another one if its coordinates produce an later display of the point in the monitor.

i.e. if it has a bigger y component or (if the y components are the same) if the x component is bigger

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
const T& lti::tpoint< T >::operator[] ( const int  i  )  const [inline]

Used to simulate read-only vector access.

It is slower than the normal access to the elements x and y, but allow the use of point in templates expecting a vector-like structure.

The correspondence between the elements of the vector and the color components will be [0] for x and [1] for y

template<class T>
T& lti::tpoint< T >::operator[] ( const int  i  )  [inline]

Used to simulate vector access.

It is slower than the normal access to the elements x and y, but allow the use of point in templates expecting a vector-like structure.

The correspondence between the elements of the vector and the color components will be [0] for x and [1] for y

template<class T>
tpoint<T>& lti::tpoint< T >::set ( const T  tx,
const T  ty 
) [inline]

Set the coordinate values and return a reference to this point.

template<class T>
int lti::tpoint< T >::size (  )  const [inline]

Used to simulate the vector size.

template<class T>
tpoint< T > & lti::tpoint< T >::subtract ( const tpoint< T > &  a,
const tpoint< T > &  b 
) [inline]

Subtract the two other points and leave the result here.

Parameters:
a first point
b point to be subtracted from the first one
Returns:
a reference to this point, which will contain a-b

References lti::tpoint< T >::x, and lti::tpoint< T >::y.

template<class T>
tpoint< T > & lti::tpoint< T >::subtract ( const tpoint< T > &  p  )  [inline]

Member Data Documentation

template<class T>
T lti::tpoint< T >::x

Coordinate x.

Referenced by lti::tpoint< T >::absSqr(), lti::tpoint< T >::add(), lti::decimation::apply(), lti::bicubicInterpolator< T >::apply(), lti::epsDraw< T >::arrow(), lti::drawBase< rgbPixel >::arrow(), lti::draw< rgbPixel >::arrow(), lti::kernel2D< ubyte >::at(), lti::epsDraw< T >::box(), lti::drawBase< rgbPixel >::box(), lti::draw< rgbPixel >::box(), lti::tpoint< unsigned int >::castFrom(), lti::hPoint2D< T >::castFrom(), lti::hPoint2D< T >::castTo(), lti::chainCode::chainCode(), lti::cityBlockDistance(), lti::tpoint< T >::copy(), lti::hPoint3D< T >::copy(), lti::hPoint2D< T >::copy(), lti::tpoint< unsigned int >::divide(), lti::tpoint< T >::dot(), lti::tpoint< T >::edivide(), lti::tpoint< T >::emultiply(), lti::draw< rgbPixel >::enterPX(), lti::kernel2D< ubyte >::firstColumn(), lti::sparseMatrix< T >::forceAt(), lti::tline< T >::getIntersectionPoint(), lti::tline< T >::getIntersectionPointXPol(), lti::panTiltUnit::getMaxPanTilt(), lti::panTiltUnit::getMinPanTilt(), lti::panTiltUnit::getPanTilt(), lti::epsDraw< T >::horizontalLine(), lti::drawBase< rgbPixel >::horizontalLine(), lti::draw< T >::inCanvas(), lti::squareConvolution< T, A >::parameters::initSquare(), lti::maximumFilter< T >::parameters::initSquare(), lti::trectangle< T >::isClose(), lti::trectangle< T >::isInside(), lti::fillPattern::isSet(), lti::kernel2D< ubyte >::lastColumn(), lti::epsDraw< T >::line(), lti::drawBase< rgbPixel >::line(), lti::draw< rgbPixel >::line(), lti::epsDraw< T >::lineTo(), lti::drawBase< rgbPixel >::lineTo(), lti::draw< rgbPixel >::lineTo(), lti::drawBase< rgbPixel >::marker(), lti::tpoint< unsigned int >::multiply(), lti::tpoint< T >::operator!=(), lti::tpoint< T >::operator%(), lti::tpoint< T >::operator*(), lti::tpoint< unsigned int >::operator*(), lti::tpoint< T >::operator*=(), lti::tpoint< unsigned int >::operator*=(), lti::tpoint< T >::operator+(), lti::tpoint< T >::operator-(), lti::tpoint< T >::operator/(), lti::tpoint< unsigned int >::operator/(), lti::tpoint< T >::operator/=(), lti::tpoint< unsigned int >::operator/=(), lti::tpoint< T >::operator<(), lti::tpoint< T >::operator==(), lti::tpoint< T >::operator>(), lti::tpoint< unsigned int >::operator[](), lti::hPoint3D< T >::project(), lti::read(), lti::epsDraw< T >::rectangle(), lti::drawBase< rgbPixel >::rectangle(), lti::draw< rgbPixel >::rectangle(), lti::trectangle< T >::resize(), lti::SOFM2DVisualizer::sammonsMapper(), lti::tpoint< unsigned int >::set(), lti::sparseMatrix< T >::setAt(), lti::trectangle< T >::setCenter(), lti::panTiltUnit::setPanTilt(), lti::tpoint< T >::subtract(), lti::drawBase< rgbPixel >::text(), lti::geometricTransform::transf(), lti::translationScaleEstimator::transform(), lti::homography9DofEstimator::transform(), lti::homography8DofEstimator::transform(), lti::epsDraw< T >::verticalLine(), lti::drawBase< rgbPixel >::verticalLine(), and lti::write().

template<class T>
T lti::tpoint< T >::y

Coordinate y;.

Referenced by lti::tpoint< T >::absSqr(), lti::tpoint< T >::add(), lti::decimation::apply(), lti::bicubicInterpolator< T >::apply(), lti::epsDraw< T >::arrow(), lti::drawBase< rgbPixel >::arrow(), lti::draw< rgbPixel >::arrow(), lti::kernel2D< ubyte >::at(), lti::epsDraw< T >::box(), lti::drawBase< rgbPixel >::box(), lti::draw< rgbPixel >::box(), lti::tpoint< unsigned int >::castFrom(), lti::hPoint2D< T >::castFrom(), lti::hPoint2D< T >::castTo(), lti::chainCode::chainCode(), lti::cityBlockDistance(), lti::tpoint< T >::copy(), lti::hPoint3D< T >::copy(), lti::hPoint2D< T >::copy(), lti::tpoint< unsigned int >::divide(), lti::tpoint< T >::dot(), lti::tpoint< T >::edivide(), lti::tpoint< T >::emultiply(), lti::draw< rgbPixel >::enterPX(), lti::kernel2D< ubyte >::firstRow(), lti::sparseMatrix< T >::forceAt(), lti::tline< T >::getIntersectionPoint(), lti::tline< T >::getIntersectionPointXPol(), lti::panTiltUnit::getMaxPanTilt(), lti::panTiltUnit::getMinPanTilt(), lti::panTiltUnit::getPanTilt(), lti::epsDraw< T >::horizontalLine(), lti::drawBase< rgbPixel >::horizontalLine(), lti::draw< T >::inCanvas(), lti::squareConvolution< T, A >::parameters::initSquare(), lti::maximumFilter< T >::parameters::initSquare(), lti::trectangle< T >::isClose(), lti::trectangle< T >::isInside(), lti::fillPattern::isSet(), lti::kernel2D< ubyte >::lastRow(), lti::epsDraw< T >::line(), lti::drawBase< rgbPixel >::line(), lti::draw< rgbPixel >::line(), lti::epsDraw< T >::lineTo(), lti::drawBase< rgbPixel >::lineTo(), lti::draw< rgbPixel >::lineTo(), lti::drawBase< rgbPixel >::marker(), lti::tpoint< unsigned int >::multiply(), lti::tpoint< T >::operator!=(), lti::tpoint< T >::operator%(), lti::tpoint< T >::operator*(), lti::tpoint< unsigned int >::operator*(), lti::tpoint< T >::operator*=(), lti::tpoint< unsigned int >::operator*=(), lti::tpoint< T >::operator+(), lti::tpoint< T >::operator-(), lti::tpoint< T >::operator/(), lti::tpoint< unsigned int >::operator/(), lti::tpoint< T >::operator/=(), lti::tpoint< unsigned int >::operator/=(), lti::tpoint< T >::operator<(), lti::tpoint< T >::operator==(), lti::tpoint< T >::operator>(), lti::tpoint< unsigned int >::operator[](), lti::hPoint3D< T >::project(), lti::read(), lti::epsDraw< T >::rectangle(), lti::drawBase< rgbPixel >::rectangle(), lti::draw< rgbPixel >::rectangle(), lti::trectangle< T >::resize(), lti::SOFM2DVisualizer::sammonsMapper(), lti::tpoint< unsigned int >::set(), lti::sparseMatrix< T >::setAt(), lti::trectangle< T >::setCenter(), lti::panTiltUnit::setPanTilt(), lti::tpoint< T >::subtract(), lti::drawBase< rgbPixel >::text(), lti::geometricTransform::transf(), lti::translationScaleEstimator::transform(), lti::homography9DofEstimator::transform(), lti::homography8DofEstimator::transform(), lti::epsDraw< T >::verticalLine(), lti::drawBase< rgbPixel >::verticalLine(), and lti::write().


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

Generated on Sat Apr 10 15:26:44 2010 for LTI-Lib by Doxygen 1.6.1