Public Member Functions | Private Attributes | Related Functions
vgl_homg_line_2d< T > Class Template Reference

Represents a homogeneous 2D line. More...

#include <vgl_homg_line_2d.h>

List of all members.

Public Member Functions

 vgl_homg_line_2d ()
 Default constructor (Line 1.y==0, the X axis).
 vgl_homg_line_2d (T va, T vb, T vc)
 Construct from three Types.
 vgl_homg_line_2d (const T v[3])
 Construct from 3-vector.
 vgl_homg_line_2d (vgl_line_2d< T > const &p)
 Construct from non-homogeneous line.
 vgl_homg_line_2d (vgl_homg_point_2d< T > const &p1, vgl_homg_point_2d< T > const &p2)
 Construct from two distinct points (join).
bool operator== (vgl_homg_line_2d< T > const &l) const
 the comparison operator.
bool operator!= (vgl_homg_line_2d< T > const &other) const
a () const
 Parameter a of line a*x + b*y + c*w = 0.
b () const
 Parameter b of line a*x + b*y + c*w = 0.
c () const
 Parameter c of line a*x + b*y + c*w = 0.
vgl_vector_2d< double > direction () const
 unit vector describing line direction, or (0,0) if line at infinity.
vgl_vector_2d< double > normal () const
 unit vector orthogonal to line, or (0,0) if line at infinity.
void normalize ()
 divide all coefficients by sqrt(a^2 + b^2).
void set (T va, T vb, T vc)
 Set a b c.
bool ideal (T tol=(T) 0) const
 Return true iff this line is the line at infinity.
void get_two_points (vgl_homg_point_2d< T > &p1, vgl_homg_point_2d< T > &p2) const
 get two points on the line.

Private Attributes

a_
 the data associated with this line.
b_
c_

Related Functions

(Note that these are not member functions.)

template<class T >
vgl_homg_line_2d< T > operator* (vnl_matrix_fixed< T, 3, 3 > const &m, vgl_homg_line_2d< T > const &p)
 Transform a line through a 3x3 projective transformation matrix.
template<class T >
vgl_homg_point_2d< T > vgl_closest_point (vgl_homg_line_2d< T > const &l, vgl_homg_point_2d< T > const &p)
 Return the point on the given line closest to the given point.
template<class T >
double vgl_distance_origin (vgl_homg_line_2d< T > const &l)
 find the shortest distance of the line to the origin.
template<class T >
double vgl_distance (vgl_homg_line_2d< T > const &l, vgl_homg_point_2d< T > const &p)
 return the perpendicular distance from a point to a line in 2D.
template<class T >
bool is_ideal (l const &line, T tol=(T) 0)
 Return true iff line is the line at infinity.
template<class T >
bool concurrent (l const &l1, l const &l2, l const &l3)
 Are three lines concurrent, i.e., do they pass through a common point?.
template<class T >
vcl_ostream & operator<< (vcl_ostream &s, l const &line)
 Print line equation to stream.
template<class T >
vcl_istream & operator>> (vcl_istream &s, l &line)
 Load in line parameters from stream.

Detailed Description

template<class T>
class vgl_homg_line_2d< T >

Represents a homogeneous 2D line.

Definition at line 26 of file vgl_homg_line_2d.h.


Constructor & Destructor Documentation

template<class T>
vgl_homg_line_2d< T >::vgl_homg_line_2d ( ) [inline]

Default constructor (Line 1.y==0, the X axis).

Definition at line 38 of file vgl_homg_line_2d.h.

template<class T>
vgl_homg_line_2d< T >::vgl_homg_line_2d ( va,
vb,
vc 
) [inline]

Construct from three Types.

The three given numbers should not be all 0

Definition at line 42 of file vgl_homg_line_2d.h.

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

Construct from 3-vector.

The three given numbers should not be all 0

Definition at line 46 of file vgl_homg_line_2d.h.

template<class T>
vgl_homg_line_2d< T >::vgl_homg_line_2d ( vgl_line_2d< T > const &  p)

Construct from non-homogeneous line.

template<class T>
vgl_homg_line_2d< T >::vgl_homg_line_2d ( vgl_homg_point_2d< T > const &  p1,
vgl_homg_point_2d< T > const &  p2 
)

Construct from two distinct points (join).

The two points must be distinct!


Member Function Documentation

template<class T>
T vgl_homg_line_2d< T >::a ( ) const [inline]

Parameter a of line a*x + b*y + c*w = 0.

Definition at line 80 of file vgl_homg_line_2d.h.

template<class T>
T vgl_homg_line_2d< T >::b ( ) const [inline]

Parameter b of line a*x + b*y + c*w = 0.

Definition at line 82 of file vgl_homg_line_2d.h.

template<class T>
T vgl_homg_line_2d< T >::c ( ) const [inline]

Parameter c of line a*x + b*y + c*w = 0.

Definition at line 84 of file vgl_homg_line_2d.h.

template<class T>
vgl_vector_2d<double> vgl_homg_line_2d< T >::direction ( ) const [inline]

unit vector describing line direction, or (0,0) if line at infinity.

Definition at line 87 of file vgl_homg_line_2d.h.

template<class T>
void vgl_homg_line_2d< T >::get_two_points ( vgl_homg_point_2d< T > &  p1,
vgl_homg_point_2d< T > &  p2 
) const

get two points on the line.

These two points are normally the intersections with the Y axis and X axis, respectively. When the line is parallel to one of these, the point with y=1 or x=1, resp. are taken. When the line goes through the origin, the second point is (b, -a, 1). Finally, when the line is the line at infinity, the returned points are (1,0,0) and (0,1,0). Thus, whenever possible, the returned points are not at infinity.

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

Return true iff this line is the line at infinity.

This version checks (max(|a|,|b|) <= tol * |c|

Definition at line 102 of file vgl_homg_line_2d.h.

template<class T>
vgl_vector_2d<double> vgl_homg_line_2d< T >::normal ( ) const [inline]

unit vector orthogonal to line, or (0,0) if line at infinity.

Definition at line 90 of file vgl_homg_line_2d.h.

template<class Type >
void vgl_homg_line_2d< Type >::normalize ( )

divide all coefficients by sqrt(a^2 + b^2).

Definition at line 76 of file vgl_homg_line_2d.txx.

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

Definition at line 75 of file vgl_homg_line_2d.h.

template<class T>
bool vgl_homg_line_2d< T >::operator== ( vgl_homg_line_2d< T > const &  l) const [inline]

the comparison operator.

Definition at line 69 of file vgl_homg_line_2d.h.

template<class T>
void vgl_homg_line_2d< T >::set ( va,
vb,
vc 
) [inline]

Set a b c.

The three given numbers should not be all 0 Note that it does not make sense to set a, b or c separately

Definition at line 98 of file vgl_homg_line_2d.h.


Friends And Related Function Documentation

template<class T >
bool concurrent ( l const &  l1,
l const &  l2,
l const &  l3 
) [related]

Are three lines concurrent, i.e., do they pass through a common point?.

Definition at line 130 of file vgl_homg_line_2d.h.

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

Return true iff line is the line at infinity.

This version checks (max(|a|,|b|) <= tol * |c|

Definition at line 125 of file vgl_homg_line_2d.h.

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

Transform a line through a 3x3 projective transformation matrix.

Definition at line 906 of file vgl_homg_operators_2d.txx.

template<class T >
vcl_ostream & operator<< ( vcl_ostream &  s,
l const &  line 
) [related]

Print line equation to stream.

template<class T >
vcl_istream & operator>> ( vcl_istream &  s,
l &  line 
) [related]

Load in line parameters from stream.

template<class T >
vgl_homg_point_2d< T > vgl_closest_point ( vgl_homg_line_2d< T > const &  l,
vgl_homg_point_2d< T > const &  p 
) [related]

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

template<class T >
double vgl_distance ( vgl_homg_line_2d< T > const &  l,
vgl_homg_point_2d< T > const &  p 
) [related]

return the perpendicular distance from a point to a line in 2D.

template<class T >
double vgl_distance_origin ( vgl_homg_line_2d< T > const &  l) [related]

find the shortest distance of the line to the origin.


Member Data Documentation

template<class T>
T vgl_homg_line_2d< T >::a_ [private]

the data associated with this line.

Definition at line 29 of file vgl_homg_line_2d.h.

template<class T>
T vgl_homg_line_2d< T >::b_ [private]

Definition at line 30 of file vgl_homg_line_2d.h.

template<class T>
T vgl_homg_line_2d< T >::c_ [private]

Definition at line 31 of file vgl_homg_line_2d.h.


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