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

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

#include <vgl_line_segment_3d.h>

List of all members.

Public Member Functions

 vgl_line_segment_3d ()
 Default constructor - does not initialise!.
 vgl_line_segment_3d (vgl_line_segment_3d< Type > const &l)
 Copy constructor.
 vgl_line_segment_3d (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2)
 Construct from two end points.
 ~vgl_line_segment_3d ()
vgl_point_3d< Type > point1 () const
vgl_point_3d< Type > point2 () const
bool operator== (vgl_line_segment_3d< Type > const &l) const
 the comparison operator.
bool operator!= (vgl_line_segment_3d< Type >const &other) const
void set (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2)
 assignment.
vgl_vector_3d< Type > direction () const
 Return the direction vector of this line (not normalised - but perhaps it should be, like other line classes?).
vgl_point_3d< Type > point_t (const double t) const
 Return a point on the line defined by a scalar parameter t.
bool contains (const vgl_point_3d< Type > &p) const
 Check if point p is on the line segment.

Private Attributes

vgl_point_3d< Type > point1_
vgl_point_3d< Type > point2_

Related Functions

(Note that these are not member functions.)

template<class T >
vcl_pair< vgl_point_3d< T >
, vgl_point_3d< T > > 
vgl_closest_points (const vgl_line_segment_3d< T > &l1, const vgl_line_segment_3d< T > &l2, bool *unique=0)
 Return the points of closest approach on 2 3D line segments.
template<class T >
vgl_point_3d< T > vgl_closest_point (vgl_line_segment_3d< T > const &l, vgl_point_3d< T > const &p)
 Return the closest point on a line segment l to a point p in 3D.
template<class T >
double vgl_distance (vgl_line_segment_3d< T > const &l, vgl_point_3d< T > const &p)
 Closest distance from a point p to a line segment l in 3D.
template<class T >
bool vgl_intersection (vgl_line_segment_3d< T > const &l1, vgl_line_segment_3d< T > const &l2, vgl_point_3d< T > &i_pnt)
 Return the intersection point of segments of two concurrent lines. Returns false if the intersection point is not inside both line segments.
template<class Type >
vcl_ostream & operator<< (vcl_ostream &s, const vgl_line_segment_3d< Type > &p)
 Write to stream.
template<class Type >
vcl_istream & operator>> (vcl_istream &is, vgl_line_segment_3d< Type > &p)
 Read from stream.

Detailed Description

template<class Type>
class vgl_line_segment_3d< Type >

Represents a 3D line segment using two points.

Definition at line 24 of file vgl_line_segment_3d.h.


Constructor & Destructor Documentation

template<class Type>
vgl_line_segment_3d< Type >::vgl_line_segment_3d ( ) [inline]

Default constructor - does not initialise!.

Definition at line 31 of file vgl_line_segment_3d.h.

template<class Type>
vgl_line_segment_3d< Type >::vgl_line_segment_3d ( vgl_line_segment_3d< Type > const &  l) [inline]

Copy constructor.

Definition at line 34 of file vgl_line_segment_3d.h.

template<class Type>
vgl_line_segment_3d< Type >::vgl_line_segment_3d ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2 
) [inline]

Construct from two end points.

Definition at line 38 of file vgl_line_segment_3d.h.

template<class Type>
vgl_line_segment_3d< Type >::~vgl_line_segment_3d ( ) [inline]

Definition at line 42 of file vgl_line_segment_3d.h.


Member Function Documentation

template<class Type>
bool vgl_line_segment_3d< Type >::contains ( const vgl_point_3d< Type > &  p) const [inline]

Check if point p is on the line segment.

Definition at line 69 of file vgl_line_segment_3d.h.

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

Return the direction vector of this line (not normalised - but perhaps it should be, like other line classes?).

Definition at line 58 of file vgl_line_segment_3d.h.

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

Definition at line 52 of file vgl_line_segment_3d.h.

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

the comparison operator.

Definition at line 48 of file vgl_line_segment_3d.h.

template<class Type>
vgl_point_3d<Type> vgl_line_segment_3d< Type >::point1 ( ) const [inline]

Definition at line 44 of file vgl_line_segment_3d.h.

template<class Type>
vgl_point_3d<Type> vgl_line_segment_3d< Type >::point2 ( ) const [inline]

Definition at line 45 of file vgl_line_segment_3d.h.

template<class Type>
vgl_point_3d<Type> vgl_line_segment_3d< Type >::point_t ( const double  t) const [inline]

Return a point on the line defined by a scalar parameter t.

t=0.0 corresponds to point1 and t=1.0 to point2. 0<t<1 for points on the segment between point1 and point2. t<0 for points on the (infinite) line, outside the segment, and closer to point1 than to point2. t>1 for points on the (infinite) line, outside the segment, and closer to point2 than to point1.

Note:
Assumes that direction() is not normalized.

Definition at line 66 of file vgl_line_segment_3d.h.

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

assignment.

Definition at line 55 of file vgl_line_segment_3d.h.


Friends And Related Function Documentation

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

Write to stream.

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

Read from stream.

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

Return the closest point on a line segment l to a point p in 3D.

See also:
vgl_distance_to_linesegment()
template<class T >
vcl_pair< vgl_point_3d< T >, vgl_point_3d< T > > vgl_closest_points ( const vgl_line_segment_3d< T > &  l1,
const vgl_line_segment_3d< T > &  l2,
bool *  unique = 0 
) [related]

Return the points of closest approach on 2 3D line segments.

Uses non-homogeneous representations.

Returns:
The pair of closest points, the first on l1, the second on l2.
Return values:
uniqueIf provided, will be set to true if the returned points are unique, otherwise many solutions exist and the returned points are an arbitrary choice. The distance between the points is still valid, however.
template<class T >
double vgl_distance ( vgl_line_segment_3d< T > const &  l,
vgl_point_3d< T > const &  p 
) [related]

Closest distance from a point p to a line segment l in 3D.

See also:
vgl_distance_to_linesegment()
vgl_distance2_to_linesegment()
template<class T >
bool vgl_intersection ( vgl_line_segment_3d< T > const &  l1,
vgl_line_segment_3d< T > const &  l2,
vgl_point_3d< T > &  i_pnt 
) [related]

Return the intersection point of segments of two concurrent lines. Returns false if the intersection point is not inside both line segments.

Return the intersection point of segments of two concurrent lines.

Definition at line 474 of file vgl_intersection.txx.


Member Data Documentation

template<class Type>
vgl_point_3d<Type> vgl_line_segment_3d< Type >::point1_ [private]

Definition at line 26 of file vgl_line_segment_3d.h.

template<class Type>
vgl_point_3d<Type> vgl_line_segment_3d< Type >::point2_ [private]

Definition at line 27 of file vgl_line_segment_3d.h.


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