Merge pull request #3998 from sloriot/BO2-fix_outer_ccb_supply

Fix outer ccb supply chain
This commit is contained in:
Laurent Rineau 2019-06-17 13:51:28 +02:00
commit 04bf5e7248
2 changed files with 60 additions and 4 deletions

View File

@ -1212,6 +1212,7 @@ protected:
for (Halfedge_iterator itr = arr->halfedges_begin(); itr != arr->halfedges_end(); ++itr)
{
Halfedge_handle h = itr;
CGAL_assertion(h->face() != Face_handle());
if (h->face()->id_not_set()) continue;
CGAL_assertion(h->flag()!=NOT_VISITED);
@ -1250,10 +1251,17 @@ protected:
inner_ccb_and_new_face_pairs.push_back( std::make_pair(inner_ccb, f) );
}
else{
// we never create more outer ccb than what was available
CGAL_assertion(!outer_ccbs_to_remove.empty());
typename Aos_2::Dcel::Outer_ccb* outer_ccb = outer_ccbs_to_remove.back();
outer_ccbs_to_remove.pop_back();
// create a new outer ccb if none is available
typename Aos_2::Dcel::Outer_ccb* outer_ccb;
if (!outer_ccbs_to_remove.empty())
{
outer_ccb = outer_ccbs_to_remove.back();
outer_ccbs_to_remove.pop_back();
}
else{
outer_ccb = accessor.new_outer_ccb();
outer_ccb->set_face(f);
}
Halfedge_handle hstart=h;
do{
_halfedge(h)->set_outer_ccb(outer_ccb);

View File

@ -0,0 +1,48 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <CGAL/Polygon_set_2.h>
#include <list>
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
int main()
{
CGAL::Polygon_2<K> ob;
ob.push_back(CGAL::Point_2<K>(1, 1));
ob.push_back(CGAL::Point_2<K>(1, 0));
ob.push_back(CGAL::Point_2<K>(6, 0));
ob.push_back(CGAL::Point_2<K>(6, 7));
ob.push_back(CGAL::Point_2<K>(0, 7));
ob.push_back(CGAL::Point_2<K>(0, 1));
CGAL::Polygon_2<K> h;
h.push_back(CGAL::Point_2<K>(2, 1));
h.push_back(CGAL::Point_2<K>(2, 2));
h.push_back(CGAL::Point_2<K>(3, 2));
h.push_back(CGAL::Point_2<K>(3, 3));
h.push_back(CGAL::Point_2<K>(2, 3));
h.push_back(CGAL::Point_2<K>(2, 4));
h.push_back(CGAL::Point_2<K>(3, 4));
h.push_back(CGAL::Point_2<K>(3, 5));
h.push_back(CGAL::Point_2<K>(4, 5));
h.push_back(CGAL::Point_2<K>(4, 1));
CGAL::Polygon_with_holes_2<K> ob_with_holes(ob);
ob_with_holes.add_hole(h);
CGAL::Polygon_set_2<K> inter(ob_with_holes);
CGAL::Polygon_2<K> new_poly;
new_poly.push_back(CGAL::Point_2<K>(1, 1));
new_poly.push_back(CGAL::Point_2<K>(2, 1));
new_poly.push_back(CGAL::Point_2<K>(2, 2));
new_poly.push_back(CGAL::Point_2<K>(2, 3));
new_poly.push_back(CGAL::Point_2<K>(2, 4));
new_poly.push_back(CGAL::Point_2<K>(2, 5));
new_poly.push_back(CGAL::Point_2<K>(3, 5));
new_poly.push_back(CGAL::Point_2<K>(4, 5));
new_poly.push_back(CGAL::Point_2<K>(4, 6));
new_poly.push_back(CGAL::Point_2<K>(1, 6));
inter.difference(new_poly);
}