Add is_empty()

This commit is contained in:
Andreas Fabri 2024-04-19 08:10:46 +01:00
parent 8f1086f050
commit 29c6a7905f
4 changed files with 23 additions and 1 deletions

View File

@ -123,6 +123,19 @@ public:
bool is_plane() const { return (m_pgn.is_empty() && m_holes.empty()); }
bool is_empty() const
{
if(! outer_boundary().is_empty()) {
return false;
}
for(const auto& h : holes()){
if(! h.is_empty()){
return false;
}
}
return true;
}
protected:
Polygon_2 m_pgn;
Holes_container m_holes;

View File

@ -111,6 +111,15 @@ public:
return bb;
}
bool is_empty() const
{
for(const auto& pwh : polygons_with_holes()){
if(! pwh.is_empty()){
return false;
}
}
return true;
}
protected:
Polygon_with_holes_container m_polygons;

View File

@ -47,5 +47,6 @@ int main()
CGAL::Bbox_2 bb = mp.bbox();
std::cout << bb << std::endl;
assert(! mp.is_empty());
return 0;
}

View File

@ -314,7 +314,6 @@ public:
using Face_circulator = typename Triangulation::Face_circulator;
using Edge = typename Triangulation::Edge;
// TODO: Edge_map and Vertex_map use std::set and std::map with exact kernels since Point_2 can't be hashed otherwise
using Edge_map = typename std::conditional<std::is_floating_point<FT>::value,
std::unordered_set<std::pair<Point_2, Point_2>,
boost::hash<std::pair<Point_2, Point_2>>>,