latest version v1.9 - last update 10 Apr 2010 |
Two dimensional point, containing the coordinates x, y. More...
#include <ltiPoint.h>
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) |
T | distanceTo (const tpoint< T > &c) const |
T | distanceSqr (const tpoint< T > &c) const |
T | 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) |
T | 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 | |
T | x |
T | y |
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.
typedef int lti::tpoint< T >::size_type |
Return type of the size() member.
typedef T lti::tpoint< T >::value_type |
Used for the template-based interface for pixels as vectors.
lti::tpoint< T >::tpoint | ( | const T | newx = 0 , |
|
const T | newy = 0 | |||
) | [inline, explicit] |
Default constructor.
Copy constructor.
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().
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.
a | first point to be added | |
b | second point to be added |
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
tpoint< T > & lti::tpoint< T >::add | ( | const tpoint< T > & | p | ) | [inline] |
Add given point to this point and leave the result here.
p | the other point to be added to this one |
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
Referenced by lti::tpoint< T >::operator+=().
tpoint<T>& lti::tpoint< T >::castFrom | ( | const tpoint< U > & | p | ) | [inline] |
Copy constructor.
tpoint< T > & lti::tpoint< T >::copy | ( | const tpoint< T > & | p | ) | [inline] |
Copy operator.
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
Referenced by lti::tpoint< unsigned int >::operator=().
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().
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().
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.
Divide each component of tpoint<T> with a given factor.
T lti::tpoint< T >::dot | ( | const tpoint< T > & | p | ) | const [inline] |
Dot product with another point.
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
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.
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.
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.
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.
tpoint<T>& lti::tpoint< T >::multiply | ( | const tpoint< T > & | other, | |
const U | c | |||
) | [inline] |
Multiply the other point tpoint<T> with a given factor.
Multiply tpoint<T> with a given factor.
bool lti::tpoint< T >::operator!= | ( | const tpoint< T > & | p | ) | const [inline] |
Operator !=.
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
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.
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.
tpoint<T> lti::tpoint< T >::operator* | ( | const U | c | ) | const [inline] |
Multiply tpoint<T> with a given factor.
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.
Multiply tpoint<T> with a given factor.
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.
tpoint< T > & lti::tpoint< T >::operator+= | ( | const tpoint< T > & | p | ) | [inline] |
Operator += is an alias for add().
References lti::tpoint< T >::add().
tpoint< T > lti::tpoint< T >::operator- | ( | const tpoint< T > & | p | ) | const [inline] |
Operator -.
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
tpoint< T > & lti::tpoint< T >::operator-= | ( | const tpoint< T > & | p | ) | [inline] |
Operator -=.
References lti::tpoint< T >::subtract().
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.
tpoint<T> lti::tpoint< T >::operator/ | ( | const U | c | ) | const [inline] |
Divide each component of tpoint<T> by a given factor.
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.
Divide each component of tpoint<T> by a given factor.
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.
tpoint<T>& lti::tpoint< T >::operator= | ( | const tpoint< T > & | p | ) | [inline] |
Operator =.
bool lti::tpoint< T >::operator== | ( | const tpoint< T > & | p | ) | const [inline] |
Operator ==.
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
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.
const T& lti::tpoint< T >::operator[] | ( | const int | i | ) | const [inline] |
T& lti::tpoint< T >::operator[] | ( | const int | i | ) | [inline] |
tpoint<T>& lti::tpoint< T >::set | ( | const T | tx, | |
const T | ty | |||
) | [inline] |
Set the coordinate values and return a reference to this point.
int lti::tpoint< T >::size | ( | ) | const [inline] |
Used to simulate the vector size.
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.
a | first point | |
b | point to be subtracted from the first one |
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
tpoint< T > & lti::tpoint< T >::subtract | ( | const tpoint< T > & | p | ) | [inline] |
Subtract.
References lti::tpoint< T >::x, and lti::tpoint< T >::y.
Referenced by lti::chainCode::chainCode(), and lti::tpoint< T >::operator-=().
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().
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().