![]() |
The traits class Arr_linear_traits_2<Kernel> is a model of the ArrangementTraits_2 concept, which enables the construction and maintenance of arrangements of linear objects. The linear objects may be bounded (line segments) or unbounded (rays and lines). Thus, it is also a model of the concept ArrangementOpenBoundaryTraits_2. The traits class is parameterized with a Cgal-kernel model; see the reference page of Arr_segment_traits_2<Kernel> () for further explanations and recommendations on choosing a kernel.
Arr_linear_traits_2<Kernel> defines Kernel::Point_2 as its point type. The nested X_monotone_curve_2 and Curve_2 types defined by the traits class (as is the case with the various segment-traits classes, both types refer to the same class, as every linear object is (weakly) x-monotone), are constructible from a point, a line segment, a ray and from a line (objects of types Kernel::Point_2, Kernel::Segment_2, Kernel::Ray_2 and Kernel::Line_2, respectively). On the other hand, when we are given a curve we can find out its actual type and convert it to the respective kernel object (say, to a Kernel::Ray_2).
#include <CGAL/Arr_linear_traits_2.h>
The Curve_2 (and the X_monotone_curve_2) class nested within the linear-traits can represent all types of linear objects. The class supports the copy and default constructor and the assignment operator. In addition, the operator<< and operator>> for linear objects are defined for standard output and input streams.
typedef typename Kernel::Point_2 | Point_2; | |
typedef typename Kernel::Segment_2 | ||
Segment_2; | ||
typedef typename Kernel::Ray_2 | Ray_2; | |
typedef typename Kernel::Line_2 | Line_2; |
Arr_linear_traits_2<Kernel>::Curve_2 c ( Point_2 p); | |
constructs an degenerate curve equivalent to the point p.
| |
Arr_linear_traits_2<Kernel>::Curve_2 c ( Segment_2 seg); | |
constructs an line segment.
| |
Arr_linear_traits_2<Kernel>::Curve_2 c ( Ray_2 ray); | |
constructs a ray.
| |
Arr_linear_traits_2<Kernel>::Curve_2 c ( Line_2 ln); | |
constructs a line.
|
bool | c.is_point () const | returns whether c is a point (a degenerate curve). | ||
Point_2 | c.point () const |
returns a point object equivalent to c.
| ||
bool | c.is_segment () const | returns whether c is a segment (has two bounded endpoints). | ||
Segment_2 | c.segment () const |
returns a segment object equivalent to c.
| ||
bool | c.is_ray () const | returns whether c is a ray (has a bounded source point and its other end is unbounded). | ||
Ray_2 | c.ray () const |
returns a ray object equivalent to c.
| ||
bool | c.is_line () const | returns whether c is a line (has only unbounded ends). | ||
Line_2 | c.line () const |
returns a line object equivalent to c.
| ||
Line_2 | c.supporting_line () const |
returns the supporting line of c.
| ||
Point_2 | c.source () const |
returns c's source point.
| ||
Point_2 | c.target () const |
returns c's target point.
|