CGAL 5.3 - 2D Arrangements
CGAL::Arr_caching_polyline_traits_2< Kernel, Range > Class Template Reference

#include <CGAL/Arr_caching_polyline_traits_2.h>

Inherits from

CGAL::Arr_polycurve_traits_2< SegmentTraits_2 >.

Definition

The traits class Arr_caching_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 segement of a polyline has to coincide with the source of the \(i+1\)st segment; that is, the polyline has to be well-oriented.

This traits class template serves as an alternative to the more general traits class template Arr_polyline_traits_2<SubcurveTraits_2>, which handles polylines as well. Use this alternative when you need to construct many polylines and every polyline comprises many points. Typically (depending on the substituted Kernel) the geometric objects that compose the polylines (e.g., points) are reference counted, which implies that a copy of a single point amounts to copying a small piece of data (a handle). However, when a polyline is constructed, split, or subdivided into \(x\)-monotone pieces, a large number of points might be copied, which yields with a costly operation. This traits class template uses an internal type to represent polylines, which in turn uses an internal type to represent lines and points that compose polylines. Polylines in the internal representation share the geometric data; thus, only one copy of the geometric objects that compose several polylines reside in memory. Only a shallow copy is performed to carry out each one of the operations above.

CAUTION: If you construct polylines using this traits class template and then insert the polylines into an arrangement, for instance, you must retain the polyline in memory as long as the arrangement is in memory.

Template Parameters
Kernela type that represents a geometric kernel. The number type used by the substituted kernel 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.
Rangea type that represents a valid range of points.

A polyline that comprises \(n > 0\) segments has \( n+1 \) points, and they are represented as objects of type Kernel::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.

Is Model Of:

ArrangementTraits_2

ArrangementDirectionalXMonotoneTraits_2

ArrangementConstructXMonotoneCurveTraits_2

ArrangementApproximateTraits_2

See also
Arr_polyline_traits_2<SubcurveTraits_2>
Examples:
Arrangement_on_surface_2/polylines_caching.cpp.

Classes

class  Construct_curve_2
 Construction functor of a polyline. More...
 
class  Construct_x_monotone_curve_2
 Construction functor of a \(x\)-monotone polyline. More...
 

Types

typedef Kernel::Point_2 Point_2
 
typedef unspecified_type X_monotone_curve_2
 
typedef unspecified_type Curve_2
 

Accessing Functor Objects

Construct_curve_2 construct_curve_2_object () const
 
Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object () const
 

Additional Inherited Members

- Public Types inherited from CGAL::Arr_polycurve_traits_2< SegmentTraits_2 >
typedef SegmentTraits_2 ::Point_2 Point_2
 
typedef SegmentTraits_2 ::Curve_2 Subcurve_2
 
typedef SegmentTraits_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