CGAL::Arr_linear_traits_2<Kernel>

Definition

The traits class Arr_linear_traits_2<Kernel> is a model of the ArrangementTraits_2 concept that allows for the construction and maintenance of arrangements of linear objects which may be bounded (line segments) or unbounded (rays and lines). 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>

Is Model for the Concepts

ArrangementTraits_2
ArrangementLandmarkTraits_2

Class Arr_linear_traits_2<Kernel>::Curve_2

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.

Types

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;

Creation

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.

Access Functions

bool c.is_point () returns whether c is a point (a degenerate curve).
Point_2 c.point () returns a point object equivalent to c.
Precondition: c is a point.

bool c.is_segment () returns whether c is a segment (has two bounded endpoints).
Segment_2 c.segment () returns a segment object equivalent to c.
Precondition: c is a segment.

bool c.is_ray () returns whether c is a ray (has a bounded source point and its other end is unbounded).
Ray_2 c.ray () returns a ray object equivalent to c.
Precondition: c is a ray.

bool c.is_line () returns whether c is a line (has only unbounded ends).
Line_2 c.line () returns a line object equivalent to c.
Precondition: c is a line.

Line_2 c.supporting_line () returns the supporting line of c.
Precondition: c is not a point (a degenerate curve).

Point_2 c.source () returns c's source point.
Precondition: c is a point, a segment or a ray.
Point_2 c.target () returns c's target point.
Precondition: c is a point or a segment.