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

vgl_homg_point_1d< T > Class Template Reference

#include <vgl_homg_point_1d.h>

List of all members.


Detailed Description

template<class T>
class vgl_homg_point_1d< T >

Represents a homogeneous 1-D point, i.e.

, a homogeneous pair (x,w).

Definition at line 23 of file vgl_homg_point_1d.h.

Public Member Functions

 vgl_homg_point_1d ()
 Default constructor with (0,1).
 vgl_homg_point_1d (T px, T pw=T(1))
 Construct from one (nonhomogeneous) or two (homogeneous) T's.
 vgl_homg_point_1d (const T v[2])
 Construct from homogeneous 2-array.
bool operator== (vgl_homg_point_1d< T > const &p) const
 comparison.
bool operator!= (vgl_homg_point_1d< T > const &p) const
x () const
w () const
void set (T px, T pw)
 Set x,w.
void set (T const p[2])
bool ideal (T tol=T(0)) const
 Return true iff the point is at infinity (an ideal point).

Private Attributes

x_
w_

Related Functions

(Note that these are not member functions.)

vgl_homg_point_1d< T > operator * (vnl_matrix_fixed< T, 2, 2 > const &m, vgl_homg_point_1d< T > const &p)
 Transform a point through a 2x2 projective transformation matrix.
double vgl_distance (vgl_homg_point_1d< T >const &p1, vgl_homg_point_1d< T >const &p2)
 return the distance between two points.
vcl_ostream & operator<< (vcl_ostream &s, vgl_homg_point_1d< T > const &p)
 Write "<vgl_homg_point_1d (x,w) > " to stream.
vcl_istream & operator>> (vcl_istream &s, vgl_homg_point_1d< T > &p)
 Read x w from stream.
bool is_ideal (vgl_homg_point_1d< T > const &p, T tol=T(0))
 Return true iff the point is at infinity (an ideal point).
operator- (vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2)
 The difference of two points is the distance between the two.
vgl_homg_point_1d< T > operator+ (vgl_homg_point_1d< T > const &p, T v)
 Adding a number to a 1-D point translates that point.
vgl_homg_point_1d< T > & operator+= (vgl_homg_point_1d< T > &p, T v)
 Adding a number to a 1-D point translates that point.
vgl_homg_point_1d< T > operator- (vgl_homg_point_1d< T > const &p, T v)
 Subtracting a number from a point is the same as adding the inverse number.
vgl_homg_point_1d< T > & operator-= (vgl_homg_point_1d< T > &p, T v)
 Subtracting a number from a point is the same as adding the inverse number.
double ratio (vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2, vgl_homg_point_1d< T > const &p3)
 Return the relative distance to p1 wrt p1-p2 of p3.
bool collinear (vgl_homg_point_1d< T > const &, vgl_homg_point_1d< T > const &, vgl_homg_point_1d< T > const &)
 Are three points collinear? This is always true.
vgl_homg_point_1d< T > midpoint (vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2, T f=0.5)
 Return the point at a given ratio wrt two other points.
vgl_homg_point_1d< T > centre (vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2)
 Return the point at the centre of gravity of two given points.
vgl_homg_point_1d< T > centre (vcl_vector< vgl_homg_point_1d< 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_1d< T >::vgl_homg_point_1d  )  [inline]
 

Default constructor with (0,1).

Definition at line 30 of file vgl_homg_point_1d.h.

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

Construct from one (nonhomogeneous) or two (homogeneous) T's.

Definition at line 33 of file vgl_homg_point_1d.h.

template<class T>
vgl_homg_point_1d< T >::vgl_homg_point_1d const T  v[2]  )  [inline]
 

Construct from homogeneous 2-array.

Definition at line 36 of file vgl_homg_point_1d.h.


Member Function Documentation

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

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

The method checks whether |w| <= tol * |x|

Definition at line 67 of file vgl_homg_point_1d.h.

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

Definition at line 53 of file vgl_homg_point_1d.h.

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

comparison.

Definition at line 51 of file vgl_homg_point_1d.h.

template<class T>
void vgl_homg_point_1d< T >::set T const   p[2]  )  [inline]
 

Definition at line 63 of file vgl_homg_point_1d.h.

template<class T>
void vgl_homg_point_1d< T >::set px,
pw
[inline]
 

Set x,w.

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

Definition at line 62 of file vgl_homg_point_1d.h.

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

Definition at line 58 of file vgl_homg_point_1d.h.

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

Definition at line 57 of file vgl_homg_point_1d.h.


Friends And Related Function Documentation

template<class T>
vgl_homg_point_1d< T > centre vcl_vector< vgl_homg_point_1d< 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 204 of file vgl_homg_point_1d.h.

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

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

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

Definition at line 193 of file vgl_homg_point_1d.h.

template<class T>
bool collinear vgl_homg_point_1d< T > const &  ,
vgl_homg_point_1d< T > const &  ,
vgl_homg_point_1d< T > const & 
[related]
 

Are three points collinear? This is always true.

Definition at line 171 of file vgl_homg_point_1d.h.

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

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

The method checks whether |w| <= tol * |x|

Definition at line 92 of file vgl_homg_point_1d.h.

template<class T>
vgl_homg_point_1d< T > midpoint vgl_homg_point_1d< T > const &  p1,
vgl_homg_point_1d< T > const &  p2,
f = 0.5
[related]
 

Return the point at a given ratio wrt two other points.

By default, the mid point (ratio=0.5) is returned. Note that the third argument is T, not double, so the midpoint of e.g. two vgl_homg_point_1d<int> is not a valid concept. But the reflection point of p2 wrt p1 is: in that case f=-1.

Definition at line 183 of file vgl_homg_point_1d.h.

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

Transform a point through a 2x2 projective transformation matrix.

Definition at line 119 of file vgl_homg_operators_1d.txx.

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

Adding a number to a 1-D point translates that point.

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

Definition at line 109 of file vgl_homg_point_1d.h.

template<class T>
vgl_homg_point_1d< T > & operator+= vgl_homg_point_1d< T > &  p,
v
[related]
 

Adding a number to a 1-D point translates that point.

If the point is at infinity, nothing happens.

Definition at line 116 of file vgl_homg_point_1d.h.

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

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

Definition at line 122 of file vgl_homg_point_1d.h.

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

The difference of two points is the distance between the two.

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

Definition at line 98 of file vgl_homg_point_1d.h.

template<class T>
vgl_homg_point_1d< T > & operator-= vgl_homg_point_1d< T > &  p,
v
[related]
 

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

Definition at line 128 of file vgl_homg_point_1d.h.

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

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

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

Read x w from stream.

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

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

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 int's need not be an int.

Definition at line 163 of file vgl_homg_point_1d.h.

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

return the distance between two points.

Definition at line 213 of file vgl_distance.txx.


Member Data Documentation

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

Definition at line 26 of file vgl_homg_point_1d.h.

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

Definition at line 25 of file vgl_homg_point_1d.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