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

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

#include <vgl_fwd.h>

Public Member Functions

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

Private Attributes

vgl_point_3d< Type > point1_
 
vgl_point_3d< Type > point2_
 

Related Functions

(Note that these are not member functions.)

template<class T >
std::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=nullptr)
 Return the points of closest approach on 2 3D line segments. More...
 
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. More...
 
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. More...
 
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. More...
 
template<class Type >
std::ostream & operator<< (std::ostream &s, const vgl_line_segment_3d< Type > &p)
 Write to stream. More...
 
template<class Type >
std::istream & operator>> (std::istream &is, vgl_line_segment_3d< Type > &p)
 Read from stream. More...
 

Detailed Description

template<class Type>
class vgl_line_segment_3d< Type >

Represents a 3D line segment using two points.

Definition at line 19 of file vgl_fwd.h.

Constructor & Destructor Documentation

◆ vgl_line_segment_3d() [1/3]

template<class Type>
vgl_line_segment_3d< Type >::vgl_line_segment_3d ( )
inlinedefault

Default constructor - does not initialise!.

◆ vgl_line_segment_3d() [2/3]

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.

◆ vgl_line_segment_3d() [3/3]

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.

◆ ~vgl_line_segment_3d()

template<class Type>
vgl_line_segment_3d< Type >::~vgl_line_segment_3d ( )
inlinedefault

Member Function Documentation

◆ contains()

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.

◆ direction()

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.

◆ operator!=()

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.

◆ operator==()

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.

◆ point1()

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.

◆ point2()

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.

◆ point_t()

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.

◆ set()

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

◆ operator<<()

template<class Type >
std::ostream & operator<< ( std::ostream &  s,
const vgl_line_segment_3d< Type > &  p 
)
related

Write to stream.

◆ operator>>()

template<class Type >
std::istream & operator>> ( std::istream &  is,
vgl_line_segment_3d< Type > &  p 
)
related

Read from stream.

◆ vgl_closest_point()

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()

◆ vgl_closest_points()

template<class T >
std::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 = nullptr 
)
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.

◆ vgl_distance()

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()

◆ vgl_intersection()

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 528 of file vgl_intersection.hxx.

Member Data Documentation

◆ point1_

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.

◆ point2_

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: