diff --git a/Operations_on_polyhedra/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h b/Operations_on_polyhedra/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h index ed843914bff..394613c1d81 100644 --- a/Operations_on_polyhedra/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h +++ b/Operations_on_polyhedra/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h @@ -793,9 +793,11 @@ public: #endif } std::pair edge_pair(*it_id,node_id_of_first); - border_halfedges.insert( std::make_pair(hedge,edge_pair) ); - put(m_edge_mark_pmap,std::make_pair(hedge,poly),true); - put(m_edge_mark_pmap,std::make_pair(hedge->opposite(),poly),true); + if ( border_halfedges.insert( std::make_pair(hedge,edge_pair) ).second) + { + put(m_edge_mark_pmap,std::make_pair(hedge,poly),true); + put(m_edge_mark_pmap,std::make_pair(hedge->opposite(),poly),true); + } update_edge_per_polyline(poly,edge_pair,hedge); //save the fact that we already handle this edge already_done.insert(std::make_pair(node_id_of_first,*it_id)); @@ -1102,9 +1104,11 @@ public: //is defined as one of them defines an adjacent face //CGAL_assertion(it_poly_hedge!=edge_to_hedge.end()); if( it_poly_hedge!=edge_to_hedge.end() ){ - border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),*it_cst) ); - put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true); - put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise) + if ( border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),*it_cst) ).second) + { + put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true); + put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise) + } update_edge_per_polyline(P,it_poly_hedge->first,it_poly_hedge->second); } else{ @@ -1114,9 +1118,11 @@ public: it_poly_hedge=edge_to_hedge.find(opposite_pair); CGAL_assertion( it_poly_hedge!=edge_to_hedge.end() ); - border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),opposite_pair) ); - put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true); - put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise) + if ( border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),opposite_pair) ).second ) + { + put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true); + put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise) + } update_edge_per_polyline(P,it_poly_hedge->first,it_poly_hedge->second); } }