Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vgl_homg_point_2d< T > Class Template Reference

#include <vgl_homg_point_2d.h>

List of all members.


Detailed Description

template<class T>
class vgl_homg_point_2d< T >

Represents a homogeneous 2D point.

Definition at line 27 of file vgl_homg_point_2d.h.

Public Member Functions

 vgl_homg_point_2d ()
 Default constructor with (0,0,1).
 vgl_homg_point_2d (T px, T py, T pw=(T) 1)
 Construct from two (nonhomogeneous) or three (homogeneous) Types.
 vgl_homg_point_2d (const T v[3])
 Construct from homogeneous 3-array.
 vgl_homg_point_2d (vgl_vector_2d< T >const &v)
 Construct point at infinity from direction vector.
 vgl_homg_point_2d (vgl_point_2d< T > const &p)
 Construct from (non-homogeneous) vgl_point_2d<T>.
 vgl_homg_point_2d (vgl_homg_line_2d< T > const &l1, vgl_homg_line_2d< T > const &l2)
 Construct from 2 lines (intersection).
bool operator== (vgl_homg_point_2d< T > const &p) const
 the comparison operator.
bool operator!= (vgl_homg_point_2d< T > const &other) const
x () const
y () const
w () const
void set (T px, T py, T pw=(T) 1)
 Set x,y,w.
void set (T const p[3])
bool ideal (T tol=(T) 0) const
 Return true iff the point is at infinity (an ideal point).

Private Attributes

x_
y_
w_

Related Functions

(Note that these are not member functions.)

vgl_homg_point_2d< T > operator * (vnl_matrix_fixed< T, 3, 3 > const &m, vgl_homg_point_2d< T > const &p)
 Transform a point through a 3x3 projective transformation matrix.
vgl_homg_point_2d< T > vgl_closest_point_origin (vgl_homg_line_2d< T > const &l)
 Return the point on the given line closest to the origin.
double vgl_distance (vgl_homg_point_2d< T >const &p1, vgl_homg_point_2d< T >const &p2)
 return the distance between two points.
vcl_ostream & operator<< (vcl_ostream &s, vgl_homg_point_2d< T > const &p)
 Write "<vgl_homg_point_2d (x,y,w) >" to stream.
vcl_istream & operator>> (vcl_istream &s, vgl_homg_point_2d< T > &p)
 Read x y w from stream.
bool is_ideal (vgl_homg_point_2d< T > const &p, T tol=(T) 0)
 Return true iff the point is at infinity (an ideal point).
vgl_vector_2d< T > operator- (vgl_homg_point_2d< T > const &p1, vgl_homg_point_2d< T > const &p2)
 The difference of two points is the vector from second to first point.
vgl_homg_point_2d< T > operator+ (vgl_homg_point_2d< T > const &p, vgl_vector_2d< T > const &v)
 Adding a vector to a point gives a new point at the end of that vector.
vgl_homg_point_2d< T > & operator+= (vgl_homg_point_2d< T > &p, vgl_vector_2d< T > const &v)
 Adding a vector to a point gives the point at the end of that vector.
vgl_homg_point_2d< T > operator- (vgl_homg_point_2d< T > const &p, vgl_vector_2d< T > const &v)
 Subtracting a vector from a point is the same as adding the inverse vector.
vgl_homg_point_2d< T > & operator-= (vgl_homg_point_2d< T > &p, vgl_vector_2d< T > const &v)
 Subtracting a vector from a point is the same as adding the inverse vector.
bool collinear (vgl_homg_point_2d< T > const &p1, vgl_homg_point_2d< T > const &p2, vgl_homg_point_2d< T > const &p3)
 Are three points collinear, i.e.
double ratio (vgl_homg_point_2d< T > const &p1, vgl_homg_point_2d< T > const &p2, vgl_homg_point_2d< T > const &p3)
 Return the relative distance to p1 wrt p1-p2 of p3.
vgl_homg_point_2d< T > centre (vgl_homg_point_2d< T > const &p1, vgl_homg_point_2d< T > const &p2)
 Return the point at the centre of gravity of two given points.
vgl_homg_point_2d< T > centre (vcl_vector< vgl_homg_point_2d< T > > const &v)
 Return the point at the centre of gravity of a set of given points.


Constructor & Destructor Documentation

template<class T>
vgl_homg_point_2d< T >::vgl_homg_point_2d  )  [inline]
 

Default constructor with (0,0,1).

Definition at line 39 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T >::vgl_homg_point_2d px,
py,
pw = (T)1
[inline]
 

Construct from two (nonhomogeneous) or three (homogeneous) Types.

Definition at line 42 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T >::vgl_homg_point_2d const T  v[3]  )  [inline]
 

Construct from homogeneous 3-array.

Definition at line 46 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T >::vgl_homg_point_2d vgl_vector_2d< T >const &  v  )  [inline]
 

Construct point at infinity from direction vector.

Definition at line 49 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T >::vgl_homg_point_2d vgl_point_2d< T > const &  p  )  [inline, explicit]
 

Construct from (non-homogeneous) vgl_point_2d<T>.

Definition at line 52 of file vgl_homg_point_2d.h.

template<class Type>
vgl_homg_point_2d< Type >::vgl_homg_point_2d vgl_homg_line_2d< T > const &  l1,
vgl_homg_line_2d< T > const &  l2
 

Construct from 2 lines (intersection).

Definition at line 11 of file vgl_homg_point_2d.txx.


Member Function Documentation

template<class T>
bool vgl_homg_point_2d< T >::ideal tol = (T)0  )  const [inline]
 

Return true iff the point is at infinity (an ideal point).

The method checks whether |w| <= tol * max(|x|,|y|)

Definition at line 99 of file vgl_homg_point_2d.h.

template<class T>
bool vgl_homg_point_2d< T >::operator!= vgl_homg_point_2d< T > const &  other  )  const [inline]
 

Definition at line 82 of file vgl_homg_point_2d.h.

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

the comparison operator.

Definition at line 76 of file vgl_homg_point_2d.h.

template<class T>
void vgl_homg_point_2d< T >::set T const   p[3]  )  [inline]
 

Definition at line 95 of file vgl_homg_point_2d.h.

template<class T>
void vgl_homg_point_2d< T >::set px,
py,
pw = (T)1
[inline]
 

Set x,y,w.

Note that it does not make sense to set x, y or w individually.

Definition at line 92 of file vgl_homg_point_2d.h.

template<class T>
T vgl_homg_point_2d< T >::w  )  const [inline]
 

Definition at line 88 of file vgl_homg_point_2d.h.

template<class T>
T vgl_homg_point_2d< T >::x  )  const [inline]
 

Definition at line 86 of file vgl_homg_point_2d.h.

template<class T>
T vgl_homg_point_2d< T >::y  )  const [inline]
 

Definition at line 87 of file vgl_homg_point_2d.h.


Friends And Related Function Documentation

template<class T>
vgl_homg_point_2d< T > centre vcl_vector< vgl_homg_point_2d< T > > const &  v  )  [related]
 

Return the point at the centre of gravity of a set of given points.

There are no rounding errors when T is e.g. int, if all w() are 1.

Definition at line 251 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T > centre vgl_homg_point_2d< T > const &  p1,
vgl_homg_point_2d< T > const &  p2
[related]
 

Return the point at the centre of gravity of two given points.

Identical to midpoint(p1,p2). Invalid when both points are at infinity. If only one point is at infinity, that point is returned.

Definition at line 239 of file vgl_homg_point_2d.h.

template<class T>
bool collinear vgl_homg_point_2d< T > const &  p1,
vgl_homg_point_2d< T > const &  p2,
vgl_homg_point_2d< T > const &  p3
[related]
 

Are three points collinear, i.e.

, do they lie on a common line?.

Definition at line 198 of file vgl_homg_point_2d.h.

template<class T>
bool is_ideal vgl_homg_point_2d< T > const &  p,
tol = (T)0
[related]
 

Return true iff the point is at infinity (an ideal point).

The method checks whether |w| <= tol * max(|x|,|y|)

Definition at line 126 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T > operator * vnl_matrix_fixed< T, 3, 3 > const &  m,
vgl_homg_point_2d< T > const &  p
[related]
 

Transform a point through a 3x3 projective transformation matrix.

Definition at line 883 of file vgl_homg_operators_2d.txx.

template<class T>
vgl_homg_point_2d< T > operator+ vgl_homg_point_2d< T > const &  p,
vgl_vector_2d< T > const &  v
[related]
 

Adding a vector to a point gives a new point at the end of that vector.

If the point is at infinity, nothing happens. Note that vector + point is not defined! It's always point + vector.

Definition at line 145 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T > & operator+= vgl_homg_point_2d< T > &  p,
vgl_vector_2d< T > const &  v
[related]
 

Adding a vector to a point gives the point at the end of that vector.

If the point is at infinity, nothing happens.

Definition at line 153 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T > operator- vgl_homg_point_2d< T > const &  p,
vgl_vector_2d< T > const &  v
[related]
 

Subtracting a vector from a point is the same as adding the inverse vector.

Definition at line 160 of file vgl_homg_point_2d.h.

template<class T>
vgl_vector_2d< T > operator- vgl_homg_point_2d< T > const &  p1,
vgl_homg_point_2d< T > const &  p2
[related]
 

The difference of two points is the vector from second to first point.

This function is only valid if the points are not at infinity.

Definition at line 132 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T > & operator-= vgl_homg_point_2d< T > &  p,
vgl_vector_2d< T > const &  v
[related]
 

Subtracting a vector from a point is the same as adding the inverse vector.

Definition at line 167 of file vgl_homg_point_2d.h.

template<class T>
vcl_ostream & operator<< vcl_ostream &  s,
vgl_homg_point_2d< T > const &  p
[related]
 

Write "<vgl_homg_point_2d (x,y,w) >" to stream.

template<class T>
vcl_istream & operator>> vcl_istream &  s,
vgl_homg_point_2d< T > &  p
[related]
 

Read x y w from stream.

template<class T>
double ratio vgl_homg_point_2d< T > const &  p1,
vgl_homg_point_2d< T > const &  p2,
vgl_homg_point_2d< T > const &  p3
[related]
 

Return the relative distance to p1 wrt p1-p2 of p3.

The three points should be collinear and p2 should not equal p1. This is the coordinate of p3 in the affine 1D reference frame (p1,p2). If p3=p1, the ratio is 0; if p1=p3, the ratio is 1. The mid point of p1 and p2 has ratio 0.5. Note that the return type is double, not T, since the ratio of e.g. two vgl_vector_2d<int> need not be an int.

Definition at line 216 of file vgl_homg_point_2d.h.

template<class T>
vgl_homg_point_2d< T > vgl_closest_point_origin vgl_homg_line_2d< T > const &  l  )  [related]
 

Return the point on the given line closest to the origin.

Definition at line 193 of file vgl_closest_point.txx.

template<class T>
double vgl_distance vgl_homg_point_2d< T >const &  p1,
vgl_homg_point_2d< T >const &  p2
[related]
 

return the distance between two points.

Definition at line 122 of file vgl_distance.h.


Member Data Documentation

template<class T>
T vgl_homg_point_2d< T >::w_ [private]
 

Definition at line 32 of file vgl_homg_point_2d.h.

template<class T>
T vgl_homg_point_2d< T >::x_ [private]
 

Definition at line 30 of file vgl_homg_point_2d.h.

template<class T>
T vgl_homg_point_2d< T >::y_ [private]
 

Definition at line 31 of file vgl_homg_point_2d.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 14:39:28 2008 for core/vgl by  doxygen 1.4.4