I am usion the CGAL::Polygon_mesh_processing::corefine_and_compute_union(),
function to compute the union of 2 meshes.
When I use the code exemple from the website (https://cgal.geometryfactory.com/CGAL/doc/master/Polygon_mesh_processing/Polygon_mesh_processing_2corefinement_mesh_union_8cpp-example.html) and the provided off files blobby.off and eight.off, everything goes fine.
Unfortunately when I use other off files I am getting and error that I don't understand :
CGAL error: assertion violation!
Expression : it_poly_hedge!=edge_to_hedge.end()
File : /usr/local/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h
Line : 1008
Here is the concerned code in Visitor.h :
//WARNING: in few case this is needed if the marked edge is on the border
//to optimize it might be better to only use sorted pair. TAG_SLXX1
Node_id_pair opposite_pair(node_id_pair.second,node_id_pair.first);
it_poly_hedge=edge_to_hedge.find(opposite_pair);
CGAL_assertion( it_poly_hedge!=edge_to_hedge.end() );
You can find the files I use here : https://pool234.seedbox.fr/files/index.php/s/H87xL0Ema9HC44P (pwd : share)
Thank you for you help.
Here is the aswner from sloriot :
mesh2.off is not a valid input mesh (self-intersections due to duplicated edges). If you first fix it by calling CGAL::Polygon_mesh_processing::stitch_borders(), you'll get your result.
Thx