Public Member Functions | Protected Member Functions | Private Attributes | Related Functions
vgl_homg_line_3d_2_points< Type > Class Template Reference

Represents a homogeneous 3D line using two points. More...

#include <vgl_homg_line_3d_2_points.h>

List of all members.

Public Member Functions

 vgl_homg_line_3d_2_points (void)
 Default constructor with (0,0,0,1) and (1,0,0,0), which is the line y=z=0.
 vgl_homg_line_3d_2_points (const vgl_homg_line_3d_2_points< Type > &that)
 Copy constructor.
 vgl_homg_line_3d_2_points (vgl_homg_point_3d< Type > const &point_1, vgl_homg_point_3d< Type > const &point_2)
 Construct from two points.
bool operator== (vgl_homg_line_3d_2_points< Type > const &l) const
 comparison.
bool operator!= (vgl_homg_line_3d_2_points< Type > const &l) const
vgl_homg_point_3d< Type > point_finite () const
 Finite point (Could be an ideal point, if the whole line is at infinity.).
vgl_homg_point_3d< Type > point_infinite () const
 Infinite point: the intersection of the line with the plane at infinity.
vgl_vector_3d< Type > direction () const
 The point at infinity defines the direction of the line.
void set (vgl_homg_point_3d< Type > const &p1, vgl_homg_point_3d< Type > const &p2)
 Assignment.
bool ideal (Type tol=(Type) 0) const
 Return true iff line is at infinity.

Protected Member Functions

void force_point2_infinite (void) const
 force the point point_infinite_ to infinity, without changing the line.

Private Attributes

vgl_homg_point_3d< Type > point_finite_
 Any finite point on the line.
vgl_homg_point_3d< Type > point_infinite_
 the (unique) point at infinity.

Related Functions

(Note that these are not member functions.)

template<class T >
vcl_pair< vgl_homg_point_3d< T >
, vgl_homg_point_3d< T > > 
vgl_closest_points (vgl_homg_line_3d_2_points< T > const &line1, vgl_homg_line_3d_2_points< T > const &line2)
 Return the two points of nearest approach of two 3D lines, one on each line.
template<class T >
double vgl_distance_origin (vgl_homg_line_3d_2_points< T > const &l)
 find the shortest distance of the line to the origin.
template<class T >
double vgl_distance (vgl_homg_line_3d_2_points< T > const &line1, vgl_homg_line_3d_2_points< T > const &line2)
 Return the perpendicular distance between two lines in 3D.
template<class T >
double vgl_distance (vgl_homg_line_3d_2_points< T > const &l, vgl_homg_point_3d< T > const &p)
 Return the perpendicular distance from a point to a line in 3D.
template<class Type >
bool is_ideal (l const &line, Type tol=(Type) 0)
 Return true iff line is at infinity.
template<class Type >
bool coplanar (l const &l1, l const &l2)
 Are two lines coplanar, i.e., do they intersect?.
template<class Type >
bool concurrent (l const &l1, l const &l2)
 Are two lines concurrent, i.e., do they intersect?.
template<class Type >
bool coplanar (l const &l1, l const &l2, l const &l3)
 Are three lines coplanar, i.e., are they in a common plane?.
template<class Type >
vgl_homg_point_3d< Type > intersection (l const &l1, l const &l2)
 Return the intersection point of two concurrent lines.
template<class Type >
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 Type >
vcl_ostream & operator<< (vcl_ostream &s, l const &p)
 Write to stream (verbose).
template<class Type >
vcl_istream & operator>> (vcl_istream &is, l &p)
 Read parameters from stream.

Detailed Description

template<class Type>
class vgl_homg_line_3d_2_points< Type >

Represents a homogeneous 3D line using two points.

A class to hold a homogeneous representation of a 3D Line. The line is stored as a pair of homogeneous 3d points.

Definition at line 25 of file vgl_homg_line_3d_2_points.h.


Constructor & Destructor Documentation

template<class Type>
vgl_homg_line_3d_2_points< Type >::vgl_homg_line_3d_2_points ( void  ) [inline]

Default constructor with (0,0,0,1) and (1,0,0,0), which is the line y=z=0.

Definition at line 40 of file vgl_homg_line_3d_2_points.h.

template<class Type>
vgl_homg_line_3d_2_points< Type >::vgl_homg_line_3d_2_points ( const vgl_homg_line_3d_2_points< Type > &  that) [inline]

Copy constructor.

Definition at line 44 of file vgl_homg_line_3d_2_points.h.

template<class Type>
vgl_homg_line_3d_2_points< Type >::vgl_homg_line_3d_2_points ( vgl_homg_point_3d< Type > const &  point_1,
vgl_homg_point_3d< Type > const &  point_2 
) [inline]

Construct from two points.

Definition at line 48 of file vgl_homg_line_3d_2_points.h.


Member Function Documentation

template<class Type>
vgl_vector_3d<Type> vgl_homg_line_3d_2_points< Type >::direction ( ) const [inline]

The point at infinity defines the direction of the line.

Definition at line 69 of file vgl_homg_line_3d_2_points.h.

template<class Type >
void vgl_homg_line_3d_2_points< Type >::force_point2_infinite ( void  ) const [protected]

force the point point_infinite_ to infinity, without changing the line.

This is called by the constructors

Definition at line 41 of file vgl_homg_line_3d_2_points.txx.

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

Return true iff line is at infinity.

Definition at line 80 of file vgl_homg_line_3d_2_points.h.

template<class Type>
bool vgl_homg_line_3d_2_points< Type >::operator!= ( vgl_homg_line_3d_2_points< Type > const &  l) const [inline]

Definition at line 59 of file vgl_homg_line_3d_2_points.h.

template<class Type >
bool vgl_homg_line_3d_2_points< Type >::operator== ( vgl_homg_line_3d_2_points< Type > const &  l) const

comparison.

Definition at line 22 of file vgl_homg_line_3d_2_points.txx.

template<class Type>
vgl_homg_point_3d<Type> vgl_homg_line_3d_2_points< Type >::point_finite ( ) const [inline]

Finite point (Could be an ideal point, if the whole line is at infinity.).

Definition at line 64 of file vgl_homg_line_3d_2_points.h.

template<class Type>
vgl_homg_point_3d<Type> vgl_homg_line_3d_2_points< Type >::point_infinite ( ) const [inline]

Infinite point: the intersection of the line with the plane at infinity.

Definition at line 66 of file vgl_homg_line_3d_2_points.h.

template<class Type>
void vgl_homg_line_3d_2_points< Type >::set ( vgl_homg_point_3d< Type > const &  p1,
vgl_homg_point_3d< Type > const &  p2 
) [inline]

Assignment.

Definition at line 74 of file vgl_homg_line_3d_2_points.h.


Friends And Related Function Documentation

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

Are two lines concurrent, i.e., do they intersect?.

Definition at line 112 of file vgl_homg_line_3d_2_points.h.

template<class Type >
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 141 of file vgl_homg_line_3d_2_points.h.

template<class Type >
bool coplanar ( l const &  l1,
l const &  l2 
) [related]

Are two lines coplanar, i.e., do they intersect?.

Definition at line 106 of file vgl_homg_line_3d_2_points.h.

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

Are three lines coplanar, i.e., are they in a common plane?.

Definition at line 124 of file vgl_homg_line_3d_2_points.h.

template<class Type >
vgl_homg_point_3d< Type > intersection ( l const &  l1,
l const &  l2 
) [related]

Return the intersection point of two concurrent lines.

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

Return true iff line is at infinity.

Definition at line 93 of file vgl_homg_line_3d_2_points.h.

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

Write to stream (verbose).

template<class Type >
vcl_istream & operator>> ( vcl_istream &  is,
l &  p 
) [related]

Read parameters from stream.

template<class T >
vcl_pair< vgl_homg_point_3d< T >, vgl_homg_point_3d< T > > vgl_closest_points ( vgl_homg_line_3d_2_points< T > const &  line1,
vgl_homg_line_3d_2_points< T > const &  line2 
) [related]

Return the two points of nearest approach of two 3D lines, one on each line.

There are 3 cases: the lines intersect (hence these two points are equal); the lines are parallel (an infinite number of solutions viz all points); the lines are neither parallel nor do they intersect (the general case). This method handles all 3 cases. In all cases, a pair of points is returned; in case 1, the two returned points are equal; in case 2, both points are the common point at infinity of the two lines.

Note that case 2 also comprises the case where the given lines are identical. Hence, when observing a point at infinity as a return value, one should interpret this as "all points are closest points".

Parameters:
line1
line2
Returns:
vcl_pair<vgl_homg_point_3d<T>,vgl_homg_point_3d<T> >
Author:
Paul Bourke, modified for use in VXL by Brendan McCane
Note:
This routine is adapted from code written by Paul Bourke and available online at http://astronomy.swin.edu.au/~pbourke/geometry/lineline3d/
template<class T >
double vgl_distance ( vgl_homg_line_3d_2_points< T > const &  line1,
vgl_homg_line_3d_2_points< T > const &  line2 
) [related]

Return the perpendicular distance between two lines in 3D.

See vgl_closest_point.h for more information.

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

Return the perpendicular distance from a point to a line in 3D.

See vgl_closest_point.h for more information.

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

find the shortest distance of the line to the origin.


Member Data Documentation

template<class Type>
vgl_homg_point_3d<Type> vgl_homg_line_3d_2_points< Type >::point_finite_ [mutable, private]

Any finite point on the line.

Definition at line 30 of file vgl_homg_line_3d_2_points.h.

template<class Type>
vgl_homg_point_3d<Type> vgl_homg_line_3d_2_points< Type >::point_infinite_ [mutable, private]

the (unique) point at infinity.

Definition at line 32 of file vgl_homg_line_3d_2_points.h.


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