Added Dcel as a template parameter to General_polygon_set_2 and Polygon_set_2

This commit is contained in:
Efi Fogel 2007-01-14 14:42:35 +00:00
parent 07e8371450
commit c11f6590ae
11 changed files with 140 additions and 72 deletions

View File

@ -2,27 +2,23 @@
\begin{ccRefConcept}{GeneralPolygonSetDcel}
A doubly-connected edge-list (\dcel\ for short) data-structure. It consists
of three containers of records: vertices $V$, halfedges $E$, and faces $F$.
It maintains the incidence relation among them. The halfedges are ordered
in pairs sometimes referred to as twins, such that each halfedge pair
represent an edge.
\ccDefinition
% ===========
The concept \ccRefName{} refines the corresponding arrangemen-\dcel{}
concept \ccc{ArrangemenDcel}. A model of this concept must provide the
types \ccStyle{Vertex}, \ccStyle{Halfedge}, \ccStyle{Face},
\ccStyle{Hole}, and \ccStyle{Isolated_vertex}, which must model the
concepts
\ccc{ArrangementDcelVertex},
\ccc{ArrangementDcelHalfedge},
\ccc{GeneralPolygonSetDcelFace},
\ccc{ArrangementDcelHole}, and
\ccc{ArrangementDcelIsolatedVertex} respectively.
Notice that this concept differs from the base concept \ccc{ArrangemenDcel}
only in the type \ccStyle{Face}.
A model of the \ccRefName\ concept must provide the following types and
operations. (In addition to the requirements here, the local types
\ccHtmlNoLinksFrom{\ccStyle{Vertex},\ccStyle{Halfedge}, \ccStyle{Face}
\ccStyle{Hole} and \ccStyle{Isolated_vertex}}
must be models of the concepts
\ccc{ArrangementDcelVertex}\lcTex{
(\ccRefPage{ArrangementDcelVertex})},
\ccc{ArrangementDcelHalfedge}\lcTex{
(\ccRefPage{ArrangementDcelHalfedge})},
\ccc{ArrangementDcelFace}\lcTex{
(\ccRefPage{ArrangementDcelFace})},
\ccc{ArrangementDcelHole}\lcTex{
(\ccRefPage{ArrangementDcelHole})} and
\ccc{ArrangementDcelIsolatedVertex}\lcTex{
(\ccRefPage{ArrangementDcelIsolatedVertex})} respectively.)
\ccRefines
\ccc{ArrangementDcel}
% \ccTypes
%=======
@ -42,9 +38,6 @@ must be models of the concepts
\ccc{Gps_default_dcel<Traits>}\lcTex{
(\ccRefPage{CGAL::Gps_default_dcel<Traits>})}
\ccSeeAlso
\ccc{ArrangementDcel}\lcTex{(\ccRefPage{ArrangementDcel})}
\end{ccRefConcept}
\ccRefPageEnd

View File

@ -0,0 +1,60 @@
\ccRefPageBegin
\begin{ccRefConcept}{GeneralPolygonSetDcelFace}
\ccDefinition
% ===========
A face record in a \dcel{} data structure used by the
\ccc{General_polygon_set_2} and \ccc{Polygon_set_2} class-templates
to represent the undelying internal \ccc{Arrangement_2} data structure.
\ccRefines
\ccc{ArrangementDcelFace}
% \ccTypes
\ccCreation
\ccCreationVariable{f}
% =========
\ccConstructor{Gps_dcel_face();}
{default constructor.}
\ccMethod{void assign (const Self& other);}
{assigns \ccVar{} with the contents of the \ccc{other} face.}
\ccHtmlNoLinksFrom{ % to avoid linkage of Vertex, etc to HDS::Vertex
\ccAccessFunctions
% ================
\ccMethod{bool contained() const;}{%
returns \ccc{true} if the face is contained in the general-polygon set,
and \ccc{false} otherwise.}
\ccMethod{bool visited();}{%
returns \ccc{true} if the face has been visited, and \ccc{false} otherwise.
This is used internally by the some of the operations of the
\ccc{General_polygon_set_2} class that traverse the arrangement faces.}
\ccModifiers
% ==========
\ccMethod{void set_contained(bool flag);}{%
marks the face as contained (if \ccc{flag} is \ccc{true}), or as a hole
(if it is \ccc{false}).}
\ccMethod{void set_visited(bool flag);}
{marks the face as visited (if \ccc{flag} is \ccc{true}), or as not visited
(if it is \ccc{false}). This is used internally by the some of the
operations of the \ccc{General_polygon_set_2} class that traverse the
arrangement faces..}
} % ccHtmlNoLinksFrom
\ccSeeAlso
\ccc{ArrangementDcel}\lcTex{(\ccRefPage{ArrangementDcel})}\\
\ccc{ArrangementDcelVertex}\lcTex{(\ccRefPage{ArrangementDcelVertex})}\\
\ccc{ArrangementDcelHalfedge}\lcTex{(\ccRefPage{ArrangementDcelHalfedge})}
\end{ccRefConcept}
\ccRefPageEnd

View File

@ -1,6 +1,6 @@
\ccRefPageBegin
\begin{ccRefClass}{General_polygon_set_2<Traits>}
\begin{ccRefClass}{General_polygon_set_2<Traits,Dcel>}
\ccThree{General_polygon_set_2<Traits,Dcel>}{Polygon_2}{}
\ccThreeToTwo
@ -27,13 +27,13 @@ the boundaries of the general polygons. The traits class supports geometric
operations on the types above. We sometimes use the term {\em polygon} instead
of general polygon for simplicity hereafter.
The \ccc{Dcel} template-parameter should be instantiated with a
model of the concept \ccc{GeneralPolygonSetDcel_2}. It is instantiated
by default with the type \ccc{Gps_dcel<Traits>}. You can override this
default, with a {\sc Dcel} class you provide, typically an extension
of the \ccc{Gps_dcel} class template. Overriding the default is needed
only if you intend to obtain the undelying arrangement and process it
further.
The template parameter \ccc{Dcel} should be instantiated with a
model of the concept \ccc{GeneralPolygonSetDcel}. It is instantiated
by default with the type \ccc{Gps_default_dcel<Traits>}. You can override
this default, with a different {\sc Dcel} class, typically an extension
of the \ccc{Gps_default_dcel} class template. Overriding the default is
necessary only if you intend to obtain the undelying internal arrangement
and process it further.
The input and output of the Boolean set-operations methods consist of one
or more general polygons, some of which may have holes. In particular,

View File

@ -4,9 +4,9 @@
\ccDefinition
%============
The class \ccRefName\ is the default \dcel\ class used by the
\ccc{General_polygon_set_2} (and \ccc{Polygon_set_2}) class-templates
to represent the undelying \ccc{Arrangement_2} data structure.
The class \ccRefName\ is the default \dcel{} class used by the
\ccc{General_polygon_set_2} and \ccc{Polygon_set_2} class-templates
to represent the undelying internal \ccc{Arrangement_2} data structure.
\ccInclude{CGAL/Gps_default_dcel.h}
@ -25,9 +25,7 @@ to represent the undelying \ccc{Arrangement_2} data structure.
\ccNestedType{template <class T> rebind}
{allows the rebinding of the \dcel\ with a different traits class \ccc{T}.}
\ccSeeAlso
\ccc{Arr_dcel_base<V,H,F>}\lcTex{(\ccRefPage{CGAL::Arr_dcel_base<V,H,F>})}
% \ccSeeAlso
\end{ccRefClass}

View File

@ -1,18 +1,27 @@
\ccRefPageBegin
\begin{ccRefClass}{Polygon_set_2<Kernel,Container>}
\begin{ccRefClass}{Polygon_set_2<Kernel,Container,Dcel>}
\ccThree{Polygon_set_2<Kernel,Container>}{Polygon_2}{}
\ccThree{Polygon_set_2<Kernel,Container,Dcel>}{Polygon_2}{}
\ccThreeToTwo
\ccDefinition
%============
The class \ccRefName\ represents sets of linear polygons with holes.
It is parameterized with two types (\ccc{Kernel} and \ccc{Container}) that
are used to instantiate the type \ccc{CGAL::Polygon_2<Kernel,Container>}.
The latter is used to represents the outer boundary and the boundary of the
holes of the set members.
The class \ccRefName{} represents sets of linear polygons with holes.
It is parameterized with three types. The types (\ccc{Kernel} and
\ccc{Container}) are used to instantiate the type
\ccc{CGAL::Polygon_2<Kernel,Container>}. The type \ccc{Container} is used
to represents the outer boundary and the boundary of the holes of the set
members.
The \ccc{Dcel} template-parameter should be instantiated with a
model of the concept \ccc{GeneralPolygonSetDcel}. It is instantiated
by default with the type \ccc{Gps_default_dcel<Traits>}. You can override
this default, with a different {\sc Dcel} class, typically an extension
of the \ccc{Gps_default_dcel} class template. Overriding the default is
necessary only if you intend to obtain the undelying internal arrangement
and process it further.
\ccInclude{CGAL/Polygon_set_2.h}

View File

@ -25,8 +25,9 @@ containment predicates.
\ccRefConceptPage{GeneralPolygon_2}\\
\ccRefConceptPage{GeneralPolygonWithHoles_2}\\
\ccRefConceptPage{ArrangementDirectionalXMonotoneTraits_2}\\
\ccRefConceptPage{GeneralPolygonSetTraits_2}
\ccRefConceptPage{GeneralPolygonSetDcel}
\ccRefConceptPage{GeneralPolygonSetTraits_2}\\
\ccRefConceptPage{GeneralPolygonSetDcel}\\
\ccRefConceptPage{GeneralPolygonSetDcelFace}
\subsection*{Classes}

View File

@ -32,6 +32,8 @@
\input{Boolean_set_operations_2_ref/Gps_circle_segment_traits_2.tex}
\input{Boolean_set_operations_2_ref/Gps_traits_2.tex}
\input{Boolean_set_operations_2_ref/Gps_default_dcel.tex}
\input{Boolean_set_operations_2_ref/GeneralPolygonSetDcel}
\input{Boolean_set_operations_2_ref/GeneralPolygonSetDcelFace}
\input{Boolean_set_operations_2_ref/Bso_complement.tex}
\input{Boolean_set_operations_2_ref/Bso_difference.tex}
\input{Boolean_set_operations_2_ref/Bso_do_intersect.tex}

View File

@ -16,18 +16,24 @@
//
//
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_GPS_DCEL_H
#define CGAL_GPS_DCEL_H
#ifndef CGAL_GPS_DEFAULT_DCEL_H
#define CGAL_GPS_DEFAULT_DCEL_H
/*! \file
* This class is the default \dcel{} class used by the General_polygon_set_2
* and Polygon_set_2} class-templates to represent the undelying internal
* Arrangement_2 data structure.
*/
#include <CGAL/Arr_default_dcel.h>
CGAL_BEGIN_NAMESPACE
class Gps_face : public Arr_face_base
class Gps_face_base : public Arr_face_base
{
protected:
protected:
mutable char m_info;
enum
@ -38,11 +44,10 @@ class Gps_face : public Arr_face_base
public:
//Constructor
Gps_face() : Arr_face_base(),
m_info(0)
Gps_face_base() :
Arr_face_base(),
m_info(0)
{}
/*! Assign from another face. */
@ -50,7 +55,7 @@ public:
{
Arr_face_base::assign (f);
const Gps_face& ex_f = static_cast<const Gps_face&>(f);
const Gps_face_base & ex_f = static_cast<const Gps_face_base&>(f);
m_info = ex_f.m_info;
}
@ -61,7 +66,7 @@ public:
void set_contained(bool b)
{
if(b)
if (b)
m_info |= CONTAINED;
else
m_info &= ~CONTAINED;
@ -74,7 +79,7 @@ public:
void set_visited(bool b) const
{
if(b)
if (b)
m_info |= VISITED;
else
m_info &= ~VISITED;
@ -84,16 +89,14 @@ public:
template <class Traits_>
class Gps_dcel :
class Gps_default_dcel :
public Arr_dcel_base<Arr_vertex_base<typename Traits_::Point_2>,
Arr_halfedge_base<typename Traits_::X_monotone_curve_2>,
Gps_face>
Gps_face_base>
{
public:
/*! Default constructor. */
Gps_dcel()
{}
Gps_default_dcel() {}
};

View File

@ -16,6 +16,7 @@
//
//
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_GPS_UTILS_H
#define CGAL_GPS_UTILS_H
@ -25,8 +26,8 @@
#include <CGAL/function_objects.h>
#include <CGAL/circulator.h>
#include <CGAL/Boolean_set_operations_2/Gps_bfs_scanner.h>
#include <CGAL/Boolean_set_operations_2/Gps_dcel.h>
#include <CGAL/Arr_accessor.h>
#include <queue>
template <class Traits_, class Dcel_>
@ -47,7 +48,7 @@ class Arr_bfs_scanner
{
public:
typedef typename Arrangement::Traits_2 Gps_traits;
typedef typename Arrangement::Dcel My_gps_dcel;
typedef typename Arrangement::Dcel Gps_dcel;
typedef typename Gps_traits::Polygon_2 Polygon_2;
typedef typename Gps_traits::Polygon_with_holes_2 Polygon_with_holes_2;
typedef typename Arrangement::Ccb_halfedge_const_circulator
@ -121,7 +122,7 @@ public:
void scan_ccb(Ccb_halfedge_const_circulator ccb)
{
Polygon_2 pgn_boundary;
General_polygon_set_2<Gps_traits, My_gps_dcel>::
General_polygon_set_2<Gps_traits, Gps_dcel>::
construct_polygon(ccb, pgn_boundary, m_traits);
Ccb_halfedge_const_circulator ccb_end = ccb;
@ -165,7 +166,7 @@ public:
if (!f->contained())
{
m_pgn_holes.push_back(Polygon_2());
General_polygon_set_2<Gps_traits, My_gps_dcel>::
General_polygon_set_2<Gps_traits, Gps_dcel>::
construct_polygon(f->outer_ccb(), m_pgn_holes.back(), m_traits);
m_holes_q.push(f);
}
@ -199,7 +200,7 @@ public:
CGAL_assertion(!he->twin()->face()->contained());
m_pgn_holes.push_back(Polygon_2());
General_polygon_set_2<Gps_traits, My_gps_dcel>::
General_polygon_set_2<Gps_traits, Gps_dcel>::
construct_polygon(he->twin()->face()->outer_ccb(),
m_pgn_holes.back(), m_traits);
m_holes_q.push(he->twin()->face());

View File

@ -30,7 +30,7 @@
#include <CGAL/Arr_walk_along_line_point_location.h>
#include <CGAL/Arr_overlay.h>
#include <CGAL/Boolean_set_operations_2/Gps_dcel.h>
#include <CGAL/Boolean_set_operations_2/Gps_default_dcel.h>
#include <CGAL/Boolean_set_operations_2/Gps_do_intersect_functor.h>
#include <CGAL/Boolean_set_operations_2/Gps_intersection_functor.h>
#include <CGAL/Boolean_set_operations_2/Gps_join_functor.h>
@ -43,7 +43,7 @@
CGAL_BEGIN_NAMESPACE
// General_polygon_set_2
template <class Traits_, class Dcel_ = Gps_dcel<Traits_> >
template <class Traits_, class Dcel_ = Gps_default_dcel<Traits_> >
class General_polygon_set_2
{
public:

View File

@ -24,7 +24,7 @@
#include <CGAL/Polygon_2.h>
#include <CGAL/General_polygon_set_2.h>
#include <CGAL/Gps_segment_traits_2.h>
#include <CGAL/Boolean_set_operations_2/Gps_dcel.h>
#include <CGAL/Boolean_set_operations_2/Gps_default_dcel.h>
#include <vector>
@ -32,7 +32,8 @@ CGAL_BEGIN_NAMESPACE
template <class Kernel,
typename Containter = std::vector<typename Kernel::Point_2>,
class Dcel_ = Gps_dcel<Gps_segment_traits_2<Kernel, Containter> > >
class Dcel_ =
Gps_default_dcel<Gps_segment_traits_2<Kernel, Containter> > >
class Polygon_set_2 :
public General_polygon_set_2<Gps_segment_traits_2<Kernel, Containter>, Dcel_>
{