diff --git a/GraphicsView/include/CGAL/Buffer_for_vao.h b/GraphicsView/include/CGAL/Buffer_for_vao.h index b8ca1f752bb..0ff36cc96cd 100644 --- a/GraphicsView/include/CGAL/Buffer_for_vao.h +++ b/GraphicsView/include/CGAL/Buffer_for_vao.h @@ -35,7 +35,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -606,8 +606,23 @@ protected: { P_traits cdt_traits(normal); CDT cdt(cdt_traits); - bool with_vertex_normal=(m_vertex_normals_for_face.size()==m_points_of_face.size()); + Local_point p1, p2; + + // For each point of the face, store the list of adjacent points and the number of time + // the edge is found in the face. For an edge p1, p2, store edge min(p1,p2)->max(p1,p2) + std::map > edges; + for (unsigned int i=0; i m; m[p2]=1; edges[p1]=m; } + else if (edges[p1].count(p2)==0) { edges[p1][p2]=1; } + else { ++(edges[p1][p2]); } + } // (1) We insert all the edges as contraint in the CDT. typename CDT::Vertex_handle previous=NULL, first=NULL; @@ -626,12 +641,22 @@ protected: { vh->info().index=m_indices_of_points_of_face[i]; } if(previous!=NULL && previous!=vh) - { cdt.insert_constraint(previous, vh); } + { + p1=m_points_of_face[i]; p2=m_points_of_face[i-1]; + if (p2 constraint + { cdt.insert_constraint(previous, vh); } + } previous=vh; } if (previous!=NULL && previous!=first) - { cdt.insert_constraint(previous, first); } + { + p1=m_points_of_face[m_points_of_face.size()-1]; p2=m_points_of_face[0]; + if (p2 constraint + { cdt.insert_constraint(previous, first); } + } // (2) We mark all external triangles // (2.1) We initialize is_external and is_process values