CGAL 6.1.1 - 2D Arrangements

Loading...
Searching...
No Matches
List of all members | Classes
CGAL::Arr_polyline_traits_2< SegmentTraits_2 > Class Template Reference
Reference Manual » Geometry Traits Classes

`#include <CGAL/Arr_polyline_traits_2.h>`

## Inherits from

CGAL::Arr_polycurve_traits_2< SegmentTraits_2 >.

## Definition

template<typename SegmentTraits_2>
class CGAL::Arr_polyline_traits_2< SegmentTraits_2 >

The traits class `Arr_polyline_traits_2` handles piecewise linear curves, commonly referred to as polylines.

Each polyline is a chain of segments, where each two neighboring segments in the chain share a common endpoint; that is, the polyline is continuous. Furthermore, the target of the \(i\)th segment of a polyline has to coincide with the source of the \(i+1\)st segment; that is, the polyline has to be well-oriented. Note that it is possible to construct general polylines that are neither continuous nor well-oriented, as it is impossible to enforce this precondition (using the set of predicates required by the relevant concepts, see below). However, such polylines cannot be used for the actual computation of arrangements. The traits class template exploits the functionality of the `SegmentTraits_2` template-parameter to handle the segments that compose the polyline curves.

The type substituting the template parameter `SegmentTraits_2` when the template Arr_polyline_traits_2 is instantiated must be a model of the concepts

- `AosTraits_2`,
- `AosDirectionalXMonotoneTraits_2`,
- `AosConstructXMonotoneCurveTraits_2`,
- `AosConstructCurveTraits_2`.

If, in addition, the GeometryTraits_2 models the concept `AosApproximateTraits_2` (or `AosApproximatePointTraits_2`) then `Arr_polycurve_traits_2` models this concept as well. The same holds for the concept `AosOpenBoundaryTraits_2`. If no type is provided, then `Arr_segment_traits_2` (instantiated with `Exact_predicates_exact_constructions_kernel` as the kernel) is used. Otherwise, `Arr_Bezier_curve_traits_2<RatKernel, AlgKernel, NtTraits>`, `Arr_circle_segment_traits_2<Kernel>`, `Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>` `Arr_linear_traits_2<Kernel>` `Arr_non_caching_segment_traits_2<Kernel>`, `Arr_segment_traits_2<Kernel>`, or any other model of the concepts above can be used.

The number type used by the injected segment traits should support exact rational arithmetic (that is, the number type should support the arithmetic operations \(+\), \(-\), \(\times\) and \(\div\) carried out without loss of precision), in order to avoid robustness problems, although other inexact number types could be used at the user's own risk.

A polyline that comprises \(n > 0\) segments has \(n+1\) points, and they are represented as objects of type `SegmentTraits_2::Point_2`. Since the notion of a vertex is reserved to 0-dimensional elements of an arrangement, we use, in this context, the notion of points in order to refer to the vertices of a polyline. For example, an arrangement induced by a single non-self intersecting polyline has exactly two vertices regardless of the number of points. Finally, the types `Segment_2` and `X_monotone_segment_2` nested in `Arr_polyline_traits_2` are nothing but `SegmentTraits_2::Curve_2` and `SegmentTraits_2::X_monotone_curve_2`, respectively.

A note on Backwards compatibility
In CGAL version 4.2 (and earlier) any object of the `X_monotone_curve_2` type nested in `Arr_polyline_traits_2` maintained a direction invariant; namely, its vertices were ordered in an ascending lexicographical \((xy)\)-order. This restriction is no longer imposed and `X_monotone_curve_2` can be now directed either from right-to-left or left-to-right. If you wish to maintain a left-to-right orientations of the \(x\)-monotone polylines, set the macro `CGAL_ALWAYS_LEFT_TO_RIGHT` to 1 before any CGAL header is included.

Is model of
  `AosTraits_2`
  `AosDirectionalXMonotoneTraits_2`
  `AosConstructXMonotoneCurveTraits_2`
  `AosConstructCurveTraits_2`
  `AosApproximateTraits_2` (if the type that substitutes the template parameter `SegmentTraits_2` models the concept as well)

See also
  `Arr_polycurve_traits_2<SubcurveTraits_2>`
  `Arr_Bezier_curve_traits_2<RatKernel, AlgKernel, NtTraits>`
  `Arr_circle_segment_traits_2<Kernel>`
  `Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>`
  `Arr_linear_traits_2<Kernel>`
  `Arr_non_caching_segment_traits_2<Kernel>`
  `Arr_segment_traits_2<Kernel>`
  `CGAL_ALWAYS_LEFT_TO_RIGHT`

## Classes
class | Construct_curve_2
| Construction functor of a general (not necessarily \(x\)-monotone) polyline. More...
class | Construct_x_monotone_curve_2
| Construction functor of \(x\)-monotone polyline. More...
class | Curve_2
| The `Curve_2` type nested within the traits class respresnts polylines. More...
class | Push_back_2
| Functor to augment a polyline by either adding a vertex or a segment at the back. More...
class | Push_front_2
| Functor to augment a polyline by either adding a vertex or a segment at the front. More...
class | X_monotone_curve_2
| The `X_monotone_curve_2` type nested within the traits class respresnts \(x\)-monotone polylines. More...

## Types
typedef SegmentTraits_2 | Segment_traits_2
typedef SegmentTraits_2::Point_2 | Point_2
typedef SegmentTraits_2::Curve_2 | Segment_2
typedef SegmentTraits_2::X_monotone_curve_2 | X_monotone_segment_2

## Accessing Functor Objects
Construct_curve_2 | construct_curve_2_object () const
Construct_x_monotone_curve_2 | construct_x_monotone_curve_2_object () const
Push_back_2 | push_back_2_object () const
Push_front_2 | push_front_2_object () const

## Additional Inherited Members
Public Types inherited from CGAL::Arr_polycurve_traits_2< SegmentTraits_2 >
typedef SubcurveTraits_2::Point_2 | Point_2
typedef SubcurveTraits_2::Curve_2 | Subcurve_2
typedef SubcurveTraits_2::X_monotone_curve_2 | X_monotone_subcurve_2
Public Member Functions inherited from CGAL::Arr_polycurve_traits_2< SegmentTraits_2 >
Construct_curve_2 | construct_curve_2_object () const
Construct_x_monotone_curve_2 | construct_x_monotone_curve_2_object () const
Number_of_points_2 | number_of_points_2_object () const
Push_back_2 | push_back_2_object () const
Push_front_2 | push_front_2_object () const
Make_x_monotone_2 | make_x_monotone_2_object () const