\( \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.14 - 2D Arrangements
CGAL::Arrangement_with_history_2< Traits, Dcel > Class Template Reference

#include <CGAL/Arrangement_with_history_2.h>

Inherits from

CGAL::Arrangement_2< Traits, Dcel >.

Definition

An object arr of the class Arrangement_with_history_2 represents the planar subdivision induced by a set of input curves \( \cal C\). The arrangement is represented as a doubly-connected edge-list (Dcel). As is the case for the Arrangement_2<Traits,Dcel>, each Dcel vertex is associated with a point and each edge is associated with an \( x\)-monotone curve whose interior is disjoint from all other edges and vertices. Each such \( x\)-monotone curve is a subcurve of some \( C \in \cal C\) - or may represent an overlap among several curves in \( \cal C\).

The Arrangement_with_history_2 class-template extends the Arrangement_2 class-template by keeping an additional container of input curves representing \( \cal C\), and by maintaining a cross-mapping between these curves and the arrangement edges they induce. This way it is possible to determine the inducing curve(s) of each arrangement edge. This mapping also allows the traversal of input curves, and the traversal of edges induced by each curve.

The Arrangement_with_history_2 template has two parameters:

  • The Traits template-parameter should be instantiated with a model of the ArrangementTraits_2 concept. The traits class defines the Curve_2 type, which represents an input curve. It also defines the types of \( x\)-monotone curves and two-dimensional points, namely ArrangementTraits_2::X_monotone_curve_2 and ArrangementTraits_2::Point_2, respectively, and supports basic geometric predicates on them.
  • The Dcel template-parameter should be instantiated with a class that is a model of the ArrangementDcelWithRebind concept. The value of this parameter is by default Arr_default_dcel<Traits>.
See also
ArrangementDcel
Arr_default_dcel<Traits>
ArrangementTraits_2
Arrangement_2<Traits,Dcel>
insertion functions
removal functions
overlaying arrangements
Examples:
Arrangement_on_surface_2/curve_history.cpp, Arrangement_on_surface_2/edge_manipulation_curve_history.cpp, and Arrangement_on_surface_2/io_curve_history.cpp.

Types

typedef Arrangement_with_history_2< Traits_2, DcelSelf
 a private type used as an abbreviation of the Arrangement_with_history_2 type hereafter.
 
typedef unspecified_type Traits_2
 the traits class in use.
 
typedef Traits_2::Point_2 Point_2
 the point type, as defined by the traits class.
 
typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2
 the \( x\)-monotone curve type, as defined by the traits class.
 
typedef Traits_2::Curve_2 Curve_2
 the curve type, as defined by the traits class.
 

In addition, the nested types Vertex, Halfedge and Face are defined, as well as all handle, iterator and circulator types, as defined by the Arrangement_2 class-template.

typedef unspecified_type Curve_handle
 a handle for an input curve.
 
typedef unspecified_type Curve_iterator
 a bidirectional iterator over the curves that induce the arrangement. More...
 
typedef unspecified_type Induced_edge_iterator
 an iterator over the edges induced by an input curve. More...
 
typedef unspecified_type Originating_curve_iterator
 an iterator for the curves that originate a given arrangement edge. More...
 

Creation

 Arrangement_with_history_2 ()
 constructs an empty arrangement containing one unbounded face, which corresponds to the whole plane.
 
 Arrangement_with_history_2 (const Self &other)
 copy constructor.
 
 Arrangement_with_history_2 (Traits_2 *traits)
 constructs an empty arrangement that uses the given traits instance for performing the geometric predicates.
 

Assignment Methods

Selfoperator= (other)
 assignment operator.
 
void assign (const Self &other)
 assigns the contents of another arrangement.
 
void clear ()
 clears the arrangement.
 

Access Functions for Input Curves

See the Arrangement_2 reference pages for the full list.

Size number_of_curves () const
 returns the number of input curves that induce the arrangement.
 
Curve_iterator curves_begin ()
 returns the begin-iterator of the curves inducing the arrangement.
 
Curve_iterator curves_end ()
 returns the past-the-end iterator of the curves inducing the arrangement.
 
Size number_of_induced_edges (Curve_handle ch) const
 returns the number of arrangement edges induced by the curve ch.
 
Induced_edge_iterator induced_edges_begin (Curve_handle ch) const
 returns the begin-iterator of the edges induced by the curve ch.
 
Induced_edge_iterator induced_edges_end (Curve_handle ch) const
 returns the past-the-end iterator of the edges induced by the curve ch.
 
Size number_of_originating_curves (Halfedge_handle e) const
 returns the number of input curves that originate the edge e.
 
Originating_curve_iterator originating_curves_begin (Halfedge_handle e) const
 returns the begin-iterator of the curves originating the edge e.
 
Originating_curve_iterator originating_curves_end (Halfedge_handle e) const
 returns the past-the-end iterator of the curves originating the edge e.
 

Modifying Arrangement Edges

The following functions override their counterparts in the Arrangement_2 class, as they also maintain the cross-relationships between the input curves and the edges they induce.

See the Arrangement_2 reference pages for the full list of functions for modifying arrangement vertices

Halfedge_handle split_edge (Halfedge_handle e, const Point_2 &p)
 splits the edge e into two edges (more precisely, into two halfedge pairs), at a given split point p. More...
 
Halfedge_handle merge_edge (Halfedge_handle e1, Halfedge_handle e2)
 merges the edges represented by e1 and e2 into a single edge. More...
 
Face_handle remove_edge (Halfedge_handle e, bool remove_source=true, bool remove_target=true)
 removes the edge e from the arrangement. More...
 

Additional Inherited Members

- Public Types inherited from CGAL::Arrangement_2< Traits, Dcel >
typedef Arrangement_2< Traits_2, DcelSelf
 a private type used as an abbreviation of the Arrangement_2 type hereafter.
 
typedef Traits Traits_2
 the traits class in use.
 
typedef Traits_2::Point_2 Point_2
 the point type, as defined by the traits class.
 
typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2
 the \( x\)-monotone curve type, as defined by the traits class.
 
typedef Dcel::Size Size
 the size type (equivalent to size_t).
 
typedef unspecified_type Vertex_handle
 a handle for an arrangement vertex.
 
typedef unspecified_type Halfedge_handle
 a handle for a halfedge. More...
 
typedef unspecified_type Face_handle
 a handle for an arrangement face.
 
typedef unspecified_type Vertex_iterator
 a bidirectional iterator over the vertices of the arrangement. More...
 
typedef unspecified_type Halfedge_iterator
 a bidirectional iterator over the halfedges of the arrangement. More...
 
typedef unspecified_type Edge_iterator
 a bidirectional iterator over the edges of the arrangement. More...
 
typedef unspecified_type Face_iterator
 a bidirectional iterator over the faces of arrangement. More...
 
typedef unspecified_type Unbounded_face_iterator
 a bidirectional iterator over the unbounded faces of arrangement. More...
 
typedef unspecified_type Halfedge_around_vertex_circulator
 a bidirectional circulator over the halfedges that have a given vertex as their target. More...
 
typedef unspecified_type Ccb_halfedge_circulator
 a bidirectional circulator over the halfedges of a CCB (connected component of the boundary). More...
 
typedef unspecified_type Hole_iterator
 a bidirectional iterator over the holes (i.e., inner CCBs) contained inside a given face. More...
 
typedef unspecified_type Isolated_vertex_iterator
 a bidirectional iterator over the isolated vertices contained inside a given face. More...
 
- Public Member Functions inherited from CGAL::Arrangement_2< Traits, Dcel >
 Arrangement_2 ()
 constructs an empty arrangement containing one unbounded face, which corresponds to the entire plane.
 
 Arrangement_2 (const Self &other)
 copy constructor.
 
 Arrangement_2 (const Traits_2 *traits)
 constructs an empty arrangement that uses the given traits instance for performing the geometric predicates.
 
Selfoperator= (other)
 assignment operator.
 
void assign (const Self &other)
 assigns the contents of another arrangement.
 
void clear ()
 clears the arrangement.
 
Traits_2get_traits ()
 returns the traits object used by the arrangement instance. More...
 
bool is_empty () const
 determines whether the arrangement is empty (contains only the unbounded face, with no vertices or edges).
 
Size number_of_vertices () const
 returns the number of vertices in the arrangement.
 
Size number_of_isolated_vertices () const
 returns the total number of isolated vertices in the arrangement.
 
Vertex_iterator vertices_begin ()
 returns the begin-iterator of the vertices in the arrangement.
 
Vertex_iterator vertices_end ()
 returns the past-the-end iterator of the vertices in the arrangement.
 
unspecified_type vertex_handles ()
 returns a range over handles of the arrangement vertices .
 
Size number_of_vertices_at_infinity () const
 returns the number of arrangement vertices that lie at infinity and are not associated with valid points. More...
 
Size number_of_halfedges () const
 returns the number of halfedges in the arrangement.
 
Halfedge_iterator halfedges_begin ()
 returns the begin-iterator of the halfedges in the arrangement.
 
Halfedge_iterator halfedges_end ()
 returns the past-the-end iterator of the halfedges in the arrangement.
 
unspecified_type halfedge_handles ()
 returns a range over handles of the arrangement halfedges .
 
Size number_of_edges () const
 returns the number of edges in the arrangement (equivalent to arr.number_of_halfedges() / 2).
 
Edge_iterator edges_begin ()
 returns the begin-iterator of the edges in the arrangement.
 
Edge_iterator edges_end ()
 returns the past-the-end iterator of the edges in the arrangement.
 
unspecified_type edge_handles ()
 returns a range over handles of the arrangement edges .
 
Face_handle unbounded_face ()
 returns a handle for an unbounded face of the arrangement. More...
 
Size number_of_faces () const
 returns the number of faces in the arrangement.
 
Face_iterator faces_begin ()
 returns the begin-iterator of the faces in the arrangement.
 
Face_iterator faces_end ()
 returns the past-the-end iterator of the faces in the arrangement.
 
unspecified_type face_handles ()
 returns a range over handles of the arrangement faces .
 
Size number_of_unbounded_faces () const
 returns the number of unbounded faces in the arrangement. More...
 
Unbounded_face_iterator unbounded_faces_begin ()
 returns the begin-iterator of the unbounded faces in the arrangement.
 
Unbounded_face_iterator unbounded_faces_end ()
 returns the past-the-end iterator of the unbounded faces in the arrangement.
 
Face_handle fictitious_face ()
 returns a handle to the fictitious face of the arrangement. More...
 
Vertex_handle non_const_handle (Vertex_const_handle v)
 casts the given constant vertex handle to an equivalent mutable handle.
 
Halfedge_handle non_const_handle (Halfedge_const_handle e)
 casts the given constant halfedge handle to an equivalent mutable handle.
 
Face_handle non_const_handle (Face_const_handle f)
 casts the given constant face handle to an equivalent mutable handle.
 
Vertex_handle insert_in_face_interior (const Point_2 &p, Face_handle f)
 inserts the point p into the arrangement as an isolated vertex in the interior of the face f and returns a handle for the newly created vertex. More...
 
Halfedge_handle insert_in_face_interior (const X_monotone_curve_2 &c, Face_handle f)
 inserts the curve c that is entirely contained in the interior of a given face f. More...
 
Halfedge_handle insert_from_left_vertex (const X_monotone_curve_2 &c, Vertex_handle v)
 inserts the curve c into the arrangement, such that its left endpoint corresponds to a given arrangement vertex. More...
 
Halfedge_handle insert_from_right_vertex (const X_monotone_curve_2 &c, Vertex_handle v)
 inserts the curve c into the arrangement, such that its right endpoint corresponds to a given arrangement vertex. More...
 
Halfedge_handle insert_at_vertices (const X_monotone_curve_2 &c, Vertex_handle v1, Vertex_handle v2)
 inserts the curve c into the arrangement, such that both c's endpoints correspond to existing arrangement vertices, given by v1 and v2. More...
 
Halfedge_handle insert_in_face_interior (const X_monotone_curve_2 &c, Halfedge_handle fict_pred1, Halfedge_handle fict_pred2=Halfedge_handle())
 inserts an unbounded curve c into the arrangement, such that c is entirely contained within a single unbounded face of the arrangement. More...
 
Halfedge_handle insert_from_left_vertex (const X_monotone_curve_2 &c, Halfedge_handle pred)
 inserts the curve c into the arrangement, such that its left endpoint corresponds to a given arrangement vertex. More...
 
Halfedge_handle insert_from_left_vertex (const X_monotone_curve_2 &c, Halfedge_handle pred, Halfedge_handle fict_pred)
 inserts an unbounded curve c into the arrangement, such that its left endpoint is bounded and corresponds to a given arrangement vertex. More...
 
Halfedge_handle insert_from_right_vertex (const X_monotone_curve_2 &c, Halfedge_handle pred)
 inserts the curve c into the arrangement, such that its right endpoint corresponds to a given arrangement vertex. More...
 
Halfedge_handle insert_from_right_vertex (const X_monotone_curve_2 &c, Halfedge_handle pred, Halfedge_handle fict_pred)
 inserts an unbounded curve c into the arrangement, such that its right endpoint is bounded and corresponds to a given arrangement vertex. More...
 
Halfedge_handle insert_at_vertices (const X_monotone_curve_2 &c, Halfedge_handle pred1, Vertex_handle v2)
 inserts the curve c into the arrangement, such that both c's endpoints correspond to existing arrangement vertices, given by pred1->target() and v2. More...
 
Halfedge_handle insert_at_vertices (const X_monotone_curve_2 &c, Halfedge_handle pred1, Halfedge_handle pred2)
 inserts the curve c into the arrangement, such that both c's endpoints correspond to existing arrangement vertices, given by pred1->target() and pred2->target(). More...
 
Vertex_handle modify_vertex (Vertex_handle v, const Point_2 &p)
 sets p to be the point associated with the vertex v. More...
 
Face_handle remove_isolated_vertex (Vertex_handle v)
 removes the isolated vertex v from the arrangement. More...
 
Halfedge_handle modify_edge (Halfedge_handle e, const X_monotone_curve_2 &c)
 sets c to be the \( x\)-monotone curve associated with the edge e. More...
 
Halfedge_handle split_edge (Halfedge_handle e, const X_monotone_curve_2 &c1, const X_monotone_curve_2 &c2)
 splits the edge e into two edges (more precisely, into two halfedge pairs), associated with the given subcurves c1 and c2, and creates a vertex that corresponds to the split point. More...
 
Halfedge_handle merge_edge (Halfedge_handle e1, Halfedge_handle e2, const X_monotone_curve_2 &c)
 merges the edges represented by e1 and e2 into a single edge, associated with the given merged curve c. More...
 
Face_handle remove_edge (Halfedge_handle e, bool remove_source=true, bool remove_target=true)
 removes the edge e from the arrangement. More...
 
bool is_valid () const
 returns true if arr represents a valid instance of Arrangement_2. More...
 

Member Typedef Documentation

◆ Curve_iterator

template<typename Traits , typename Dcel >
typedef unspecified_type CGAL::Arrangement_with_history_2< Traits, Dcel >::Curve_iterator

a bidirectional iterator over the curves that induce the arrangement.

Its value-type is Curve_2.

◆ Induced_edge_iterator

template<typename Traits , typename Dcel >
typedef unspecified_type CGAL::Arrangement_with_history_2< Traits, Dcel >::Induced_edge_iterator

an iterator over the edges induced by an input curve.

Its value type is Halfedge_handle.

◆ Originating_curve_iterator

template<typename Traits , typename Dcel >
typedef unspecified_type CGAL::Arrangement_with_history_2< Traits, Dcel >::Originating_curve_iterator

an iterator for the curves that originate a given arrangement edge.

Its value type is Curve_handle.

Member Function Documentation

◆ merge_edge()

template<typename Traits , typename Dcel >
Halfedge_handle CGAL::Arrangement_with_history_2< Traits, Dcel >::merge_edge ( Halfedge_handle  e1,
Halfedge_handle  e2 
)

merges the edges represented by e1 and e2 into a single edge.

The function returns a handle for one of the merged halfedges.

Precondition
e1 and e2 share a common end-vertex, of degree \( 2\), and the \( x\)-monotone curves associated with e1 and e2 are mergeable into a single \( x\)-monotone curves.

◆ remove_edge()

template<typename Traits , typename Dcel >
Face_handle CGAL::Arrangement_with_history_2< Traits, Dcel >::remove_edge ( Halfedge_handle  e,
bool  remove_source = true,
bool  remove_target = true 
)

removes the edge e from the arrangement.

Since the e may be the only edge incident to its source vertex (or its target vertex), this vertex can be removed as well. The flags remove_source and remove_target indicate whether the endpoints of e should be removed, or whether they should be left as isolated vertices in the arrangement. If the operation causes two faces to merge, the merged face is returned. Otherwise, the face to which the edge was incident is returned.

◆ split_edge()

template<typename Traits , typename Dcel >
Halfedge_handle CGAL::Arrangement_with_history_2< Traits, Dcel >::split_edge ( Halfedge_handle  e,
const Point_2 p 
)

splits the edge e into two edges (more precisely, into two halfedge pairs), at a given split point p.

The function returns a handle for the halfedge whose source is the same as e->source() and whose target vertex is the split point.

Precondition
p lies in the interior of the curve associated with e.