\( \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.6 - 2D Arrangements
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T > Class Template Reference

#include <CGAL/Arr_polyline_traits_2.h>

Definition

The Curve_2 type nested in the Arr_polyline_traits_2 represents general continuous piecewise-linear curves (a polyline can be self-intersecting) and support their construction from range of segments.

Construction of polylines in various ways is supported using the construction functors. It is strongly recommended to avoid construction of Curve_2 objects directly and prefer the usage of the construction functors. The type Curve_2 has two template parameters, namely Segment_type_T and Point_type_T, which are SegmentTraits::Curve_2 and SegmentTraits::Point_2 types. Thus, in general, the segments that a Curve_2 instance comprises could be either \(x\)-monotone or not!

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 std::vector< Segment_2Segments_container
 The container of the segments that comprises the polyline.
 
typedef
Segments_container::size_type 
Segments_size_type
 The size of the container that comprises the polylines.
 
typedef unspecified_type const_iterator
 
typedef unspecified_type const_reverse_iterator
 
typedef unspecified_type Segment_const_iterator
 A bidirectional constant iterator that allows traversing the segments the comprise the polyline.
 
typedef unspecified_type Segment_const_reverse_iterator
 A bidirectional constant iterator that allows traversing the segments the comprise the polyline.
 

Creation

 Curve_2 ()
 Default constructor that constructs an empty polyline.
 
 Curve_2 (const Segment_2 seg)
 Construct a polyline from one segment.
 
template<class InputIterator >
 Curve_2 (Iterator first, Iterator last)
 Constructs a polyline defined by the given range of segments [first, last) (the value-type of InputIterator must be SegmentTraits::Curve_2. More...
 

Access Functions

unsigned_int points () const
 
const_iterator begin () const
 
Segment_const_iterator begin_segments () const
 Obtain an iterator pointing at the first segment of the polyline. More...
 
const_iterator end () const
 
Segment_const_iterator end_segments () const
 Get an iterator pointing at the past-the-end segment of the polyline. More...
 
const_iterator rbegin () const
 
Segment_const_reverse_iterator rbegin_segments () const
 Return an iterator pointing at the last segment of the polyline.
 
const_iterator rend () const
 
Segment_const_reverse_iterator rend_segments () const
 Return an iterator pointing at the past-the-end segment of the polyline in reverse order.
 
Segments_size_type size () const
 
Segments_container_size number_of_segments () const
 Return the number of segments that comprise the polyline.
 
SegmentTraits::X_monotone_curve_2 operator[] (size_t k) const
 Return the \( k\)th segment of the polyline. More...
 
Bbox_2 bbox () const
 Return the bounding box of the polyline.
 

Operations

void push_back (const Segment_2 &seg)
 Append a segment to the polyline at the back. More...
 
void push_front (const Segment_2 &seg)
 Append a segment to the polyline at the front. More...
 
void push_back (const Point_2 &p)
 
void clear ()
 Reset the polyline.
 

Member Typedef Documentation

template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
typedef unspecified_type CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::const_iterator
Deprecated:
A bidirectional iterator that allows traversing the points that comprise a polyline curve.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
typedef unspecified_type CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::const_reverse_iterator
Deprecated:
A bidirectional iterator that allows traversing the points that comprise a polyline curve.

Constructor & Destructor Documentation

template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
template<class InputIterator >
CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::Curve_2 ( Iterator  first,
Iterator  last 
)

Constructs a polyline defined by the given range of segments [first, last) (the value-type of InputIterator must be SegmentTraits::Curve_2.

In general, the segments might not be \(x\)-monotone, furthermore, they might not form a continuous polyline.

Precondition
The segments in the range should form a continuous and well-oriented polyline.
Deprecated:
For backwards compatibility, it is possible to call this constructor with a range whose value-type is SegmentTraits::Point_2. In this case, the constructed polyline will concatenate the \(n\)th point with the \((n+1)\)-st point in the range (using a SegmentTraits::Segment_2's). This functionality is deprecated. Instead use the Construct_curve_2 functors.

Member Function Documentation

template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
const_iterator CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::begin ( ) const
Deprecated:
Return an iterator pointing at the source point of the polyline.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
Segment_const_iterator CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::begin_segments ( ) const

Obtain an iterator pointing at the first segment of the polyline.

template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
const_iterator CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::end ( ) const
Deprecated:
Return an iterator pointing after the end of the polyline.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
Segment_const_iterator CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::end_segments ( ) const

Get an iterator pointing at the past-the-end segment of the polyline.

template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
SegmentTraits::X_monotone_curve_2 CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::operator[] ( size_t  k) const

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

Precondition
\(k\) is not greater then or equal to \(n-1\), where \(n\) is the number of segments.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
unsigned_int CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::points ( ) const
Deprecated:
Return the number of points that comprise the polyline. Note that for a bounded polyline, if there are \( n\) points in the polyline, it is comprised of \( (n - 1)\) segments. Currently, only bounded polylines are supported.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
void CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::push_back ( const Segment_2 seg)

Append a segment to the polyline at the back.

Warning: This function does not preform the precondition test that the Push_back_2 functor does. Thus, it is recommended to use the latter.

Parameters
segThe new segment to be appended to the polyline.
Precondition
If the polyline is not empty, the source of seg must coincide with the target point of the last segment in the polyline.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
void CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::push_back ( const Point_2 p)
Deprecated:
adds a new point to the polyline, which becomes the new target point of pi.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
void CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::push_front ( const Segment_2 seg)

Append a segment to the polyline at the front.

Warning: This is a risky function! Don't use it! Prefer the corresponding functor which is provided in the traits class.

Parameters
segThe new segment to be appended to the polyline.
Precondition
If the polyline is not empty, the target of seg must coincide with the source point of the first segment in the polyline.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
const_iterator CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::rbegin ( ) const
Deprecated:
Return an iterator pointing at the target point of the polyline.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
const_iterator CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::rend ( ) const
Deprecated:
Return an iterator pointing before the beginning of the polyline.
template<typename SegmentTraits >
template<typename Segment_type_T , typename Point_type_T >
Segments_size_type CGAL::Arr_polyline_traits_2< SegmentTraits >::Curve_2< Segment_type_T, Point_type_T >::size ( ) const
Deprecated:
Return the number of line segments composing the polyline (equivalent to pi.points() - 1). Was replaced by number_of_segments()