Represents a 2D line segment using two points. More...
#include <vgl_fwd.h>

Public Member Functions | |
| vgl_line_segment_2d ()=default | |
| Default constructor - does not initialise!. More... | |
| vgl_line_segment_2d (vgl_line_segment_2d< Type > const &l) | |
| Copy constructor. More... | |
| vgl_line_segment_2d (vgl_point_2d< Type > const &p1, vgl_point_2d< Type > const &p2) | |
| Construct from two end points. More... | |
| ~vgl_line_segment_2d ()=default | |
| Destructor. More... | |
| vgl_point_2d< Type > | point1 () const |
| One end-point of the line segment. More... | |
| vgl_point_2d< Type > | point2 () const |
| The other end-point of the line segment. More... | |
| bool | operator== (vgl_line_segment_2d< Type > const &l) const |
| The equality comparison operator. More... | |
| bool | operator!= (vgl_line_segment_2d< Type >const &other) const |
| The inequality comparison operator. More... | |
| Type | a () const |
| Parameter a of line a*x + b*y + c = 0. More... | |
| Type | b () const |
| Parameter b of line a*x + b*y + c = 0. More... | |
| Type | c () const |
| Parameter c of line a*x + b*y + c = 0. More... | |
| vgl_vector_2d< Type > | direction () const |
| unit vector describing line direction. More... | |
| vgl_vector_2d< Type > | normal () const |
| unit vector orthogonal to line. More... | |
| double | slope_radians () const |
| angle with the oriented horizontal line y=0, measured in radians. More... | |
| double | slope_degrees () const |
| angle with the oriented horizontal line y=0, measured in 360-degrees. More... | |
| void | set (vgl_point_2d< Type > const &p1, vgl_point_2d< Type > const &p2) |
| Assignment. More... | |
| vgl_point_2d< Type > | point_t (const double t) const |
| Return a point on the line defined by a scalar parameter t. More... | |
Private Attributes | |
| vgl_point_2d< Type > | point1_ |
| One end of line segment. More... | |
| vgl_point_2d< Type > | point2_ |
| The other end of the line segment. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| template<class T > | |
| vgl_point_2d< T > | vgl_closest_point (vgl_line_segment_2d< T > const &l, vgl_point_2d< T > const &p) |
| Return the closest point on a line segment l to a point p in 2D. More... | |
| template<class T > | |
| double | vgl_distance (vgl_line_segment_2d< T > const &l, vgl_point_2d< T > const &p) |
| Closest distance from a point p to a line segment l in 2D. More... | |
| template<class T > | |
| unsigned | vgl_intersection (vgl_box_2d< T > const &box, vgl_line_segment_2d< T > const &line, vgl_point_2d< T > &p0, vgl_point_2d< T > &p1) |
| Returns the number of intersections of a line segment with a box, up to two are returned in p0 and p1. More... | |
| template<class Type > | |
| std::ostream & | operator<< (std::ostream &s, const vgl_line_segment_2d< Type > &p) |
| Write to stream. More... | |
| template<class Type > | |
| std::istream & | operator>> (std::istream &is, vgl_line_segment_2d< Type > &p) |
| Read from stream. More... | |
| template<class T > | |
| bool | vgl_lineseg_test_line (vgl_line_2d< T > const &l1, vgl_line_segment_2d< T > const &l2) |
| true if the line meets the linesegment. More... | |
| template<class T > | |
| bool | vgl_lineseg_test_point (vgl_point_2d< T > const &p, vgl_line_segment_2d< T > const &lseg) |
| true if the point lies on the line segment and is between the endpoints. More... | |
| template<class T > | |
| bool | vgl_lineseg_test_lineseg (vgl_line_segment_2d< T > const &l1, vgl_line_segment_2d< T > const &l2) |
| return true if the two linesegments meet. More... | |
Represents a 2D line segment using two points.
|
inlinedefault |
Default constructor - does not initialise!.
|
inline |
Copy constructor.
Definition at line 35 of file vgl_line_segment_2d.h.
|
inline |
Construct from two end points.
Definition at line 39 of file vgl_line_segment_2d.h.
|
inlinedefault |
Destructor.
| Type vgl_line_segment_2d< Type >::a | ( | ) | const |
Parameter a of line a*x + b*y + c = 0.
Definition at line 38 of file vgl_line_segment_2d.hxx.
| Type vgl_line_segment_2d< Type >::b | ( | ) | const |
Parameter b of line a*x + b*y + c = 0.
Definition at line 44 of file vgl_line_segment_2d.hxx.
| Type vgl_line_segment_2d< Type >::c | ( | ) | const |
Parameter c of line a*x + b*y + c = 0.
Definition at line 50 of file vgl_line_segment_2d.hxx.
| vgl_vector_2d< Type > vgl_line_segment_2d< Type >::direction | ( | ) | const |
unit vector describing line direction.
Definition at line 56 of file vgl_line_segment_2d.hxx.
| vgl_vector_2d< Type > vgl_line_segment_2d< Type >::normal | ( | ) | const |
unit vector orthogonal to line.
Definition at line 63 of file vgl_line_segment_2d.hxx.
|
inline |
The inequality comparison operator.
Definition at line 58 of file vgl_line_segment_2d.h.
|
inline |
The equality comparison operator.
Definition at line 53 of file vgl_line_segment_2d.h.
|
inline |
One end-point of the line segment.
Definition at line 47 of file vgl_line_segment_2d.h.
|
inline |
The other end-point of the line segment.
Definition at line 50 of file vgl_line_segment_2d.h.
|
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.
Definition at line 94 of file vgl_line_segment_2d.h.
|
inline |
Assignment.
Definition at line 86 of file vgl_line_segment_2d.h.
| double vgl_line_segment_2d< Type >::slope_degrees | ( | ) | const |
angle with the oriented horizontal line y=0, measured in 360-degrees.
Returns values between -180 and 180.
Definition at line 70 of file vgl_line_segment_2d.hxx.
| double vgl_line_segment_2d< Type >::slope_radians | ( | ) | const |
angle with the oriented horizontal line y=0, measured in radians.
Returns values between -pi and pi.
Definition at line 85 of file vgl_line_segment_2d.hxx.
|
related |
Write to stream.
|
related |
Read from stream.
|
related |
Return the closest point on a line segment l to a point p in 2D.
|
related |
Closest distance from a point p to a line segment l in 2D.
|
related |
Returns the number of intersections of a line segment with a box, up to two are returned in p0 and p1.
(warning! one intersection could be either p0 or p1).
|
related |
true if the line meets the linesegment.
End points are considered to belong to a line segment.
Definition at line 42 of file vgl_lineseg_test.h.
|
related |
return true if the two linesegments meet.
End points are considered to belong to a line segment.
Definition at line 64 of file vgl_lineseg_test.h.
|
related |
true if the point lies on the line segment and is between the endpoints.
Definition at line 91 of file vgl_lineseg_test.hxx.
|
private |
One end of line segment.
Definition at line 26 of file vgl_line_segment_2d.h.
|
private |
The other end of the line segment.
Definition at line 28 of file vgl_line_segment_2d.h.
1.8.15