diff --git a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h index c055798f877..218e7210866 100644 --- a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h +++ b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h @@ -363,12 +363,82 @@ void convert_nef_polyhedron_to_polygon_soup(const Nef_polyhedron& nef, auto shell_is_closed = [](typename Nef_polyhedron::Shell_entry_const_iterator sfh) { - typename Nef_polyhedron::Halffacet_const_handle f; + typename Nef_polyhedron::SFace_const_handle sf = sfh; - if (CGAL::assign(f,*sfh)) - return f->incident_volume()!=f->twin()->incident_volume(); - else - return false; + typename Nef_polyhedron::SFace_cycle_const_iterator fc; + for(fc = sf->sface_cycles_begin(); fc != sf->sface_cycles_end(); ++fc) + { + if (fc.is_shalfedge() ) { + typename Nef_polyhedron::SHalfedge_const_handle e(fc); + typename Nef_polyhedron::SHalfedge_around_sface_const_circulator ec(e),ee(e); + CGAL_For_all(ec,ee) + { + typename Nef_polyhedron::SVertex_const_handle vv = ec->twin()->source(); + //~ if ( !SD.is_isolated(vv) && !Done[vv] ) { + //~ V.visit(vv); // report edge + //~ Done[vv] = Done[vv->twin()] = true; + //~ } + typename Nef_polyhedron::Halffacet_const_handle f = ec->twin()->facet(); + return f->incident_volume()!=f->twin()->incident_volume(); + //~ if ( Done[f] ) continue; + //~ Halffacet_handle tf = f->twin(); + //~ } + //~ FacetCandidates.push_back(f); Done[f] = true; + } + } + +#if 0 + else if (fc.is_svertex() ) { + SVertex_handle v(fc); + if ( Done[v] ) continue; + V.visit(v); // report edge + V.visit(v->twin()); + Done[v] = Done[v->twin()] = true; + CGAL_assertion(SD.is_isolated(v)); + SFaceCandidates.push_back(v->twin()->incident_sface()); + Done[v->twin()->incident_sface()]=true; + // note that v is isolated, thus twin(v) is isolated too + // SM_const_decorator SD; + // SFace_const_handle fo; + // fo = v->twin()->incident_sface(); + /* + if(SD.is_isolated(v)) + fo = v->source()->sfaces_begin(); + else + fo = v->twin()->incident_sface(); + */ + } else if (fc.is_shalfloop() ) { + SHalfloop_handle l(fc); + V.visit(l); + Halffacet_handle f = l->twin()->facet(); + if ( Done[f] ) continue; + FacetCandidates.push_back(f); Done[f] = true; + } else CGAL_error_msg("Damn wrong handle."); +#endif + } + + return false; + + //~ typename Nef_polyhedron::SHalfedge_const_handle e(sf); + //~ typename Nef_polyhedron::SHalffacet_const_handle f = e->facet(); + //~ e->facet() + //~ SHalfedge_around_sface_circulator ec(e),ee(e); + //~ CGAL_For_all(ec,ee) { + //~ SVertex_handle vv = ec->twin()->source(); + //~ if ( !SD.is_isolated(vv) && !Done[vv] ) { + //~ V.visit(vv); // report edge + //~ Done[vv] = Done[vv->twin()] = true; + //~ } + //~ Halffacet_handle f = ec->twin()->facet(); + //~ if ( Done[f] ) continue; + + //~ if (CGAL::assign(f,*sfh)) + //~ { + //~ std::cout << "COUCOU\n"; + //~ return f->incident_volume()!=f->twin()->incident_volume(); + //~ } + //~ else + //~ return false; }; for (;vol_it!=vol_end;++vol_it)