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

lti::hPoint2D< T > Class Template Reference

Homogeneous point in two dimensions Note that an homogeneous two-dimensional point has three elements: x,y and h. More...

#include <ltiHTypes.h>

List of all members.

Public Member Functions

 hPoint2D (const T newx=0, const T newy=0, const T newh=T(1))
 hPoint2D (const hPoint2D< T > &p)
template<class U >
hPoint2D< T > & castFrom (const hPoint2D< U > &p)
 hPoint2D (const tpoint< T > &p)
template<class U >
hPoint2D< T > & castFrom (const tpoint< U > &p)
tpoint< T > & castTo (tpoint< T > &p) const
hPoint2D< T > & multiply (const T c)
hPoint2D< T > operator* (const T c) const
hPoint2D< T > operator* (const hPoint2D< T > &c) const
hPoint2D< T > & operator*= (const hPoint2D< T > &c)
hPoint2D< T > & divide (const T c)
hPoint2D< T > operator/ (const T c) const
hPoint2D< T > operator/ (const hPoint2D< T > &c) const
hPoint2D< T > & operator/= (const hPoint2D< T > &c)
hPoint2D< T > & add (const hPoint2D< T > &p)
hPoint2D< T > operator+ (const hPoint2D< T > &p) const
hPoint2D< T > & operator+= (const hPoint2D< T > &p)
hPoint2D< T > & subtract (const hPoint2D< T > &p)
hPoint2D< T > operator- (const hPoint2D< T > &p) const
hPoint2D< T > & operator-= (const hPoint2D< T > &p)
dot (const hPoint2D< T > &p) const
dot (const vector< T > &p) const
hPoint2D< T > & copy (const hPoint2D< T > &p)
hPoint2D< T > & operator= (const hPoint2D< T > &p)
hPoint2D< T > & copy (const tpoint< T > &p)
hPoint2D< T > & operator= (const tpoint< T > &p)
bool operator== (const hPoint2D< T > &p) const
bool operator!= (const hPoint2D< T > &p) const
hPoint2D< T > & normalize ()
hPoint2D< T > & normalize (const hPoint2D< T > &p)
T & operator[] (const int &i)
const T & operator[] (const int &i) const
absSqr () const

Public Attributes

T & x
T & y
T & h

Static Public Attributes

static const int totalDimensionality = 3

Protected Attributes

data [3]

Detailed Description

template<class T>
class lti::hPoint2D< T >

Homogeneous point in two dimensions Note that an homogeneous two-dimensional point has three elements: x,y and h.

All arithmetical operations will be calculated for the corresponding non-homogeneous 2D point, and then homogenized. For example the addition of two hPoints2D will be:

\[ \begin{pmatrix}x_1 \\ y_1 \\ h_1 \end{pmatrix} + \begin{pmatrix}x_2 \\ y_2 \\ h_2 \end{pmatrix} = \begin{pmatrix}x_1/h_1 \\ y_1/h_1 \\ 1 \end{pmatrix} + \begin{pmatrix}x_2/h_2 \\ y_2/h_2 \\ 1 \end{pmatrix} = \begin{pmatrix}\frac{x_1}{h_1}+\frac{x_2}{h_2} \\ \frac{y_1}{h_1}+\frac{y_2}{h_2} \\ 1 \end{pmatrix} = \begin{pmatrix} x_1+x_2 \cdot \frac{h_1}{h_2} \\ y_1+y_2 \cdot \frac{h_1}{h_2} \\ h_1 \end{pmatrix}\]


Constructor & Destructor Documentation

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

default constructor

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

copy constructor

References lti::hPoint2D< T >::copy().

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

copy constructor

References lti::hPoint2D< T >::copy().


Member Function Documentation

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

return the square of the magnitud of this point (after its normalization)

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

copy this point normalized into the given tpoint and return a reference to it

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

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

divide each component of hPoint2D<T> (x,y only) with a given factor

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

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

Dot product with a 3D vector.

Typically, this would be a transformation vector (e.g. a row of an hMatrix) which projects the point onto an axis. The result is a normal dot product, i.e. x*p.at(0)+y*p.at(1)+h*p.at(2).

Please note that this result differs considerably from the dot product with another hPoint, as the latter case normalizes the x and y components by the h one, and then makes a dot product of only the x and y components, while the former one assumes the hPoint and the vector as 3D points to make their product.

Parameters:
p three dimensional vector
Returns:
normal dot product between hPoint2D and vector

References lti::genericVector< T >::at(), lti::hPoint2D< T >::h, lti::genericVector< T >::size(), lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

Dot product with another point.

This considers the normalized x and y components only! i.e. the result will be (x*p.x+y*p.y)/(h*p.h)

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

multiply hPoint2D<T> with a given factor This will affect the (x,y) values! (multiplying h would had no effect!)

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

template<class T >
hPoint2D< T > & lti::hPoint2D< T >::normalize ( const hPoint2D< T > &  p  )  [inline]

copy in this point the normalized point p

Returns:
a reference to this point

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

template<class T >
hPoint2D< T > & lti::hPoint2D< T >::normalize (  )  [inline]

normalize this point.

This makes the h component 1

Returns:
a reference to this point

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

this product multiplies elementwise the components of this and the point c.

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

multiply hPoint2D<T> with a given factor This will affect the (x,y) values! (multiplying h would had no effect!)

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

this product multiplies elementwise the components of this and the point c

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

operator +=

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

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

operator -=

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

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

elementwise division of each component of the points

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

divide each component of hPoint2D<T> with a given factor

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

elementwise division of each component of the points

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

operator =

References lti::hPoint2D< T >::copy().

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

operator =

References lti::hPoint2D< T >::copy().

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

operator == This compares the normalized x and y coordinates, i.e.

x*p.h == p.x*h and the same thing for y

References lti::hPoint2D< T >::h, lti::hPoint2D< T >::x, and lti::hPoint2D< T >::y.

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

operator to access the point as a vector.

The position x corresponds to the element 0. The position y corresponds to the element 1. The position h corresponds to the element 2.

References lti::hPoint2D< T >::data, and lti::hPoint2D< T >::totalDimensionality.

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

operator to access the point as a vector.

The position x corresponds to the element 0. The position y corresponds to the element 1. The position h corresponds to the element 2.

References lti::hPoint2D< T >::data, and lti::hPoint2D< T >::totalDimensionality.

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

Member Data Documentation

template<class T>
T lti::hPoint2D< T >::data[3] [protected]

the content of the point

Referenced by lti::hPoint2D< T >::operator[]().

template<class T>
T& lti::hPoint2D< T >::h
template<class T>
const int lti::hPoint2D< T >::totalDimensionality = 3 [inline, static]

this constant value indicates the dimensionality of this point as vector: i.e.

this will contain the value 3

Referenced by lti::hPoint2D< T >::operator[]().

template<class T>
T& lti::hPoint2D< T >::x
template<class T>
T& lti::hPoint2D< T >::y

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

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