From b1334aa7180484440328a516c83051adcf65a01b Mon Sep 17 00:00:00 2001 From: Guy Zucker Date: Tue, 2 Sep 2008 10:54:01 +0000 Subject: [PATCH] Added functionality to models of GeneralPolygonSetTraits_2 --- .gitattributes | 2 + .../GeneralPolygonWithHoles_2.tex | 2 +- .../GeneralPolygon_2.tex | 4 +- .../GpsGeneralPolygonWithHoles_2.tex | 68 ++++++++++++ .../GpsGeneralPolygon_2.tex | 78 ++++++++++++++ .../bezier_traits_adapter.cpp | 4 +- .../circle_segment.cpp | 4 +- .../conic_traits_adapter.cpp | 2 +- .../CGAL/Boolean_set_operations_2/Gps_utils.h | 8 +- .../CGAL/General_polygon_with_holes_2.h | 18 ++-- .../include/CGAL/Gps_segment_traits_2.h | 83 ++++++++++++++- .../include/CGAL/Gps_traits_2.h | 100 ++++++++++++++++-- 12 files changed, 342 insertions(+), 31 deletions(-) create mode 100644 Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygonWithHoles_2.tex create mode 100644 Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygon_2.tex diff --git a/.gitattributes b/.gitattributes index dc868ab00ad..dd0879be4e4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1241,6 +1241,8 @@ Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/fig/triangles.pdf -tex Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/fig/unique.eps -text svneol=unset#application/postscript Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/fig/unique.gif -text svneol=unset#image/gif Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/fig/unique.pdf -text svneol=unset#application/pdf +Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygonWithHoles_2.tex -text +Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygon_2.tex -text Boolean_set_operations_2/examples/Boolean_set_operations_2/char_g.dat -text Boolean_set_operations_2/examples/Boolean_set_operations_2/char_m.dat -text Boolean_set_operations_2/examples/Boolean_set_operations_2/pgn_holes.dat -text diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonWithHoles_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonWithHoles_2.tex index 02927a4f5f0..750ad24815d 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonWithHoles_2.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonWithHoles_2.tex @@ -1,5 +1,5 @@ \ccRefPageBegin - + \def\ccLongParamLayout{\ccFalse} \begin{ccRefConcept}{GeneralPolygonWithHoles_2} diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygon_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygon_2.tex index 12edd1084f6..f85325edea1 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygon_2.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygon_2.tex @@ -13,7 +13,7 @@ polygon edges. Its value type is \ccc{X_monotone_curve_2}.} \ccGlue \ccNestedType{Curve_const_iterator}{a const iterator over the geometric mapping of the polygon edges. Its value type is \ccc{X_monotone_curve_2}.} - + \ccDefinition % =========== A model of this concept represents a simple general-polygon. The @@ -81,7 +81,7 @@ The value type of \ccc{Iterator} must be \ccc{X_monotone_curve_2}. \ccHasModels % ========== -\ccc{CGAL::General_polygon_2} +\ccc{CGAL::General_polygon_2} {CGAL::Polygon_2} \end{ccRefConcept} diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygonWithHoles_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygonWithHoles_2.tex new file mode 100644 index 00000000000..929d3ea6f51 --- /dev/null +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygonWithHoles_2.tex @@ -0,0 +1,68 @@ +\ccRefPageBegin + +\def\ccLongParamLayout{\ccFalse} +\begin{ccRefConcept}{Gps::GeneralPolygonWithHoles_2} + +\ccTypes +% ====== +\ccThree{GeneralPolygonWithHoles}{Hole_const_iterator~}{} +\ccThreeToTwo + +% \ccNestedType{Size}{number of holes size type.} + +\ccNestedType{General_polygon_2}{the general-polygon type used to +represent the outer boundary and each hole. Must model the Gps::GeneralPolygon_2 concept.} + +\ccNestedType{Hole_const_iterator}{a bidirectional iterator + over the polygonal holes. Its value type is + \ccc{General_polygon_2}.} + +\ccDefinition +% =========== +A model of this concept represents a general polygon with holes. This is the +base concept for polygon with holes, and therefore does not require the ability +to access its boundary or holes, but only to be default constructable, copy +constructable, and assignable. + +% \lcTex{\ccwParamIndent=0mm} +\ccThree{GeneralPolygonWithHoles_2}{polygon.outer_boundary()~~~}{} +\ccThreeToTwo + +\ccCreation +\ccCreationVariable{polygon} + +\ccConstructor{GeneralPolygonWithHoles_2();}{default constructor.} +\ccGlue +\ccConstructor{GeneralPolygonWithHoles_2(GeneralPolygonWithHoles_2 other);} +{copy constructor.} +\ccGlue +\ccMethod{GeneralPolygonWithHoles_2 operator=(other);}{assignment operator.} + +\ccConstructor{template +GeneralPolygonWithHoles_2(General_polygon_2 & outer, + InputIterator begin, InputIterator end);} +{constructs a general polygon with holes using a given general polygon \ccc{outer} +as the outer boundary and a given range of holes. If \ccc{outer} is an empty +general polygon, then an unbounded polygon with holes will be created. The holes must be +contained inside the outer boundary, and the polygons representing the holes +must be strictly simple and pairwise disjoint, except perhaps at the vertices.} + +\ccPredicates +% =========== +\ccMethod{bool is_unbounded();} +{returns \ccc{true} if the outer boundary is empty, and \ccc{false} +otherwise.} + +\ccAccessFunctions +% ================ + +\ccHasModels +%=========== +\ccc{CGAL::General_polygon_with_holes_2}\\ +\ccc{CGAL::Polygon_with_holes_2}\\ +\ccc{CGAL::Gps_circle_segment_traits_2::Polygon_with_holes_2}\\ +\ccc{CGAL::Gps_traits_2::Polygon_with_holes_2} + +\end{ccRefConcept} + +\ccRefPageEnd diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygon_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygon_2.tex new file mode 100644 index 00000000000..b8f138de431 --- /dev/null +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GpsGeneralPolygon_2.tex @@ -0,0 +1,78 @@ +\ccRefPageBegin + +\begin{ccRefConcept}{Gps::GeneralPolygon_2} + +\ccTypes +%======= + +\ccNestedType{X_monotone_curve_2}{represents a planar (weakly) $x$-monotone + curve. The type of the geometric mapping of the polygonal edges.} + +\ccNestedType{Curve_iterator}{an iterator over the geometric mapping of the +polygon edges. Its value type is \ccc{X_monotone_curve_2}.} +\ccGlue +\ccNestedType{Curve_const_iterator}{a const iterator over the geometric +mapping of the polygon edges. Its value type is \ccc{X_monotone_curve_2}.} + +\ccDefinition +% =========== +A model of this concept represents a simple general-polygon. The +geometric mapping of the edges of the polygon must be $x$-monotone curves. +This is the base concept for polygons, and therefore does not require the ability +to access these curves, but only to be default constructable, copy constructable, +and assignable. +The general polygon represented must be simple. That is, the +only points of the plane belonging to two curves are the geometric mapping +of the polygon vertices. In addition, the vertices of the represented +polygon must be ordered consistently, and the curved must be directed +accordingly. Only counterclockwise oriented polygons are valid operands +of Boolean set-operations. General polygon that represent holes must be +clockwise oriented. + +\ccCreation +\ccCreationVariable{polygon} + +\ccThree{Edge_const_iterator~~~}{}{\hspace*{7cm}} +\ccThreeToTwo + +\ccConstructor{GeneralPolygon_2();}{default constructor.} +\ccGlue +\ccConstructor{GeneralPolygon_2(GeneralPolygon_2 other);} +{copy constructor.} +\ccGlue +\ccMethod{GeneralPolygon_2 operator=(other);}{assignment operator.} +\ccGlue +\ccConstructor{template +GeneralPolygon_2(InputIterator begin, InputIterator end);} +{constructs a general polygon from a given range of curves.} + +\ccAccessFunctions +%================= + +\ccModifiers +% ========== + +\ccMethod{template + void init(Iterator begin, Iterator end);} +{initializes the polygon with the polygonal chain given by the range. +The value type of \ccc{Iterator} must be \ccc{X_monotone_curve_2}. +\ccPrecond{The curves in the range must define a simple polygon.}} + +% \ccPredicates +% % =========== +% +% \ccMethod{bool is_simple();}{returns \ccc{true} if the polygon is simple, +% and \ccc{false} otherwise. Used as precondition for some of the operations.} +% \ccGlue +% \ccMethod{bool is_strictly_simple();}{returns \ccc{true} if the polygon +% is strictly simple, and \ccc{false} otherwise. Used as precondition for +% some of the operations. +% \ccPrecond{\ccStyle{is_simple()}.}} + +\ccHasModels +% ========== +\ccc{CGAL::General_polygon_2} + +\end{ccRefConcept} + +\ccRefPageEnd diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp index ec0e3bedd8a..0ed366897c2 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp @@ -42,8 +42,8 @@ typedef Rat_kernel::Point_2 Rat_point_2; typedef Traits_2::Curve_2 Bezier_curve_2; typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef CGAL::Gps_traits_2 Gps_traits_2; -typedef Gps_traits_2::Polygon_2 Polygon_2; -typedef Gps_traits_2::Polygon_with_holes_2 Polygon_with_holes_2; +typedef Gps_traits_2::General_polygon_2 Polygon_2; +typedef Gps_traits_2::General_polygon_with_holes_2 Polygon_with_holes_2; typedef std::list Polygon_set; /*! Read a general polygon with holes, formed by Bezier curves, from the diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp index fd2d87da63d..afbe3972b7a 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp @@ -18,8 +18,8 @@ typedef Kernel::Circle_2 Circle_2; typedef CGAL::Gps_circle_segment_traits_2 Traits_2; typedef CGAL::General_polygon_set_2 Polygon_set_2; -typedef Traits_2::Polygon_2 Polygon_2; -typedef Traits_2::Polygon_with_holes_2 Polygon_with_holes_2; +typedef Traits_2::General_polygon_2 Polygon_2; +typedef Traits_2::General_polygon_with_holes_2 Polygon_with_holes_2; typedef Traits_2::Curve_2 Curve_2; typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp index caf34b1d77e..73c76abd3f3 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp @@ -40,7 +40,7 @@ struct Conic_traits_2 : typedef CGAL::General_polygon_2 Polygon_2; typedef CGAL::Gps_traits_2 Traits_2; -typedef Traits_2::Polygon_with_holes_2 Polygon_with_holes_2; +typedef Traits_2::General_polygon_with_holes_2 Polygon_with_holes_2; typedef Traits_2::Curve_2 Curve_2; typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef Traits_2::Point_2 Point_2; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_utils.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_utils.h index f49ed51afd9..63cfd7ca57b 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_utils.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_utils.h @@ -454,8 +454,6 @@ _insert(PolygonIter p_begin, PolygonIter p_end, Polygon_with_holes_2 & /*pgn*/) } - - //insert non-sipmle poloygons with holes (non incident edges may have // common vertex, but they dont intersect at their interior template @@ -536,10 +534,12 @@ typename General_polygon_set_2::Size General_polygon_set_2:: number_of_polygons_with_holes() const { + typedef Arr_bfs_scanner Arr_bfs_scanner; - std::size_t res; - Arr_bfs_scanner scanner(this->m_traits, Counting_output_iterator(&res)); + //counting_output_operator CTOR reqires a parameter + std::size_t *cc = new size_t(); + Arr_bfs_scanner scanner(this->m_traits, Counting_output_iterator(cc)); scanner.scan(*(this->m_arr)); return (scanner.output_iterator().current_counter()); } diff --git a/Boolean_set_operations_2/include/CGAL/General_polygon_with_holes_2.h b/Boolean_set_operations_2/include/CGAL/General_polygon_with_holes_2.h index c599096fba9..5aeac74269f 100644 --- a/Boolean_set_operations_2/include/CGAL/General_polygon_with_holes_2.h +++ b/Boolean_set_operations_2/include/CGAL/General_polygon_with_holes_2.h @@ -27,14 +27,15 @@ CGAL_BEGIN_NAMESPACE template class General_polygon_with_holes_2 { + public: + typedef General_polygon_with_holes_2 Self; + typedef Polygon_ Polygon_2; + typedef typename Self::Polygon_2 General_polygon_2; + typedef std::list Holes_container; - typedef Polygon_ General_polygon_2; - - typedef std::list Holes_containter; - - typedef typename Holes_containter::iterator Hole_iterator; - typedef typename Holes_containter::const_iterator Hole_const_iterator; + typedef typename Holes_container::iterator Hole_iterator; + typedef typename Holes_container::const_iterator Hole_const_iterator; typedef unsigned int Size; @@ -42,7 +43,8 @@ public: {} - explicit General_polygon_with_holes_2(const General_polygon_2& pgn_boundary) : m_pgn(pgn_boundary) + explicit General_polygon_with_holes_2(const General_polygon_2& pgn_boundary) + : m_pgn(pgn_boundary) {} @@ -124,7 +126,7 @@ public: protected: General_polygon_2 m_pgn; - Holes_containter m_holes; + Holes_container m_holes; }; diff --git a/Boolean_set_operations_2/include/CGAL/Gps_segment_traits_2.h b/Boolean_set_operations_2/include/CGAL/Gps_segment_traits_2.h index 1de6a794ad9..38437b101e8 100644 --- a/Boolean_set_operations_2/include/CGAL/Gps_segment_traits_2.h +++ b/Boolean_set_operations_2/include/CGAL/Gps_segment_traits_2.h @@ -43,20 +43,27 @@ class Gps_segment_traits_2 : public Arr_seg_traits_ public: + //Polygon_2 type is required by GeneralPolygonSetTraits Concept typedef CGAL::Polygon_2 Polygon_2; + //Polygon_2 is a model of the GeneralPolygon2 concept. + typedef Polygon_2 General_polygon_2; //Polygon_with_holes_2 can be a simple polygon , with holes that are //entirely inside him , or some vertices of the polygon and its holes // may overlap. + + //Polygon_with_holes_2 type required by GeneralPolygonSetTraits Concept. typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - + //Polygon_with_Holes_2 is a model of the GeneralPolygonWithHoles2 concept. + typedef Polygon_with_holes_2 General_polygon_with_holes_2; typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef Polygon_2_curve_iterator Curve_const_iterator; - + typedef typename Polygon_with_holes_2::Hole_const_iterator + Hole_const_iterator; typedef typename Base::Point_2 Point_2; @@ -101,7 +108,7 @@ public: public: std::pair operator()(const Polygon_2& pgn) + Curve_const_iterator> operator()(const General_polygon_2& pgn) { Curve_const_iterator c_begin(&pgn, pgn.edges_begin()); Curve_const_iterator c_end(&pgn, pgn.edges_end()); @@ -127,6 +134,76 @@ public: return (Is_valid_2 (*this, tr_adp)); } + + //Added Functionality from GeneralPolygonWithHoles Concept to the traits. + + /*A functor for constructing the outer boundary of a polygon with holes*/ + class Construct_outer_boundary { + public: + General_polygon_2 operator()(const General_polygon_with_holes_2& pol_wh) + { + return pol_wh.outer_boundary(); + } + }; + + Construct_outer_boundary construct_outer_boundary_object() const { + return Construct_outer_boundary(); + } + + /*typedef from General_polygon_with_holes_2. Hole_const_iterator nested type is required by + GeneralPolygonWithHoles2 concept*/ + /*A functor for constructing the container of holes of a polygon with holes*/ + class Construct_holes { + public: + std::pair operator()(const General_polygon_with_holes_2& pol_wh) + { + return std::make_pair(pol_wh.holes_begin(), pol_wh.holes_end()); + } + }; + + Construct_holes construct_holes_object() const { + return Construct_holes(); + } + + /* A functor for constructing a General_polygon_with_holes from a General_Polygon + (and possibly a range of holes).*/ + // constructs a general polygon with holes using a given general polygon outer + // as the outer boundary and a given range of holes. If outer is an empty general + // polygon, then an unbounded polygon with holes will be created. The holes must + // be contained inside the outer boundary, and the polygons representing the holes + // must be strictly simple and pairwise disjoint, except perhaps at the vertices. + class Construct_general_polygon_with_holes_2 { + public: + General_polygon_with_holes_2 operator()(const General_polygon_2& pgn_boundary) + { + return General_polygon_with_holes_2(pgn_boundary); + } + template + General_polygon_with_holes_2 operator()(const General_polygon_2& pgn_boundary, + HolesInputIterator h_begin, + HolesInputIterator h_end) + { + return General_polygon_with_holes_2(pgn_boundary, h_begin,h_end); + } + }; + + Construct_general_polygon_with_holes_2 construct_polygon_with_holes_2_object() const + { + return Construct_general_polygon_with_holes_2(); + } + + //functor returns true if the outer boundary is empty, and false otherwise. + class Is_unbounded_pred { + public: + bool operator()(const General_polygon_with_holes_2& pol_wh) + { + return pol_wh.is_unbounded(); + } + }; + + Is_unbounded_pred construct_is_unbounded_pred_object() { + return Is_unbounded_pred(); + } }; diff --git a/Boolean_set_operations_2/include/CGAL/Gps_traits_2.h b/Boolean_set_operations_2/include/CGAL/Gps_traits_2.h index 5466fd4c8b3..e1582bced3e 100644 --- a/Boolean_set_operations_2/include/CGAL/Gps_traits_2.h +++ b/Boolean_set_operations_2/include/CGAL/Gps_traits_2.h @@ -27,25 +27,39 @@ CGAL_BEGIN_NAMESPACE -template > +template > class Gps_traits_2 : public Arr_traits { typedef Arr_traits Base; - typedef Gps_traits_2 Self; + typedef Gps_traits_2 Self; public: typedef typename Base::Point_2 Point_2; typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; - typedef Gen_polygon_ Polygon_2; - typedef General_polygon_with_holes_2 Polygon_with_holes_2; - typedef typename Polygon_2::Curve_const_iterator Curve_const_iterator; + //Polygon_2 type is required by GeneralPolygonSetTraits Concept + typedef General_polygon_t Polygon_2; + //Polygon_2 is a model of the GeneralPolygon2 concept + typedef Polygon_2 General_polygon_2; + + //Polygon_with_holes_2 type required by GeneralPolygonSetTraits Concept. + typedef General_polygon_with_holes_2 Polygon_with_holes_2; + //Polygon_with_Holes_2 is a model of the GeneralPolygonWithHoles2 concept. + typedef Polygon_with_holes_2 General_polygon_with_holes_2; + + typedef typename General_polygon_2::Curve_const_iterator Curve_const_iterator; + + typedef typename General_polygon_with_holes_2::Hole_const_iterator + Hole_const_iterator; + typedef typename Base::Equal_2 Equal_2; typedef typename Base::Compare_endpoints_xy_2 Compare_endpoints_xy_2; typedef typename Base::Construct_min_vertex_2 Construct_min_vertex_2; typedef typename Base::Construct_max_vertex_2 Construct_max_vertex_2; + + /*! * A functor for constructing a polygon from a range of x-monotone curves. */ @@ -56,7 +70,7 @@ public: template void operator()(XCurveIterator begin, XCurveIterator end, - Polygon_2& pgn) + General_polygon_2& pgn) { pgn.init(begin, end); } @@ -75,7 +89,7 @@ public: public: std::pair operator()(const Polygon_2& pgn) + Curve_const_iterator> operator()(const General_polygon_2& pgn) { return std::make_pair(pgn.curves_begin(), pgn.curves_end()); } @@ -97,7 +111,77 @@ public: Traits_adaptor tr_adp; return (Is_valid_2 (*this, tr_adp)); + } + //Added Functionality from GeneralPolygonWithHoles Concept to the traits. + + /*A functor for constructing the outer boundary of a polygon with holes*/ + class Construct_outer_boundary { + public: + General_polygon_2 operator()(const General_polygon_with_holes_2& pol_wh) + { + return pol_wh.outer_boundary(); + } + }; + + Construct_outer_boundary construct_outer_boundary_object() const { + return Construct_outer_boundary(); + } + + /*typedef from General_polygon_with_holes_2. Hole_const_iterator nested type is required by + GeneralPolygonWithHoles2 concept*/ + /*A functor for constructing the container of holes of a polygon with holes*/ + class Construct_holes { + public: + std::pair operator()(const General_polygon_with_holes_2& pol_wh) + { + return std::make_pair(pol_wh.holes_begin(), pol_wh.holes_end()); + } + }; + + Construct_holes construct_holes_object() const { + return Construct_holes(); + } + + /* A functor for constructing a General_polygon_with_holes from a General_Polygon + (and possibly a range of holes).*/ + // constructs a general polygon with holes using a given general polygon outer + // as the outer boundary and a given range of holes. If outer is an empty general + // polygon, then an unbounded polygon with holes will be created. The holes must + // be contained inside the outer boundary, and the polygons representing the holes + // must be strictly simple and pairwise disjoint, except perhaps at the vertices. + class Construct_general_polygon_with_holes_2 { + public: + General_polygon_with_holes_2 operator()(const General_polygon_2& pgn_boundary) + { + return General_polygon_with_holes_2(pgn_boundary); + } + template + General_polygon_with_holes_2 operator()(const General_polygon_2& pgn_boundary, + HolesInputIterator h_begin, + HolesInputIterator h_end) + { + return General_polygon_with_holes_2(pgn_boundary, h_begin,h_end); + } + }; + + Construct_general_polygon_with_holes_2 construct_polygon_with_holes_2_object() const + { + return Construct_general_polygon_with_holes_2(); } + + //functor returns true if the outer boundary is empty, and false otherwise. + class Is_unbounded { + public: + bool operator()(const General_polygon_with_holes_2& pol_wh) + { + return pol_wh.is_unbounded(); + } + }; + + Is_unbounded construct_is_unbounded_object() { + return Is_unbounded(); + } + }; CGAL_END_NAMESPACE