\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)

CGAL 4.3 - 2D Arrangements

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2 Class Reference

`#include <CGAL/Arr_polyline_traits_2.h>`

## Definition

The `Curve_2` class nested within the polyline traits is used to represent general continuous piecewise-linear curves (a polyline can be self-intersecting) 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, and an `operator>>` for the curves is defined for standard input streams.

## Types
typedef unspecified_type | const_iterator
| A bidirectional iterator that allows traversing the points that comprise a polyline curve.
typedef unspecified_type | const_reverse_iterator
| A bidirectional iterator that allows traversing the points that comprise a polyline curve.

## Creation
| Curve_2 ()
| default constructor that constructs an empty polyline.
template<class InputIterator >
| Curve_2 (Iterator first, Iterator last)
| constructs a polyline defined by the given range of points `[first, last)` (the value-type of `InputIterator` must be `SegmentTraits::Point_2`. More...

## Access Functions
size_t | points () const
| returns the number of points that comprise the polyline. More...
const_iterator | begin () const
| returns an iterator pointing at the source point of the polyline.
const_iterator | end () const
| returns an iterator pointing after the end of the polyline.
const_iterator | rbegin () const
| returns an iterator pointing at the target point of the polyline.
const_iterator | rend () const
| returns an iterator pointing before the beginning of the polyline.
size_t | size () const
| returns the number of line segments comprising the polyline (equivalent to `pi.points() - 1`).
SegmentTraits::X_monotone_curve_2 | operator[] (size_t k) const
| returns the \( k\)th segment of the polyline. More...
Bbox_2 | bbox () const
| return a bounding box of the polyline `pi`.

## Operations
void | push_back (const Point_2 &p)
| adds a new point to the polyline, which becomes the new target point of `pi`.
void | clear ()
| resets the polyline.

## Constructor & Destructor Documentation

template<typename SegmentTraits >
template<class InputIterator >

CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2::Curve_2 | ( | Iterator | first,
|  | Iterator | last
| ) |  |

constructs a polyline defined by the given range of points `[first, last)` (the value-type of `InputIterator` must be `SegmentTraits::Point_2`.

If the range contains \( (n + 1)\) points labeled \( (p_{0},p_{1},\ldots,p_{n})\), the generated polyline consists of \( n\) segments, where the \( k\)th segment is defined by the endpoints \( [p_{k-1},p_{k}]\). 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.

## Member Function Documentation

template<typename SegmentTraits >

SegmentTraits::X_monotone_curve_2 CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2::operator[] | ( | size_t | k) |  | const

returns the \( k\)th segment of the polyline.

Precondition
  `k` is not greater or equal to `pi.size() - 1`.

template<typename SegmentTraits >

size_t CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2::points | ( | ) |  | const

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.