Public Member Functions | Private Attributes | Related Functions | List of all members
vgl_homg_line_2d< T > Class Template Reference

Represents a homogeneous 2D line. More...

#include <vgl_fwd.h>

Public Member Functions

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

Private Attributes

a_
 the data associated with this line. More...
 
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. More...
 
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. More...
 
template<class T >
double vgl_distance_origin (vgl_homg_line_2d< T > const &l)
 find the shortest distance of the line to the origin. More...
 
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. More...
 
template<class T >
bool is_ideal (l const &line, T tol=(T) 0)
 Return true iff line is the line at infinity. More...
 
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?. More...
 
template<class T >
std::ostream & operator<< (std::ostream &s, l const &line)
 Print line equation to stream. More...
 
template<class T >
std::istream & operator>> (std::istream &s, l &line)
 Load in line parameters from stream. More...
 

Detailed Description

template<class T>
class vgl_homg_line_2d< T >

Represents a homogeneous 2D line.

Definition at line 14 of file vgl_fwd.h.

Constructor & Destructor Documentation

◆ vgl_homg_line_2d() [1/5]

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.

◆ vgl_homg_line_2d() [2/5]

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.

◆ vgl_homg_line_2d() [3/5]

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.

◆ vgl_homg_line_2d() [4/5]

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

Construct from non-homogeneous line.

◆ vgl_homg_line_2d() [5/5]

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

◆ a()

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.

◆ b()

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.

◆ c()

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.

◆ direction()

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.

◆ get_two_points()

template<class T>
void vgl_homg_line_2d< Type >::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.

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/w=1 or x/w=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.

Definition at line 33 of file vgl_homg_line_2d.hxx.

◆ ideal()

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.

◆ normal()

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.

◆ normalize()

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

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

Definition at line 79 of file vgl_homg_line_2d.hxx.

◆ operator!=()

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.

◆ operator==()

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.

◆ set()

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

◆ concurrent()

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.

◆ is_ideal()

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.

◆ operator *()

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 909 of file vgl_homg_operators_2d.hxx.

◆ operator<<()

template<class T >
std::ostream & operator<< ( std::ostream &  s,
l const &  line 
)
related

Print line equation to stream.

◆ operator>>()

template<class T >
std::istream & operator>> ( std::istream &  s,
l line 
)
related

Load in line parameters from stream.

◆ vgl_closest_point()

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.

◆ vgl_distance()

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.

◆ vgl_distance_origin()

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

◆ a_

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.

◆ b_

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

Definition at line 30 of file vgl_homg_line_2d.h.

◆ c_

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: