mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'efifogel/Polygon-fixes-efif' into HEAD
This commit is contained in:
commit
5f23e76911
|
|
@ -61,30 +61,30 @@ typedef unspecified_type Construct_polygon_2;
|
||||||
/*!
|
/*!
|
||||||
a functor that constructs a general polygon with holes from a general polygon and, optionally, a range of holes. It uses the operator
|
a functor that constructs a general polygon with holes from a general polygon and, optionally, a range of holes. It uses the operator
|
||||||
|
|
||||||
`void operator() (const General_polygon_2& pgn_boundary)` or
|
`void operator() (const Polygon_2& pgn_boundary)` or
|
||||||
|
|
||||||
`void operator() (const General_polygon_2& pgn_boundary, HolesInputIterator h_begin, HolesInputIterator h_end)` parameterized by the `HolesInputIterator` type.
|
`void operator() (const Polygon_2& pgn_boundary, HolesInputIterator h_begin, HolesInputIterator h_end)` parameterized by the `HolesInputIterator` type.
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type Construct_general_polygon_with_holes_2;
|
typedef unspecified_type Construct_polygon_with_holes_2;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
A functor for constructing the outer boundary of a polygon with holes. It uses the operator
|
A functor for constructing the outer boundary of a polygon with holes. It uses the operator
|
||||||
|
|
||||||
`General_polygon_2 operator()(const General_polygon_with_holes_2& pol_wh)`.
|
`Polygon_2 operator()(const Polygon_with_holes_2& pol_wh)`.
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type Construct_outer_boundary;
|
typedef unspecified_type Construct_outer_boundary;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
A functor for constructing the container of holes of a polygon with holes. It returns the begin/end iterators for the holes It uses the operator
|
A functor for constructing the container of holes of a polygon with holes. It returns the begin/end iterators for the holes It uses the operator
|
||||||
|
|
||||||
`std::pair<Hole_const_iterator, Hole_const_iterator> operator()(const General_polygon_with_holes_2& pol_wh)`.
|
`std::pair<Hole_const_iterator, Hole_const_iterator> operator()(const Polygon_with_holes_2& pol_wh)`.
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type Construct_holes;
|
typedef unspecified_type Construct_holes;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
A functor for checking if polygon with holes has no outer boundary. It uses the operator
|
A functor for checking if polygon with holes has no outer boundary. It uses the operator
|
||||||
|
|
||||||
`bool operator()(const General_polygon_with_holes_2& pol_wh)`.
|
`bool operator()(const Polygon_with_holes_2& pol_wh)`.
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type Is_unbounded;
|
typedef unspecified_type Is_unbounded;
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ Construct_curves_2 construct_curves_2_object();
|
||||||
/*!
|
/*!
|
||||||
returns a functor that constructs a polygon with holes.
|
returns a functor that constructs a polygon with holes.
|
||||||
*/
|
*/
|
||||||
Construct_general_polygon_with_holes_2 construct_polygon_with_holes_2_object() const;
|
Construct_polygon_with_holes_2 construct_polygon_with_holes_2_object() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
returns a functor that obtains the outer boundary of a polygon with holes.
|
returns a functor that obtains the outer boundary of a polygon with holes.
|
||||||
|
|
@ -141,9 +141,8 @@ Construct_holes construct_holes_object() const;
|
||||||
/*!
|
/*!
|
||||||
returns a functor that determines if the polygon with holes is unbounded
|
returns a functor that determines if the polygon with holes is unbounded
|
||||||
*/
|
*/
|
||||||
Is_unbounded construct_is_unbounded_object();
|
Is_unbounded is_unbounded_object();
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
}; /* end GeneralPolygonSetTraits_2 */
|
}; /* end GeneralPolygonSetTraits_2 */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1467,7 +1467,7 @@ protected:
|
||||||
bool _is_plane(const Polygon_with_holes_2& pgn) const
|
bool _is_plane(const Polygon_with_holes_2& pgn) const
|
||||||
{
|
{
|
||||||
//typedef typename Traits_2::Is_unbounded Is_unbounded;
|
//typedef typename Traits_2::Is_unbounded Is_unbounded;
|
||||||
bool unbounded = m_traits->construct_is_unbounded_object()(pgn);
|
bool unbounded = m_traits->is_unbounded_object()(pgn);
|
||||||
std::pair<GP_Holes_const_iterator,
|
std::pair<GP_Holes_const_iterator,
|
||||||
GP_Holes_const_iterator> pair =
|
GP_Holes_const_iterator> pair =
|
||||||
m_traits->construct_holes_object()(pgn);
|
m_traits->construct_holes_object()(pgn);
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,7 @@ template <class Traits_, class TopTraits_, class ValidationPolicy>
|
||||||
for( ; pwh_begin != pwh_end; ++pwh_begin)
|
for( ; pwh_begin != pwh_end; ++pwh_begin)
|
||||||
{
|
{
|
||||||
ValidationPolicy::is_valid(*pwh_begin, *m_traits);
|
ValidationPolicy::is_valid(*pwh_begin, *m_traits);
|
||||||
is_unbounded = (is_unbounded || m_traits->construct_is_unbounded_object()(*pwh_begin));
|
is_unbounded = (is_unbounded || m_traits->is_unbounded_object()(*pwh_begin));
|
||||||
// is_unbounded = (is_unbounded || pwh_begin->is_unbounded());
|
// is_unbounded = (is_unbounded || pwh_begin->is_unbounded());
|
||||||
_construct_curves(*pwh_begin, std::back_inserter(xcurve_list));
|
_construct_curves(*pwh_begin, std::back_inserter(xcurve_list));
|
||||||
}
|
}
|
||||||
|
|
@ -517,7 +517,7 @@ template <class Traits_, class TopTraits_, class ValidationPolicy>
|
||||||
for( ; p_begin != p_end; ++p_begin)
|
for( ; p_begin != p_end; ++p_begin)
|
||||||
{
|
{
|
||||||
// is_unbounded = (is_unbounded || p_begin->is_unbounded());
|
// is_unbounded = (is_unbounded || p_begin->is_unbounded());
|
||||||
is_unbounded = (is_unbounded || m_traits->construct_is_unbounded_object()(*p_begin));
|
is_unbounded = (is_unbounded || m_traits->is_unbounded_object()(*p_begin));
|
||||||
_construct_curves(*p_begin, std::back_inserter(xcurve_list));
|
_construct_curves(*p_begin, std::back_inserter(xcurve_list));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -557,7 +557,7 @@ template <class Traits_, class TopTraits_, class ValidationPolicy>
|
||||||
insert_non_intersecting_curves(arr, xcurve_list.begin(), xcurve_list.end());
|
insert_non_intersecting_curves(arr, xcurve_list.begin(), xcurve_list.end());
|
||||||
|
|
||||||
//if (pgn.is_unbounded())
|
//if (pgn.is_unbounded())
|
||||||
if (m_traits->construct_is_unbounded_object()(pgn))
|
if (m_traits->is_unbounded_object()(pgn))
|
||||||
{
|
{
|
||||||
for (Face_iterator fit = arr.faces_begin();
|
for (Face_iterator fit = arr.faces_begin();
|
||||||
fit != arr.faces_end(); ++fit)
|
fit != arr.faces_end(); ++fit)
|
||||||
|
|
@ -590,7 +590,7 @@ template <class Traits_, class TopTraits_, class ValidationPolicy>
|
||||||
_construct_curves(const Polygon_with_holes_2 & pgn, OutputIterator oi)
|
_construct_curves(const Polygon_with_holes_2 & pgn, OutputIterator oi)
|
||||||
{
|
{
|
||||||
//if (!pgn.is_unbounded())
|
//if (!pgn.is_unbounded())
|
||||||
if (!m_traits->construct_is_unbounded_object()(pgn))
|
if (!m_traits->is_unbounded_object()(pgn))
|
||||||
{
|
{
|
||||||
const Polygon_2& pgn_boundary =
|
const Polygon_2& pgn_boundary =
|
||||||
m_traits->construct_outer_boundary_object()(pgn);
|
m_traits->construct_outer_boundary_object()(pgn);
|
||||||
|
|
|
||||||
|
|
@ -631,7 +631,7 @@ bool are_holes_and_boundary_pairwise_disjoint
|
||||||
typedef std::pair<Curve_const_iterator, Curve_const_iterator>
|
typedef std::pair<Curve_const_iterator, Curve_const_iterator>
|
||||||
Cci_pair;
|
Cci_pair;
|
||||||
typedef typename Traits_2::Construct_curves_2 Construct_curves_2;
|
typedef typename Traits_2::Construct_curves_2 Construct_curves_2;
|
||||||
typedef typename Traits_2::Construct_general_polygon_with_holes_2
|
typedef typename Traits_2::Construct_polygon_with_holes_2
|
||||||
Construct_polygon_with_holes_2;
|
Construct_polygon_with_holes_2;
|
||||||
|
|
||||||
typedef Gps_polygon_validation_visitor<Traits_2> Visitor;
|
typedef Gps_polygon_validation_visitor<Traits_2> Visitor;
|
||||||
|
|
@ -698,7 +698,7 @@ bool are_holes_and_boundary_pairwise_disjoint
|
||||||
* whose performance is better than the join(pgn)
|
* whose performance is better than the join(pgn)
|
||||||
*/
|
*/
|
||||||
Polygon_with_holes_2 empty_pwh = construct_pwh_functor(hole);
|
Polygon_with_holes_2 empty_pwh = construct_pwh_functor(hole);
|
||||||
// traits.Construct_general_polygon_with_holes_2 (hole);
|
// traits.Construct_polygon_with_holes_2 (hole);
|
||||||
// Polygon_with_holes_2 empty_pwh(hole);
|
// Polygon_with_holes_2 empty_pwh(hole);
|
||||||
gps.insert(empty_pwh);
|
gps.insert(empty_pwh);
|
||||||
num_of_holes++;
|
num_of_holes++;
|
||||||
|
|
|
||||||
|
|
@ -26,19 +26,18 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template < class Kernel_,
|
template <typename Kernel_,
|
||||||
class Container_ = std::vector<typename Kernel_::Point_2>,
|
typename Container_ = std::vector<typename Kernel_::Point_2>,
|
||||||
class Arr_seg_traits_ = Arr_segment_traits_2<Kernel_> >
|
typename ArrSegmentTraits = Arr_segment_traits_2<Kernel_> >
|
||||||
class Gps_segment_traits_2 : public Arr_seg_traits_
|
class Gps_segment_traits_2 : public ArrSegmentTraits {
|
||||||
{
|
typedef ArrSegmentTraits Base;
|
||||||
typedef Arr_seg_traits_ Base;
|
typedef Gps_segment_traits_2<Kernel_, Container_, ArrSegmentTraits> Self;
|
||||||
typedef Gps_segment_traits_2<Kernel_, Container_, Arr_seg_traits_> Self;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Polygon_2 type is required by GeneralPolygonSetTraits Concept
|
// Polygon_2 type is required by GeneralPolygonSetTraits Concept
|
||||||
typedef CGAL::Polygon_2<Kernel_, Container_> Polygon_2;
|
typedef CGAL::Polygon_2<Kernel_, Container_> Polygon_2;
|
||||||
// Polygon_2 is a model of the GeneralPolygon2 concept.
|
|
||||||
|
// Backward compatibility
|
||||||
typedef Polygon_2 General_polygon_2;
|
typedef Polygon_2 General_polygon_2;
|
||||||
|
|
||||||
// Polygon_with_holes_2 can be a simple polygon , with holes that are
|
// Polygon_with_holes_2 can be a simple polygon , with holes that are
|
||||||
|
|
@ -48,8 +47,9 @@ public:
|
||||||
// Polygon_with_holes_2 type required by GeneralPolygonSetTraits Concept.
|
// Polygon_with_holes_2 type required by GeneralPolygonSetTraits Concept.
|
||||||
typedef CGAL::Polygon_with_holes_2<Kernel_, Container_>
|
typedef CGAL::Polygon_with_holes_2<Kernel_, Container_>
|
||||||
Polygon_with_holes_2;
|
Polygon_with_holes_2;
|
||||||
// Polygon_with_Holes_2 is a model of the GeneralPolygonWithHoles2 concept.
|
// Backward compatibility
|
||||||
typedef Polygon_with_holes_2 General_polygon_with_holes_2;
|
typedef Polygon_with_holes_2 General_polygon_with_holes_2;
|
||||||
|
|
||||||
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
|
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
|
||||||
|
|
||||||
typedef Polygon_2_curve_iterator<X_monotone_curve_2, Polygon_2>
|
typedef Polygon_2_curve_iterator<X_monotone_curve_2, Polygon_2>
|
||||||
|
|
@ -64,7 +64,7 @@ public:
|
||||||
* A functor for constructing a polygon from a range of segments.
|
* A functor for constructing a polygon from a range of segments.
|
||||||
*/
|
*/
|
||||||
class Construct_polygon_2 {
|
class Construct_polygon_2 {
|
||||||
typedef Gps_segment_traits_2<Kernel_, Container_, Arr_seg_traits_> Self;
|
typedef Gps_segment_traits_2<Kernel_, Container_, ArrSegmentTraits> Self;
|
||||||
typedef Gps_traits_adaptor<Self> Traits_adaptor;
|
typedef Gps_traits_adaptor<Self> Traits_adaptor;
|
||||||
|
|
||||||
/*! The traits (in case it has state) */
|
/*! The traits (in case it has state) */
|
||||||
|
|
@ -101,11 +101,9 @@ public:
|
||||||
class Construct_curves_2 {
|
class Construct_curves_2 {
|
||||||
public:
|
public:
|
||||||
std::pair<Curve_const_iterator, Curve_const_iterator>
|
std::pair<Curve_const_iterator, Curve_const_iterator>
|
||||||
operator()(const General_polygon_2& pgn) const
|
operator()(const Polygon_2& pgn) const {
|
||||||
{
|
|
||||||
Curve_const_iterator c_begin(&pgn, pgn.vertex_pairs_begin());
|
Curve_const_iterator c_begin(&pgn, pgn.vertex_pairs_begin());
|
||||||
Curve_const_iterator c_end(&pgn, pgn.vertex_pairs_end());
|
Curve_const_iterator c_end(&pgn, pgn.vertex_pairs_end());
|
||||||
|
|
||||||
return (std::make_pair(c_begin, c_end));
|
return (std::make_pair(c_begin, c_end));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -121,42 +119,33 @@ public:
|
||||||
*/
|
*/
|
||||||
class Construct_outer_boundary {
|
class Construct_outer_boundary {
|
||||||
public:
|
public:
|
||||||
General_polygon_2 operator()(const General_polygon_with_holes_2& pol_wh)
|
Polygon_2 operator()(const Polygon_with_holes_2& pol_wh) const
|
||||||
const
|
{ return pol_wh.outer_boundary(); }
|
||||||
{
|
|
||||||
return pol_wh.outer_boundary();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Construct_outer_boundary construct_outer_boundary_object() const
|
Construct_outer_boundary construct_outer_boundary_object() const
|
||||||
{
|
{ return Construct_outer_boundary(); }
|
||||||
return Construct_outer_boundary();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* typedef from General_polygon_with_holes_2.
|
/* typedef from Polygon_with_holes_2.
|
||||||
* Hole_const_iterator nested type is required by
|
* Hole_const_iterator nested type is required by
|
||||||
* GeneralPolygonWithHoles2 concept
|
* GeneralPolygonWithHoles2 concept
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* A functor for constructing the container of holes of a polygon with holes.
|
/* A functor for constructing the container of holes of a polygon with holes.
|
||||||
* It returns ths begin/end iterators for the holes
|
* It returns the begin/end iterators for the holes
|
||||||
*/
|
*/
|
||||||
class Construct_holes {
|
class Construct_holes {
|
||||||
public:
|
public:
|
||||||
std::pair<Hole_const_iterator, Hole_const_iterator>
|
std::pair<Hole_const_iterator, Hole_const_iterator>
|
||||||
operator()(const General_polygon_with_holes_2& pol_wh) const
|
operator()(const Polygon_with_holes_2& pol_wh) const
|
||||||
{
|
{ return std::make_pair(pol_wh.holes_begin(), pol_wh.holes_end()); }
|
||||||
return std::make_pair(pol_wh.holes_begin(), pol_wh.holes_end());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Construct_holes construct_holes_object() const
|
Construct_holes construct_holes_object() const
|
||||||
{
|
{ return Construct_holes(); }
|
||||||
return Construct_holes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A functor for constructing a General_polygon_with_holes from a
|
/* A functor for constructing a Polygon_with_holes from a polygon (and
|
||||||
* General_Polygon (and possibly a range of holes).
|
* possibly a range of holes).
|
||||||
*
|
*
|
||||||
* constructs a general polygon with holes using a given general polygon
|
* 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
|
* outer as the outer boundary and a given range of holes. If outer is an
|
||||||
|
|
@ -165,42 +154,31 @@ public:
|
||||||
* polygons representing the holes must be strictly simple and pairwise
|
* polygons representing the holes must be strictly simple and pairwise
|
||||||
* disjoint, except perhaps at the vertices.
|
* disjoint, except perhaps at the vertices.
|
||||||
*/
|
*/
|
||||||
class Construct_general_polygon_with_holes_2 {
|
class Construct_polygon_with_holes_2 {
|
||||||
public:
|
public:
|
||||||
General_polygon_with_holes_2 operator()(const General_polygon_2&
|
Polygon_with_holes_2 operator()(const Polygon_2& pgn_boundary) const
|
||||||
pgn_boundary) const
|
{ return Polygon_with_holes_2(pgn_boundary); }
|
||||||
{
|
|
||||||
return General_polygon_with_holes_2(pgn_boundary);
|
template <typename HolesInputIterator>
|
||||||
}
|
Polygon_with_holes_2 operator()(const Polygon_2& pgn_boundary,
|
||||||
template <class HolesInputIterator>
|
|
||||||
General_polygon_with_holes_2 operator()(const General_polygon_2&
|
|
||||||
pgn_boundary,
|
|
||||||
HolesInputIterator h_begin,
|
HolesInputIterator h_begin,
|
||||||
HolesInputIterator h_end) const
|
HolesInputIterator h_end) const
|
||||||
{
|
{ return Polygon_with_holes_2(pgn_boundary, h_begin,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()
|
Construct_polygon_with_holes_2 construct_polygon_with_holes_2_object() const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
return Construct_general_polygon_with_holes_2();
|
return Construct_polygon_with_holes_2();
|
||||||
}
|
}
|
||||||
|
|
||||||
//functor returns true if the outer boundary is unbounded, and false otherwise.
|
//functor returns true if the outer boundary is unbounded, and false otherwise.
|
||||||
class Is_unbounded {
|
class Is_unbounded {
|
||||||
public:
|
public:
|
||||||
bool operator()(const General_polygon_with_holes_2& pol_wh) const
|
bool operator()(const Polygon_with_holes_2& pol_wh) const
|
||||||
{
|
{ return pol_wh.is_unbounded(); }
|
||||||
return pol_wh.is_unbounded();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Is_unbounded construct_is_unbounded_object() const
|
Is_unbounded is_unbounded_object() const { return Is_unbounded(); }
|
||||||
{
|
|
||||||
return Is_unbounded();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -24,35 +24,31 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template <typename Arr_traits,
|
template <typename ArrTraits_2,
|
||||||
typename General_polygon_t = General_polygon_2<Arr_traits> >
|
typename GeneralPolygon_2 = General_polygon_2<ArrTraits_2> >
|
||||||
class Gps_traits_2 : public Arr_traits
|
class Gps_traits_2 : public ArrTraits_2 {
|
||||||
{
|
typedef ArrTraits_2 Base;
|
||||||
typedef Arr_traits Base;
|
typedef Gps_traits_2<ArrTraits_2, GeneralPolygon_2> Self;
|
||||||
typedef Gps_traits_2<Arr_traits,General_polygon_t> Self;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef typename Base::Point_2 Point_2;
|
typedef typename Base::Point_2 Point_2;
|
||||||
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
|
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
|
||||||
typedef typename Base::Multiplicity Multiplicity;
|
typedef typename Base::Multiplicity Multiplicity;
|
||||||
|
|
||||||
// Polygon_2 type is required by GeneralPolygonSetTraits Concept
|
// Polygon_2 type is required by GeneralPolygonSetTraits Concept
|
||||||
typedef General_polygon_t Polygon_2;
|
typedef GeneralPolygon_2 Polygon_2;
|
||||||
//Polygon_2 is a model of the GeneralPolygon2 concept
|
// Backward compatibility
|
||||||
typedef Polygon_2 General_polygon_2;
|
typedef Polygon_2 General_polygon_2;
|
||||||
|
|
||||||
// Polygon_with_holes_2 type required by GeneralPolygonSetTraits Concept.
|
// Polygon_with_holes_2 type required by GeneralPolygonSetTraits Concept.
|
||||||
typedef CGAL::General_polygon_with_holes_2<General_polygon_2>
|
typedef CGAL::General_polygon_with_holes_2<Polygon_2> Polygon_with_holes_2;
|
||||||
Polygon_with_holes_2;
|
// Backward compatibility
|
||||||
//Polygon_with_Holes_2 is a model of the GeneralPolygonWithHoles2 concept.
|
|
||||||
typedef Polygon_with_holes_2
|
typedef Polygon_with_holes_2
|
||||||
General_polygon_with_holes_2;
|
General_polygon_with_holes_2;
|
||||||
|
|
||||||
typedef typename General_polygon_2::Curve_const_iterator
|
typedef typename Polygon_2::Curve_const_iterator Curve_const_iterator;
|
||||||
Curve_const_iterator;
|
|
||||||
|
|
||||||
typedef typename General_polygon_with_holes_2::Hole_const_iterator
|
typedef typename Polygon_with_holes_2::Hole_const_iterator
|
||||||
Hole_const_iterator;
|
Hole_const_iterator;
|
||||||
|
|
||||||
typedef typename Base::Compare_endpoints_xy_2 Compare_endpoints_xy_2;
|
typedef typename Base::Compare_endpoints_xy_2 Compare_endpoints_xy_2;
|
||||||
|
|
@ -65,8 +61,8 @@ public:
|
||||||
class Construct_polygon_2 {
|
class Construct_polygon_2 {
|
||||||
public:
|
public:
|
||||||
template <class XCurveIterator>
|
template <class XCurveIterator>
|
||||||
void operator()(XCurveIterator begin, XCurveIterator end,
|
void
|
||||||
General_polygon_2& pgn) const
|
operator()(XCurveIterator begin, XCurveIterator end, Polygon_2& pgn) const
|
||||||
{ pgn.init(begin, end); }
|
{ pgn.init(begin, end); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -76,12 +72,10 @@ public:
|
||||||
/*!
|
/*!
|
||||||
* A functor for scanning all x-monotone curves that form a polygon boundary.
|
* A functor for scanning all x-monotone curves that form a polygon boundary.
|
||||||
*/
|
*/
|
||||||
class Construct_curves_2
|
class Construct_curves_2 {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
std::pair<Curve_const_iterator, Curve_const_iterator>
|
std::pair<Curve_const_iterator, Curve_const_iterator>
|
||||||
operator()(const General_polygon_2& pgn) const
|
operator()(const Polygon_2& pgn) const
|
||||||
{ return std::make_pair(pgn.curves_begin(), pgn.curves_end()); }
|
{ return std::make_pair(pgn.curves_begin(), pgn.curves_end()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -106,30 +100,26 @@ public:
|
||||||
/*A functor for constructing the outer boundary of a polygon with holes*/
|
/*A functor for constructing the outer boundary of a polygon with holes*/
|
||||||
class Construct_outer_boundary {
|
class Construct_outer_boundary {
|
||||||
public:
|
public:
|
||||||
General_polygon_2 operator()(const General_polygon_with_holes_2& pol_wh)
|
Polygon_2 operator()(const Polygon_with_holes_2& pol_wh) const
|
||||||
const
|
|
||||||
{ return pol_wh.outer_boundary(); }
|
{ return pol_wh.outer_boundary(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
Construct_outer_boundary construct_outer_boundary_object() const
|
Construct_outer_boundary construct_outer_boundary_object() const
|
||||||
{ return Construct_outer_boundary(); }
|
{ return Construct_outer_boundary(); }
|
||||||
|
|
||||||
/* typedef from General_polygon_with_holes_2. Hole_const_iterator nested type
|
/* A functor for constructing the container of holes of a polygon with holes
|
||||||
* is required by GeneralPolygonWithHoles2 concept
|
|
||||||
*/
|
*/
|
||||||
/*A functor for constructing the container of holes of a polygon with holes*/
|
|
||||||
class Construct_holes {
|
class Construct_holes {
|
||||||
public:
|
public:
|
||||||
std::pair<Hole_const_iterator, Hole_const_iterator>
|
std::pair<Hole_const_iterator, Hole_const_iterator>
|
||||||
operator()(const General_polygon_with_holes_2& pol_wh) const
|
operator()(const Polygon_with_holes_2& pol_wh) const
|
||||||
{ return std::make_pair(pol_wh.holes_begin(), pol_wh.holes_end()); }
|
{ return std::make_pair(pol_wh.holes_begin(), pol_wh.holes_end()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
Construct_holes construct_holes_object() const
|
Construct_holes construct_holes_object() const { return Construct_holes(); }
|
||||||
{ return Construct_holes(); }
|
|
||||||
|
|
||||||
/* A functor for constructing a General_polygon_with_holes from a
|
/* A functor for constructing a Polygon_with_holes_2 from a
|
||||||
* General_Polygon (and possibly a range of holes).
|
* Polygon_2 (and possibly a range of holes).
|
||||||
*
|
*
|
||||||
* constructs a general polygon with holes using a given general polygon
|
* 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
|
* outer as the outer boundary and a given range of holes. If outer is an
|
||||||
|
|
@ -138,32 +128,29 @@ public:
|
||||||
* polygons representing the holes must be strictly simple and pairwise
|
* polygons representing the holes must be strictly simple and pairwise
|
||||||
* disjoint, except perhaps at the vertices.
|
* disjoint, except perhaps at the vertices.
|
||||||
*/
|
*/
|
||||||
class Construct_general_polygon_with_holes_2 {
|
class Construct_polygon_with_holes_2 {
|
||||||
public:
|
public:
|
||||||
General_polygon_with_holes_2
|
Polygon_with_holes_2 operator()(const Polygon_2& pgn_boundary) const
|
||||||
operator()(const General_polygon_2& pgn_boundary) const
|
{ return Polygon_with_holes_2(pgn_boundary); }
|
||||||
{ return General_polygon_with_holes_2(pgn_boundary); }
|
|
||||||
|
|
||||||
template <class HolesInputIterator>
|
template <class HolesInputIterator>
|
||||||
General_polygon_with_holes_2
|
Polygon_with_holes_2 operator()(const Polygon_2& pgn_boundary,
|
||||||
operator()(const General_polygon_2& pgn_boundary,
|
|
||||||
HolesInputIterator h_begin,
|
HolesInputIterator h_begin,
|
||||||
HolesInputIterator h_end) const
|
HolesInputIterator h_end) const
|
||||||
{ return General_polygon_with_holes_2(pgn_boundary, h_begin,h_end); }
|
{ return Polygon_with_holes_2(pgn_boundary, h_begin,h_end); }
|
||||||
};
|
};
|
||||||
|
|
||||||
Construct_general_polygon_with_holes_2 construct_polygon_with_holes_2_object()
|
Construct_polygon_with_holes_2 construct_polygon_with_holes_2_object() const
|
||||||
const
|
{ return Construct_polygon_with_holes_2(); }
|
||||||
{ return Construct_general_polygon_with_holes_2(); }
|
|
||||||
|
|
||||||
// Return true if the outer boundary is empty, and false otherwise.
|
// Return true if the outer boundary is empty, and false otherwise.
|
||||||
class Is_unbounded {
|
class Is_unbounded {
|
||||||
public:
|
public:
|
||||||
bool operator()(const General_polygon_with_holes_2& pol_wh) const
|
bool operator()(const Polygon_with_holes_2& pol_wh) const
|
||||||
{ return pol_wh.is_unbounded(); }
|
{ return pol_wh.is_unbounded(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
Is_unbounded construct_is_unbounded_object() const { return Is_unbounded(); }
|
Is_unbounded is_unbounded_object() const { return Is_unbounded(); }
|
||||||
|
|
||||||
// Equality operator
|
// Equality operator
|
||||||
class Equal_2 {
|
class Equal_2 {
|
||||||
|
|
@ -202,9 +189,7 @@ public:
|
||||||
{ return m_traits.equal_2_object()(cv1, cv2); }
|
{ return m_traits.equal_2_object()(cv1, cv2); }
|
||||||
|
|
||||||
//! Compare two general polygons
|
//! Compare two general polygons
|
||||||
bool operator()(const General_polygon_2& pgn1, const General_polygon_2& pgn2)
|
bool operator()(const Polygon_2& pgn1, const Polygon_2& pgn2) const {
|
||||||
const
|
|
||||||
{
|
|
||||||
if (pgn1.size() != pgn2.size()) return false;
|
if (pgn1.size() != pgn2.size()) return false;
|
||||||
if (pgn1.is_empty() && ! pgn2.is_empty()) return false;
|
if (pgn1.is_empty() && ! pgn2.is_empty()) return false;
|
||||||
if (pgn2.is_empty()) return false;
|
if (pgn2.is_empty()) return false;
|
||||||
|
|
@ -224,9 +209,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Compare two general polygons
|
//! Compare two general polygons
|
||||||
bool operator()(const General_polygon_with_holes_2& pgn1,
|
bool operator()(const Polygon_with_holes_2& pgn1,
|
||||||
const General_polygon_with_holes_2& pgn2) const {
|
const Polygon_with_holes_2& pgn2) const {
|
||||||
|
|
||||||
if (! operator()(pgn1.outer_boundary(), pgn2.outer_boundary()))
|
if (! operator()(pgn1.outer_boundary(), pgn2.outer_boundary()))
|
||||||
return false;
|
return false;
|
||||||
if (pgn1.number_of_holes(), pgn2.number_of_holes()) return false;
|
if (pgn1.number_of_holes(), pgn2.number_of_holes()) return false;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ Release date: June 2022
|
||||||
|
|
||||||
- Added an overload of the function `CGAL::convex_hull_3()`, which writes the result in an indexed triangle set.
|
- Added an overload of the function `CGAL::convex_hull_3()`, which writes the result in an indexed triangle set.
|
||||||
|
|
||||||
|
### [2D Regularized Boolean Set-Operations](https://doc.cgal.org/5.5/Manual/packages.html#PkgBooleanSetOperations2)
|
||||||
|
- The concept `GeneralPolygonSetTraits_2` now requires the nested type `Construct_polygon_with_holes_2` instead of `Construct_general_polygon_with_holes_2`.
|
||||||
|
|
||||||
|
### [2D Polygon](https://doc.cgal.org/5.5/Manual/packages.html#PkgPolygon2)
|
||||||
|
- The concept `GeneralPolygonWithHoles_2` now requires the nested type `Polygon_2` instead of `General_polygon_2`.
|
||||||
|
|
||||||
[Release 5.4](https://github.com/CGAL/cgal/releases/tag/v5.4)
|
[Release 5.4](https://github.com/CGAL/cgal/releases/tag/v5.4)
|
||||||
-----------
|
-----------
|
||||||
|
|
|
||||||
|
|
@ -764,7 +764,7 @@ minkowski_sum_by_decomposition_2
|
||||||
typedef Kernel_ Kernel;
|
typedef Kernel_ Kernel;
|
||||||
typedef Container_ Container;
|
typedef Container_ Container;
|
||||||
typedef Decomposition_ Decomposition;
|
typedef Decomposition_ Decomposition;
|
||||||
typedef Polygon_nop_decomposition_2<Kernel> Nop_decomposition;
|
typedef Polygon_nop_decomposition_2<Kernel, Container> Nop_decomposition;
|
||||||
|
|
||||||
if (pgn1.is_convex()) {
|
if (pgn1.is_convex()) {
|
||||||
Nop_decomposition decomp_nop;
|
Nop_decomposition decomp_nop;
|
||||||
|
|
@ -843,7 +843,7 @@ minkowski_sum_by_decomposition_2
|
||||||
typedef Container_ Container;
|
typedef Container_ Container;
|
||||||
typedef NoHolesDecomposition_ No_holes_decomposition;
|
typedef NoHolesDecomposition_ No_holes_decomposition;
|
||||||
typedef WithHolesDecomposition_ With_holes_decomposition;
|
typedef WithHolesDecomposition_ With_holes_decomposition;
|
||||||
typedef Polygon_nop_decomposition_2<Kernel> Nop_decomposition;
|
typedef Polygon_nop_decomposition_2<Kernel, Container> Nop_decomposition;
|
||||||
|
|
||||||
Hole_filter_2<Kernel, Container> hole_filter;
|
Hole_filter_2<Kernel, Container> hole_filter;
|
||||||
Polygon_with_holes_2<Kernel, Container> filtered_pgn1;
|
Polygon_with_holes_2<Kernel, Container> filtered_pgn1;
|
||||||
|
|
@ -986,7 +986,7 @@ minkowski_sum_by_decomposition_2
|
||||||
typedef Container_ Container;
|
typedef Container_ Container;
|
||||||
typedef NoHolesDecomposition_ No_holes_decomposition;
|
typedef NoHolesDecomposition_ No_holes_decomposition;
|
||||||
typedef WithHolesDecomposition_ With_holes_decomposition;
|
typedef WithHolesDecomposition_ With_holes_decomposition;
|
||||||
typedef Polygon_nop_decomposition_2<Kernel> Nop_decomposition;
|
typedef Polygon_nop_decomposition_2<Kernel, Container> Nop_decomposition;
|
||||||
|
|
||||||
Hole_filter_2<Kernel, Container> hole_filter;
|
Hole_filter_2<Kernel, Container> hole_filter;
|
||||||
Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
|
Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,17 @@
|
||||||
|
/*! \ingroup PkgPolygon2Concepts
|
||||||
/*!
|
* \cgalConcept
|
||||||
\ingroup PkgPolygon2Concepts
|
*
|
||||||
\cgalConcept
|
* \cgalRefines `DefaultConstructible`
|
||||||
|
* \cgalRefines `CopyConstructible`
|
||||||
\cgalRefines `DefaultConstructible`
|
* \cgalRefines `Assignable`
|
||||||
\cgalRefines `CopyConstructible`
|
*
|
||||||
\cgalRefines `Assignable`
|
* A model of this concept represents a general polygon with holes. The
|
||||||
|
* concept requires the ability to access the general polygon that
|
||||||
|
* represents the outer boundary and the general polygons that represent
|
||||||
A model of this concept represents a general polygon with holes. The
|
* the holes.
|
||||||
concept requires the ability to access the general polygon that
|
*
|
||||||
represents the outer boundary and the general polygons that represent
|
* \cgalHasModel `CGAL::General_polygon_with_holes_2<Polygon>`
|
||||||
the holes.
|
* \cgalHasModel `CGAL::Polygon_with_holes_2<Kernel,Container>`
|
||||||
|
|
||||||
\cgalHasModel `CGAL::General_polygon_with_holes_2<General_polygon>`
|
|
||||||
\cgalHasModel `CGAL::Polygon_with_holes_2<Kernel,Container>`
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GeneralPolygonWithHoles_2 {
|
class GeneralPolygonWithHoles_2 {
|
||||||
|
|
@ -24,15 +20,12 @@ public:
|
||||||
/// \name Types
|
/// \name Types
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/*!
|
/*! the polygon type used to represent the outer boundary and each hole.
|
||||||
the general-polygon type used to represent the outer boundary and each hole.
|
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type General_polygon_2;
|
typedef unspecified_type Polygon_2;
|
||||||
|
|
||||||
/*!
|
/*! a bidirectional iterator
|
||||||
a bidirectional iterator
|
* over the polygonal holes. Its value type is `Polygon_2`.
|
||||||
over the polygonal holes. Its value type is
|
|
||||||
`General_polygon_2`.
|
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type Hole_const_iterator;
|
typedef unspecified_type Hole_const_iterator;
|
||||||
|
|
||||||
|
|
@ -41,16 +34,15 @@ typedef unspecified_type Hole_const_iterator;
|
||||||
/// \name Creation
|
/// \name Creation
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/*!
|
/*! constructs a general polygon with holes using a given general polygon
|
||||||
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
|
||||||
`outer` as the outer boundary and a given range of holes. If `outer`
|
* empty general polygon, then an unbounded polygon with holes will be
|
||||||
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
|
||||||
created. The holes must be contained inside the outer boundary, and the
|
* polygons representing the holes must be simple and pairwise disjoint, except
|
||||||
polygons representing the holes must be simple and pairwise disjoint, except
|
* perhaps at the vertices.
|
||||||
perhaps at the vertices.
|
|
||||||
*/
|
*/
|
||||||
template <class InputIterator>
|
template <typename InputIterator>
|
||||||
GeneralPolygonWithHoles_2(General_polygon_2 & outer,
|
GeneralPolygonWithHoles_2(Polygon_2 & outer,
|
||||||
InputIterator begin, InputIterator end);
|
InputIterator begin, InputIterator end);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
@ -58,9 +50,7 @@ InputIterator begin, InputIterator end);
|
||||||
/// \name Predicates
|
/// \name Predicates
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/*!
|
/*! returns `true` if the outer boundary is empty, and `false` otherwise.
|
||||||
returns `true` if the outer boundary is empty, and `false`
|
|
||||||
otherwise.
|
|
||||||
*/
|
*/
|
||||||
bool is_unbounded();
|
bool is_unbounded();
|
||||||
|
|
||||||
|
|
@ -69,22 +59,20 @@ bool is_unbounded();
|
||||||
/// \name Access Functions
|
/// \name Access Functions
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/*!
|
/*! returns the general polygon that represents the outer boundary. Note that
|
||||||
returns the general polygon that represents the outer boundary. Note that this polygon is not necessarily a valid (simple) general polygon because it may be relatively simple.
|
* this polygon is not necessarily a valid (simple) general polygon because it
|
||||||
|
* may be relatively simple.
|
||||||
*/
|
*/
|
||||||
const General_polygon_2 & outer_boundary() const;
|
const Polygon_2& outer_boundary() const;
|
||||||
|
|
||||||
/*!
|
/*! returns the begin iterator of the holes.
|
||||||
returns the begin iterator of the holes.
|
|
||||||
*/
|
*/
|
||||||
Hole_const_iterator holes_begin() const;
|
Hole_const_iterator holes_begin() const;
|
||||||
|
|
||||||
/*!
|
/*! returns the past-the-end iterator of the holes.
|
||||||
returns the past-the-end iterator of the holes.
|
|
||||||
*/
|
*/
|
||||||
Hole_const_iterator holes_end() const;
|
Hole_const_iterator holes_end() const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
}; /* end GeneralPolygonWithHoles_2 */
|
}; /* end GeneralPolygonWithHoles_2 */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ The assertion flags for the polygons and polygon operations use
|
||||||
\cgalCRPSection{Classes}
|
\cgalCRPSection{Classes}
|
||||||
- `CGAL::Polygon_2<PolygonTraits_2, Container>`
|
- `CGAL::Polygon_2<PolygonTraits_2, Container>`
|
||||||
- `CGAL::Polygon_with_holes_2<PolygonTraits_2,Container>`
|
- `CGAL::Polygon_with_holes_2<PolygonTraits_2,Container>`
|
||||||
- `CGAL::General_polygon_with_holes_2<General_polygon>`
|
- `CGAL::General_polygon_with_holes_2<Polygon>`
|
||||||
|
|
||||||
\cgalCRPSection{Global Functions}
|
\cgalCRPSection{Global Functions}
|
||||||
- `CGAL::area_2()`
|
- `CGAL::area_2()`
|
||||||
|
|
@ -76,4 +76,3 @@ The assertion flags for the polygons and polygon operations use
|
||||||
- \link PkgDrawPolygonWithHoles2 CGAL::draw<PH>() \endlink
|
- \link PkgDrawPolygonWithHoles2 CGAL::draw<PH>() \endlink
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,141 +23,92 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
/*!
|
/*! \ingroup PkgPolygon2Ref
|
||||||
\ingroup PkgPolygon2Ref
|
*
|
||||||
|
* The class `General_polygon_with_holes_2` models the concept
|
||||||
The class `General_polygon_with_holes_2` models the concept
|
* `GeneralPolygonWithHoles_2`. It represents a general polygon with holes.
|
||||||
`GeneralPolygonWithHoles_2`. It represents a general polygon with
|
* It is parameterized with a type `Polygon` used to define the exposed
|
||||||
holes. It is parameterized with a type `Polygon` used to define
|
* type `Polygon_2`. This type represents the outer boundary of the general
|
||||||
the exposed type `General_polygon_2`. This type represents the
|
* polygon and each hole.
|
||||||
outer boundary of the general polygon and the outer boundaries of
|
*
|
||||||
each hole.
|
* \tparam Polygon_ must have input and output operators.
|
||||||
|
*
|
||||||
\tparam Polygon_ must have input and output operators.
|
* \cgalModels `GeneralPolygonWithHoles_2`
|
||||||
|
|
||||||
\cgalModels `GeneralPolygonWithHoles_2`
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
template <class Polygon_>
|
template <typename Polygon_>
|
||||||
class General_polygon_with_holes_2
|
class General_polygon_with_holes_2 {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Definition
|
/// \name Definition
|
||||||
|
|
||||||
/// @{
|
/// @{
|
||||||
/// polygon without hole type
|
/// polygon without hole type
|
||||||
typedef Polygon_ General_polygon_2;
|
typedef Polygon_ Polygon_2;
|
||||||
|
#ifndef DOXYGEN_RUNNING
|
||||||
|
// Backward compatibility
|
||||||
|
typedef Polygon_2 General_polygon_2;
|
||||||
|
#endif
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
typedef std::deque<General_polygon_2> Holes_container;
|
typedef std::deque<Polygon_2> Holes_container;
|
||||||
|
|
||||||
typedef typename Holes_container::iterator Hole_iterator;
|
typedef typename Holes_container::iterator Hole_iterator;
|
||||||
typedef typename Holes_container::const_iterator Hole_const_iterator;
|
typedef typename Holes_container::const_iterator Hole_const_iterator;
|
||||||
|
|
||||||
typedef unsigned int Size;
|
typedef unsigned int Size;
|
||||||
|
|
||||||
General_polygon_with_holes_2() : m_pgn()
|
General_polygon_with_holes_2() : m_pgn() {}
|
||||||
|
|
||||||
|
|
||||||
|
explicit General_polygon_with_holes_2(const Polygon_2& pgn_boundary) :
|
||||||
|
m_pgn(pgn_boundary)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
template <typename HolesInputIterator>
|
||||||
explicit General_polygon_with_holes_2(const General_polygon_2& pgn_boundary)
|
General_polygon_with_holes_2(const Polygon_2& pgn_boundary,
|
||||||
: m_pgn(pgn_boundary)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template <class HolesInputIterator>
|
|
||||||
General_polygon_with_holes_2(const General_polygon_2& pgn_boundary,
|
|
||||||
HolesInputIterator h_begin,
|
HolesInputIterator h_begin,
|
||||||
HolesInputIterator h_end) : m_pgn(pgn_boundary),
|
HolesInputIterator h_end) :
|
||||||
|
m_pgn(pgn_boundary),
|
||||||
m_holes(h_begin, h_end)
|
m_holes(h_begin, h_end)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Holes_container& holes()
|
Holes_container& holes() { return m_holes; }
|
||||||
{
|
|
||||||
return m_holes;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Holes_container& holes() const
|
const Holes_container& holes() const { return m_holes; }
|
||||||
{
|
|
||||||
return m_holes;
|
|
||||||
}
|
|
||||||
|
|
||||||
Hole_iterator holes_begin()
|
Hole_iterator holes_begin() { return m_holes.begin(); }
|
||||||
{
|
|
||||||
return m_holes.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
Hole_iterator holes_end()
|
Hole_iterator holes_end() { return m_holes.end(); }
|
||||||
{
|
|
||||||
return m_holes.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
Hole_const_iterator holes_begin() const
|
Hole_const_iterator holes_begin() const { return m_holes.begin(); }
|
||||||
{
|
|
||||||
return m_holes.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
Hole_const_iterator holes_end() const
|
Hole_const_iterator holes_end() const { return m_holes.end(); }
|
||||||
{
|
|
||||||
return m_holes.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_unbounded() const
|
bool is_unbounded() const { return m_pgn.is_empty(); }
|
||||||
{
|
|
||||||
return m_pgn.is_empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
General_polygon_2& outer_boundary()
|
Polygon_2& outer_boundary() { return m_pgn; }
|
||||||
{
|
|
||||||
return m_pgn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const General_polygon_2& outer_boundary() const
|
const Polygon_2& outer_boundary() const { return m_pgn; }
|
||||||
{
|
|
||||||
return m_pgn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void add_hole(const General_polygon_2& pgn_hole)
|
void add_hole(const Polygon_2& pgn_hole) { m_holes.push_back(pgn_hole); }
|
||||||
{
|
|
||||||
m_holes.push_back(pgn_hole);
|
|
||||||
}
|
|
||||||
|
|
||||||
void erase_hole(Hole_iterator hit)
|
void erase_hole(Hole_iterator hit) { m_holes.erase(hit); }
|
||||||
{
|
|
||||||
m_holes.erase(hit);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool has_holes() const
|
bool has_holes() const { return (!m_holes.empty()); }
|
||||||
{
|
|
||||||
return (!m_holes.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
Size number_of_holes() const
|
Size number_of_holes() const { return static_cast<Size>(m_holes.size()); }
|
||||||
{
|
|
||||||
return static_cast<Size>(m_holes.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear()
|
void clear() {
|
||||||
{
|
|
||||||
m_pgn.clear();
|
m_pgn.clear();
|
||||||
m_holes.clear();
|
m_holes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_plane() const
|
bool is_plane() const { return (m_pgn.is_empty() && m_holes.empty()); }
|
||||||
{
|
|
||||||
return (m_pgn.is_empty() && m_holes.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Polygon_2 m_pgn;
|
||||||
General_polygon_2 m_pgn;
|
|
||||||
Holes_container m_holes;
|
Holes_container m_holes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------//
|
//-----------------------------------------------------------------------//
|
||||||
// operator<<
|
// operator<<
|
||||||
//-----------------------------------------------------------------------//
|
//-----------------------------------------------------------------------//
|
||||||
|
|
@ -177,10 +128,9 @@ boundary is exported followed by the curves themselves.
|
||||||
|
|
||||||
\relates General_polygon_with_holes_2
|
\relates General_polygon_with_holes_2
|
||||||
*/
|
*/
|
||||||
template <class Polygon_>
|
template <typename Polygon_>
|
||||||
std::ostream
|
std::ostream&
|
||||||
&operator<<(std::ostream &os, const General_polygon_with_holes_2<Polygon_>& p)
|
operator<<(std::ostream& os, const General_polygon_with_holes_2<Polygon_>& p) {
|
||||||
{
|
|
||||||
typename General_polygon_with_holes_2<Polygon_>::Hole_const_iterator hit;
|
typename General_polygon_with_holes_2<Polygon_>::Hole_const_iterator hit;
|
||||||
|
|
||||||
switch(IO::get_mode(os)) {
|
switch(IO::get_mode(os)) {
|
||||||
|
|
@ -225,19 +175,17 @@ outer boundary is followed by the curves themselves.
|
||||||
|
|
||||||
\relates General_polygon_with_holes_2
|
\relates General_polygon_with_holes_2
|
||||||
*/
|
*/
|
||||||
template <class Polygon_>
|
template <typename Polygon_>
|
||||||
std::istream &operator>>(std::istream &is, General_polygon_with_holes_2<Polygon_>& p)
|
std::istream&
|
||||||
{
|
operator>>(std::istream& is, General_polygon_with_holes_2<Polygon_>& p) {
|
||||||
p.clear();
|
p.clear();
|
||||||
is >> p.outer_boundary();
|
is >> p.outer_boundary();
|
||||||
|
|
||||||
unsigned int n_holes;
|
unsigned int n_holes;
|
||||||
is >> n_holes;
|
is >> n_holes;
|
||||||
if (is)
|
if (is) {
|
||||||
{
|
|
||||||
Polygon_ pgn_hole;
|
Polygon_ pgn_hole;
|
||||||
for (unsigned int i=0; i<n_holes; i++)
|
for (unsigned int i=0; i<n_holes; ++i) {
|
||||||
{
|
|
||||||
is >> pgn_hole;
|
is >> pgn_hole;
|
||||||
p.add_hole(pgn_hole);
|
p.add_hole(pgn_hole);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ struct Is_same_type<U,U> { typedef Tag_true type ; } ;
|
||||||
|
|
||||||
// The return type of create_interior/exterior_skeleton_and_offset_polygons_2:
|
// The return type of create_interior/exterior_skeleton_and_offset_polygons_2:
|
||||||
// - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type
|
// - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type
|
||||||
// should be the internal (hole-less) polygon type GeneralPolygonWithHoles_2::General_polygon_2
|
// should be the internal (hole-less) polygon type GeneralPolygonWithHoles_2::Polygon_2
|
||||||
// - if polygon input is just a sequence container of points (e.g. Polygon_2), then the same type
|
// - if polygon input is just a sequence container of points (e.g. Polygon_2), then the same type
|
||||||
// is expected in output
|
// is expected in output
|
||||||
template <typename Polygon, typename OfK,
|
template <typename Polygon, typename OfK,
|
||||||
|
|
@ -59,9 +59,9 @@ struct Default_return_polygon_type // Polygon type supports holes
|
||||||
{
|
{
|
||||||
typedef typename std::conditional<std::is_same<
|
typedef typename std::conditional<std::is_same<
|
||||||
typename Kernel_traits<typename boost::range_value<
|
typename Kernel_traits<typename boost::range_value<
|
||||||
typename Polygon::General_polygon_2>::type>::Kernel,
|
typename Polygon::Polygon_2>::type>::Kernel,
|
||||||
OfK>::value,
|
OfK>::value,
|
||||||
typename Polygon::General_polygon_2, // correct kernel
|
typename Polygon::Polygon_2, // correct kernel
|
||||||
CGAL::Polygon_2<OfK> /*incorrect kernel*/ >::type type;
|
CGAL::Polygon_2<OfK> /*incorrect kernel*/ >::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ struct Default_return_polygon_with_holes_type // Polygon type supports holes
|
||||||
{
|
{
|
||||||
typedef typename std::conditional<std::is_same<
|
typedef typename std::conditional<std::is_same<
|
||||||
typename Kernel_traits<typename boost::range_value<
|
typename Kernel_traits<typename boost::range_value<
|
||||||
typename Polygon::General_polygon_2>::type>::Kernel,
|
typename Polygon::Polygon_2>::type>::Kernel,
|
||||||
OfK>::value,
|
OfK>::value,
|
||||||
Polygon, // correct kernel
|
Polygon, // correct kernel
|
||||||
CGAL::Polygon_with_holes_2<OfK> /*incorrect kernel*/ >::type type;
|
CGAL::Polygon_with_holes_2<OfK> /*incorrect kernel*/ >::type type;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue