From 963381cbe7a3c377e2a9dfc3225eb8a929f11a07 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 1 Mar 2010 15:57:02 +0000 Subject: [PATCH] Added oriented_side() --- .../include/CGAL/Boolean_set_operations_2.h | 381 +++++++++++++----- .../Bso_internal_functions.h | 99 +++-- 2 files changed, 321 insertions(+), 159 deletions(-) diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2.h index b1cded7322e..8bda3ef0e1f 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2.h @@ -17,6 +17,7 @@ // // Author(s) : Baruch Zukerman // Ron Wein +// Efi Fogel #ifndef CGAL_BOOLEAN_SET_OPERATIONS_H #define CGAL_BOOLEAN_SET_OPERATIONS_H @@ -195,8 +196,7 @@ template inline OutputIterator intersection (const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator out, - Traits& tr) + OutputIterator out, Traits& tr) { return (_intersection(pgn1, pgn2, out, tr)); } @@ -214,8 +214,7 @@ template inline OutputIterator intersection (const Polygon_with_holes_2& pgn1, const Polygon_2& pgn2, - OutputIterator out, - Traits& tr) + OutputIterator out, Traits& tr) { return (_intersection(pgn1, pgn2, out, tr)); } @@ -271,8 +270,7 @@ inline OutputIterator intersection (const General_polygon_2& pgn1, const General_polygon_with_holes_2 >& pgn2, - OutputIterator out, - Traits& tr) + OutputIterator out, Traits& tr) { return (_intersection(pgn1, pgn2, out, tr)); } @@ -292,8 +290,7 @@ inline OutputIterator intersection (const General_polygon_with_holes_2 >& pgn1, const General_polygon_2& pgn2, - OutputIterator out, - Traits& tr) + OutputIterator out, Traits& tr) { return (_intersection(pgn1, pgn2, out, tr)); } @@ -311,8 +308,7 @@ template inline OutputIterator intersection (const General_polygon_with_holes_2& pgn1, const General_polygon_with_holes_2& pgn2, - OutputIterator out, - Traits& tr) + OutputIterator out, Traits& tr) { return (_intersection(pgn1, pgn2, out, tr)); } @@ -332,8 +328,7 @@ inline bool join (const Polygon_2& pgn1, template inline bool join (const Polygon_2& pgn1, const Polygon_2& pgn2, - Polygon_with_holes_2& res, - Traits& tr) + Polygon_with_holes_2& res, Traits& tr) { return (_join(pgn1, pgn2, res, tr)); } @@ -341,7 +336,7 @@ inline bool join (const Polygon_2& pgn1, template inline bool join (const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, - Polygon_with_holes_2& res ) + Polygon_with_holes_2& res) { return (_join(pgn1, pgn2, res)); } @@ -349,8 +344,7 @@ inline bool join (const Polygon_2& pgn1, template inline bool join (const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, - Polygon_with_holes_2& res, - Traits& tr) + Polygon_with_holes_2& res, Traits& tr) { return (_join(pgn1, pgn2, res, tr)); } @@ -366,8 +360,7 @@ inline bool join (const Polygon_with_holes_2& pgn1, template inline bool join (const Polygon_with_holes_2& pgn1, const Polygon_2& pgn2, - Polygon_with_holes_2& res, - Traits& tr) + Polygon_with_holes_2& res, Traits& tr) { return (_join(pgn1, pgn2, res, tr)); } @@ -383,8 +376,7 @@ inline bool join (const Polygon_with_holes_2& pgn1, template inline bool join (const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, - Polygon_with_holes_2& res, - Traits& tr) + Polygon_with_holes_2& res, Traits& tr) { return (_join(pgn1, pgn2, res, tr)); } @@ -403,7 +395,7 @@ inline bool join (const General_polygon_2& pgn1, const General_polygon_2& pgn2, General_polygon_with_holes_2 >& res, - Traits& tr) + Traits& tr) { return (_join(pgn1, pgn2, res, tr)); } @@ -457,8 +449,7 @@ inline bool join (const General_polygon_with_holes_2& pgn1, template inline bool join (const General_polygon_with_holes_2& pgn1, const General_polygon_with_holes_2& pgn2, - General_polygon_with_holes_2& res, - Traits& tr) + General_polygon_with_holes_2& res, Traits& tr) { return (_join(pgn1, pgn2, res, tr)); } @@ -478,8 +469,7 @@ inline OutputIterator difference (const Polygon_2& pgn1, template inline OutputIterator difference (const Polygon_2& pgn1, const Polygon_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return(_difference(pgn1, pgn2, oi, tr)); } @@ -497,8 +487,7 @@ template inline OutputIterator difference (const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return(_difference(pgn1, pgn2, oi, tr)); } @@ -535,8 +524,7 @@ template inline OutputIterator difference (const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_difference(pgn1, pgn2, oi, tr)); } @@ -571,8 +559,7 @@ template inline OutputIterator difference (const General_polygon_2& pgn1, const General_polygon_with_holes_2 >& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_difference(pgn1, pgn2, oi, tr)); } @@ -590,8 +577,7 @@ template inline OutputIterator difference (const General_polygon_with_holes_2 >& pgn1, const General_polygon_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_difference(pgn1, pgn2, oi, tr)); } @@ -609,8 +595,7 @@ template inline OutputIterator difference (const General_polygon_with_holes_2& pgn1, const General_polygon_with_holes_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_difference(pgn1, pgn2, oi, tr)); } @@ -623,8 +608,7 @@ template inline OutputIterator symmetric_difference (const Polygon_2& pgn1, const Polygon_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_symmetric_difference(pgn1, pgn2, oi, tr)); } @@ -642,8 +626,7 @@ template inline OutputIterator symmetric_difference (const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_symmetric_difference(pgn1, pgn2, oi, tr)); } @@ -662,8 +645,7 @@ template inline OutputIterator symmetric_difference (const Polygon_with_holes_2& pgn1, const Polygon_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_symmetric_difference(pgn1, pgn2, oi, tr)); } @@ -681,8 +663,7 @@ template inline OutputIterator symmetric_difference (const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_symmetric_difference(pgn1, pgn2, oi, tr)); } @@ -720,8 +701,7 @@ inline OutputIterator symmetric_difference (const General_polygon_2& pgn1, const General_polygon_with_holes_2 >& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_symmetric_difference(pgn1, pgn2, oi, tr)); } @@ -739,10 +719,9 @@ symmetric_difference(const General_polygon_2& pgn1, template inline OutputIterator symmetric_difference (const General_polygon_with_holes_2 - >& pgn1, + >& pgn1, const General_polygon_2& pgn2, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { return (_symmetric_difference(pgn1, pgn2, oi, tr)); } @@ -814,8 +793,7 @@ void complement (const General_polygon_2& pgn, template OutputIterator complement (const Polygon_with_holes_2& pgn, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { General_polygon_set_2 gps(tr); gps.insert(pgn); @@ -833,8 +811,7 @@ OutputIterator complement (const Polygon_with_holes_2& pgn, template OutputIterator complement (const General_polygon_with_holes_2& pgn, - OutputIterator oi, - Traits& tr) + OutputIterator oi, Traits& tr) { General_polygon_set_2 gps(tr); gps.insert(pgn); @@ -863,12 +840,10 @@ struct map_iterator_to_traits }; template -inline OutputIterator join(InputIterator begin, - InputIterator end, - OutputIterator oi, - Traits& ) +inline OutputIterator join(InputIterator begin, InputIterator end, + OutputIterator oi, Traits& ) { - if(begin == end) + if (begin == end) return (oi); General_polygon_set_2 gps(*begin); @@ -877,8 +852,7 @@ inline OutputIterator join(InputIterator begin, } template -inline OutputIterator join(InputIterator begin, - InputIterator end, +inline OutputIterator join(InputIterator begin, InputIterator end, OutputIterator oi) { typename map_iterator_to_traits::Traits tr; @@ -888,14 +862,11 @@ inline OutputIterator join(InputIterator begin, // Join two ranges of simple polygons and polygons with holes. template -inline OutputIterator join(InputIterator1 begin1, - InputIterator1 end1, - InputIterator2 begin2, - InputIterator2 end2, - OutputIterator oi, - Traits& tr) +inline OutputIterator join(InputIterator1 begin1, InputIterator1 end1, + InputIterator2 begin2, InputIterator2 end2, + OutputIterator oi, Traits& tr) { - if(begin1 == end1) + if (begin1 == end1) return (join(begin2, end2, oi, tr)); General_polygon_set_2 gps(*begin1); @@ -904,10 +875,8 @@ inline OutputIterator join(InputIterator1 begin1, } template -inline OutputIterator join(InputIterator1 begin1, - InputIterator1 end1, - InputIterator2 begin2, - InputIterator2 end2, +inline OutputIterator join(InputIterator1 begin1, InputIterator1 end1, + InputIterator2 begin2, InputIterator2 end2, OutputIterator oi) { typename map_iterator_to_traits::Traits tr; @@ -918,12 +887,10 @@ inline OutputIterator join(InputIterator1 begin1, /// \name Aggregated intersection() functions. //@{ template -inline OutputIterator intersection (InputIterator begin, - InputIterator end, - OutputIterator oi, - Traits&) +inline OutputIterator intersection (InputIterator begin, InputIterator end, + OutputIterator oi, Traits&) { - if(begin == end) + if (begin == end) return (oi); General_polygon_set_2 gps(*begin); @@ -932,8 +899,7 @@ inline OutputIterator intersection (InputIterator begin, } template -inline OutputIterator intersection (InputIterator begin, - InputIterator end, +inline OutputIterator intersection (InputIterator begin, InputIterator end, OutputIterator oi) { typename map_iterator_to_traits::Traits tr; @@ -943,14 +909,11 @@ inline OutputIterator intersection (InputIterator begin, // Inersect two ranges of simple polygons and polygons with holes. template -inline OutputIterator intersection(InputIterator1 begin1, - InputIterator1 end1, - InputIterator2 begin2, - InputIterator2 end2, - OutputIterator oi, - Traits& tr) +inline OutputIterator intersection(InputIterator1 begin1, InputIterator1 end1, + InputIterator2 begin2, InputIterator2 end2, + OutputIterator oi, Traits& tr) { - if(begin1 == end1) + if (begin1 == end1) return (intersection(begin2, end2, oi, tr)); General_polygon_set_2 gps(*begin1); @@ -960,10 +923,8 @@ inline OutputIterator intersection(InputIterator1 begin1, } template -inline OutputIterator intersection(InputIterator1 begin1, - InputIterator1 end1, - InputIterator2 begin2, - InputIterator2 end2, +inline OutputIterator intersection(InputIterator1 begin1, InputIterator1 end1, + InputIterator2 begin2, InputIterator2 end2, OutputIterator oi) { typename map_iterator_to_traits::Traits tr; @@ -974,12 +935,11 @@ inline OutputIterator intersection(InputIterator1 begin1, /// \name Aggregated symmetric_difference() functions. //@{ template -inline OutputIterator symmetric_difference(InputIterator begin, - InputIterator end, - OutputIterator oi, - Traits& tr) +inline +OutputIterator symmetric_difference(InputIterator begin, InputIterator end, + OutputIterator oi, Traits& tr) { - if(begin == end) + if (begin == end) return (oi); General_polygon_set_2 gps(tr); @@ -989,9 +949,9 @@ inline OutputIterator symmetric_difference(InputIterator begin, } template -inline OutputIterator symmetric_difference (InputIterator begin, - InputIterator end, - OutputIterator oi) +inline +OutputIterator symmetric_difference (InputIterator begin, InputIterator end, + OutputIterator oi) { typename map_iterator_to_traits::Traits tr; return symmetric_difference(begin, end, oi, tr); @@ -1000,14 +960,12 @@ inline OutputIterator symmetric_difference (InputIterator begin, // Xor two ranges of simple polygons and polygons with holes. template -inline OutputIterator symmetric_difference (InputIterator1 begin1, - InputIterator1 end1, - InputIterator2 begin2, - InputIterator2 end2, - OutputIterator oi, - Traits& tr) +inline +OutputIterator symmetric_difference (InputIterator1 begin1, InputIterator1 end1, + InputIterator2 begin2, InputIterator2 end2, + OutputIterator oi, Traits& tr) { - if(begin1 == end1) + if (begin1 == end1) return (symmetric_difference(begin2, end2, oi, tr)); General_polygon_set_2 gps(tr); @@ -1018,11 +976,10 @@ inline OutputIterator symmetric_difference (InputIterator1 begin1, } template -inline OutputIterator symmetric_difference (InputIterator1 begin1, - InputIterator1 end1, - InputIterator2 begin2, - InputIterator2 end2, - OutputIterator oi) +inline +OutputIterator symmetric_difference (InputIterator1 begin1, InputIterator1 end1, + InputIterator2 begin2, InputIterator2 end2, + OutputIterator oi) { typename map_iterator_to_traits::Traits tr; return symmetric_difference(begin1, end1, begin2, end2, oi, tr); @@ -1035,7 +992,7 @@ inline OutputIterator symmetric_difference (InputIterator1 begin1, template inline bool do_intersect(InputIterator begin, InputIterator end, Traits& tr) { - if(begin == end) + if (begin == end) return false; General_polygon_set_2 gps(tr); @@ -1056,7 +1013,7 @@ inline bool do_intersect (InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, Traits& tr) { - if(begin1 == end1) + if (begin1 == end1) return (do_intersect(begin2, end2, tr)); General_polygon_set_2 gps(tr); @@ -1074,6 +1031,212 @@ inline bool do_intersect (InputIterator1 begin1, InputIterator1 end1, //@} +/// \name oriented_side() functions. +//@{ + +template +inline Oriented_side oriented_side(const Polygon_2& pgn1, + const Polygon_2& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline Oriented_side oriented_side(const Polygon_2& pgn1, + const Polygon_2& pgn2, + Traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + +template +inline +Oriented_side oriented_side(const Polygon_2& pgn1, + const Polygon_with_holes_2& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline +Oriented_side oriented_side(const Polygon_2& pgn1, + const Polygon_with_holes_2& pgn2, + Traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + +template +inline +Oriented_side oriented_side(const Polygon_with_holes_2& pgn1, + const Polygon_2& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline +Oriented_side oriented_side(const Polygon_with_holes_2& pgn1, + const Polygon_2& pgn2, + Traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + +template +inline +Oriented_side oriented_side(const Polygon_with_holes_2& pgn1, + const Polygon_with_holes_2& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline +Oriented_side oriented_side(const Polygon_with_holes_2& pgn1, + const Polygon_with_holes_2& pgn2, + Traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + +template +inline Oriented_side oriented_side(const General_polygon_2& pgn1, + const General_polygon_2& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline Oriented_side oriented_side(const General_polygon_2& pgn1, + const General_polygon_2& pgn2, + Gps_traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + +template +inline Oriented_side oriented_side(const General_polygon_2& pgn1, + const General_polygon_with_holes_2 + >& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline Oriented_side oriented_side(const General_polygon_2& pgn1, + const General_polygon_with_holes_2 + >& pgn2, + Gps_traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + + + +template +inline Oriented_side oriented_side(const General_polygon_with_holes_2 + >& pgn1, + const General_polygon_2& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline Oriented_side oriented_side(const General_polygon_with_holes_2 + >& pgn1, + const General_polygon_2& pgn2, + Gps_traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + +template +inline +Oriented_side oriented_side(const General_polygon_with_holes_2& pgn1, + const General_polygon_with_holes_2& pgn2) +{ + return (_oriented_side(pgn1, pgn2)); +} + +template +inline +Oriented_side oriented_side(const General_polygon_with_holes_2& pgn1, + const General_polygon_with_holes_2& pgn2, + Traits& tr) +{ + return (_oriented_side(pgn1, pgn2, tr)); +} + +// Point Query: + +template +inline Oriented_side oriented_side(const typename Kernel::Point_2& p, + const Polygon_2& pgn) +{ + return (_oriented_side(p, pgn)); +} + +template +inline Oriented_side oriented_side(const typename Kernel::Point_2& p, + const Polygon_2& pgn, + Traits& tr) +{ + return (_oriented_side(p, pgn, tr)); +} + +template +inline +Oriented_side oriented_side(const typename Kernel::Point_2& p, + const Polygon_with_holes_2& pgn) +{ + return (_oriented_side(p, pgn)); +} + +template +inline +Oriented_side oriented_side(const typename Kernel::Point_2& p, + const Polygon_with_holes_2& pgn, + Traits& tr) +{ + return (_oriented_side(p, pgn, tr)); +} + +template +inline Oriented_side oriented_side(const typename Arr_traits::Point_2& p, + const General_polygon_2& pgn) +{ + return (_oriented_side(p, pgn)); +} + +template +inline Oriented_side oriented_side(const typename Arr_traits::Point_2& p, + const General_polygon_2& pgn, + Gps_traits& tr) +{ + return (_oriented_side(p, pgn, tr)); +} + +template +inline +Oriented_side oriented_side(const typename Polygon_::Point_2& p, + const General_polygon_with_holes_2& pgn) +{ + return (_oriented_side(p, pgn)); +} + +template +inline +Oriented_side oriented_side(const typename Polygon_::Point_2& p, + const General_polygon_with_holes_2& pgn, + Traits& tr) +{ + return (_oriented_side(p, pgn, tr)); +} + +//@} + + CGAL_END_NAMESPACE #endif diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h index 7b52ac01cde..0d29b1810e6 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h @@ -17,6 +17,7 @@ // // Author(s) : Baruch Zukerman // Ron Wein +// Efi Fogel #ifndef CGAL_BSO_INTERNAL_FUNCTIONS_H #define CGAL_BSO_INTERNAL_FUNCTIONS_H @@ -30,9 +31,7 @@ CGAL_BEGIN_NAMESPACE //@{ template -inline bool _do_intersect(const Pgn1& pgn1, - const Pgn2& pgn2, - Traits& tr) +inline bool _do_intersect(const Pgn1& pgn1, const Pgn2& pgn2, Traits& tr) { General_polygon_set_2 gps(tr); gps.insert(pgn1); @@ -40,11 +39,30 @@ inline bool _do_intersect(const Pgn1& pgn1, } template -inline bool _do_intersect(const Pgn1& pgn1, - const Pgn2& pgn2) +inline bool _do_intersect(const Pgn1& pgn1, const Pgn2& pgn2) { typename Gps_default_traits::Traits tr; - return (_do_intersect(pgn1, pgn2, tr)); + return _do_intersect(pgn1, pgn2, tr); +} + +//@} +/// \name _oriented_side() functions. +//@{ + +template +inline +Oriented_side _oriented_side(const Obj& obj, const Pgn& pgn, Traits& tr) +{ + General_polygon_set_2 gps(tr); + gps.insert(pgn); + return (gps.oriented_side(obj)); +} + +template +inline Oriented_side _oriented_side(const Obj& obj, const Pgn& pgn) +{ + typename Gps_default_traits::Traits tr; + return _oriented_side(obj, pgn, tr); } //@} @@ -52,10 +70,8 @@ inline bool _do_intersect(const Pgn1& pgn1, //@{ template -inline OutputIterator _intersection(const Pgn1& pgn1, - const Pgn2& pgn2, - OutputIterator out, - Traits& tr) +inline OutputIterator _intersection(const Pgn1& pgn1, const Pgn2& pgn2, + OutputIterator out, Traits& tr) { General_polygon_set_2 gps(tr); gps.insert(pgn1); @@ -64,12 +80,10 @@ inline OutputIterator _intersection(const Pgn1& pgn1, } template -inline OutputIterator _intersection(const Pgn1& pgn1, - const Pgn2& pgn2, +inline OutputIterator _intersection(const Pgn1& pgn1, const Pgn2& pgn2, OutputIterator out) { - typedef typename Gps_default_traits::Traits Traits; - Traits tr; + typename Gps_default_traits::Traits tr; return (_intersection(pgn1, pgn2, out, tr)); } @@ -78,8 +92,7 @@ inline OutputIterator _intersection(const Pgn1& pgn1, //@{ template -inline bool _is_empty (const typename Traits:: Polygon_2& pgn, - Traits& tr) +inline bool _is_empty (const typename Traits:: Polygon_2& pgn, Traits& tr) { typedef typename Traits::Curve_const_iterator Curve_const_iterator; const std::pair& itr_pair = @@ -88,20 +101,17 @@ inline bool _is_empty (const typename Traits:: Polygon_2& pgn, } template -inline bool _is_empty (const typename Traits::Polygon_with_holes_2&, - Traits&) +inline bool _is_empty (const typename Traits::Polygon_with_holes_2&, Traits&) { - return (false); + return false; } template -inline bool _join(const Pgn1& pgn1, - const Pgn2& pgn2, - typename Traits::Polygon_with_holes_2& res, - Traits& tr) +inline bool _join(const Pgn1& pgn1, const Pgn2& pgn2, + typename Traits::Polygon_with_holes_2& res, Traits& tr) { if (_is_empty(pgn1, tr) || _is_empty(pgn2, tr)) - return (false); + return false; General_polygon_set_2 gps(tr); gps.insert(pgn1); @@ -110,21 +120,18 @@ inline bool _join(const Pgn1& pgn1, { Oneset_iterator oi (res); gps.polygons_with_holes(oi); - return (true); + return true; } // the polygon doesnt intersect, the original pgn1, pgn2 contain the union - return (false); + return false; } template -inline bool -_join(const Pgn1& pgn1, - const Pgn2& pgn2, - Pwh& res) +inline bool _join(const Pgn1& pgn1, const Pgn2& pgn2, Pwh& res) { typename Gps_default_traits::Traits tr; - return (_join(pgn1, pgn2, res, tr)); + return _join(pgn1, pgn2, res, tr); } //@} @@ -132,24 +139,21 @@ _join(const Pgn1& pgn1, //@{ template -inline OutputIterator _difference(const Pgn1& pgn1, - const Pgn2& pgn2, - OutputIterator oi, - Traits& tr) +inline OutputIterator _difference(const Pgn1& pgn1, const Pgn2& pgn2, + OutputIterator oi, Traits& tr) { General_polygon_set_2 gps(tr); gps.insert(pgn1); gps.difference(pgn2); - return (gps.polygons_with_holes(oi)); + return gps.polygons_with_holes(oi); } template -inline OutputIterator _difference(const Pgn1& pgn1, - const Pgn2& pgn2, +inline OutputIterator _difference(const Pgn1& pgn1, const Pgn2& pgn2, OutputIterator oi) { typename Gps_default_traits::Traits tr; - return(_difference(pgn1, pgn2, oi, tr)); + return _difference(pgn1, pgn2, oi, tr); } //@} @@ -157,24 +161,21 @@ inline OutputIterator _difference(const Pgn1& pgn1, //@{ template -inline OutputIterator _symmetric_difference(const Pgn1& pgn1, - const Pgn2& pgn2, - OutputIterator oi, - Traits& tr) +inline OutputIterator _symmetric_difference(const Pgn1& pgn1, const Pgn2& pgn2, + OutputIterator oi, Traits& tr) { General_polygon_set_2 gps(tr); gps.insert(pgn1); gps.symmetric_difference(pgn2); - return (gps.polygons_with_holes(oi)); + return gps.polygons_with_holes(oi); } template -inline OutputIterator _symmetric_difference(const Pgn1& pgn1, - const Pgn2& pgn2, +inline OutputIterator _symmetric_difference(const Pgn1& pgn1, const Pgn2& pgn2, OutputIterator oi) { typename Gps_default_traits::Traits tr; - return (_symmetric_difference(pgn1, pgn2, oi, tr)); + return _symmetric_difference(pgn1, pgn2, oi, tr); } //@} @@ -182,8 +183,7 @@ inline OutputIterator _symmetric_difference(const Pgn1& pgn1, //@{ template -void _complement(const Pgn& pgn, - typename Traits::Polygon_with_holes_2& res, +void _complement(const Pgn& pgn, typename Traits::Polygon_with_holes_2& res, Traits& tr) { General_polygon_set_2 gps(tr); @@ -191,7 +191,6 @@ void _complement(const Pgn& pgn, gps.complement(); Oneset_iterator oi(res); gps.polygons_with_holes(oi); - } template