CGAL::Arr_polyline_traits_2<Segment_traits>

Definition

The class Arr_polyline_traits_2<Segment_traits> is a traits class for polyline curves, which are piecewise linear curves - chains of segments, where each two neighboring segments in the chain share a common endpoint. The traits class uses functionality of the Segment_traits to handle the segments that comprise the polyline curve.

The template parameter Segment_traits corresponds to a traits class for line segment that is a model of the ArrangementTraits_2 concept (such as Arr_segment_traits_2<Kernel> or Arr_segment_cached_traits_2<Kernel>).

The Kernel must use a number type that supports exact computations with rational numbers, such as Quotient<Gmpz> or leda_rational. Other inexact representations can be used at the user's own risk.

#include <CGAL/Arr_polyline_traits_2.h>

Is Model for the Concept

ArrangementTraits_2

Class Arr_polyline_traits_2<Segment_traits>::Curve_2

The Curve_2 class nested within the polylines' traits is used to represent piecewise linear curves and support their construction from any range of points. The copy and default constructor as well as the assignment operator are provided for polyline curves. In addition, an operator<< for the curves is defined for standard output streams.

Types

Arr_polyline_traits_2<Segment_traits>::Curve_2::const_iterator
A reversible iterator for traversing the points that comprise the polyline curves. Supports the increment (operator++), decrement (operator--), dereference (operator*) and equality (operator== and operator!=) operators.

Creation

template <class Iterator>
Arr_polyline_traits_2<Segment_traits>::Curve_2 cv ( Iterator begin,
Iterator end);
constructs a polyline defined by the given range of points. The Iterator type must be Segment_traits::Point_2. If the range contains n points labeled (p0,p1,...,pn-1), the generated polyline consists of n-1 segments, where the kth segment is defined by the endpoints [pk-1,pk]. The first point in the range is considered as the source point of the polyline while the last point is considered as its target.
Precondition: There are at least two points in the range.

Operations

const_iterator cv.begin () returns a const_iterator pointing at the source point of the polyline.

const_iterator cv.end () returns a const_iterator pointing after the end of the polyline.

const_iterator cv.rbegin () returns a const_iterator pointing at the target point of the polyline.

const_iterator cv.rend () returns a const_iterator pointing before the beginning of the polyline.

int cv.points () returns the number of points that comprise the polyline. Note that if there are n points in the polyline, it is comprised of n-1 segments.