From 3bf248f04c180c8095e27489e741dee6377b5e9b Mon Sep 17 00:00:00 2001 From: goran-w <44604769+goran-w@users.noreply.github.com> Date: Fri, 21 Dec 2018 08:59:13 +0100 Subject: [PATCH 1/2] Update File_medit.h --- Mesh_3/include/CGAL/IO/File_medit.h | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Mesh_3/include/CGAL/IO/File_medit.h b/Mesh_3/include/CGAL/IO/File_medit.h index 8b12c81e1c4..84af6a8f9a3 100644 --- a/Mesh_3/include/CGAL/IO/File_medit.h +++ b/Mesh_3/include/CGAL/IO/File_medit.h @@ -815,27 +815,28 @@ output_to_medit(std::ostream& os, fit != c3t3.facets_in_complex_end(); ++fit) { - for (int i=0; i<4; i++) - { - if (i != fit->second) - { - const Vertex_handle& vh = (*fit).first->vertex(i); - os << V[vh] << ' '; - } - } + C3T3::Facet f = (*fit); + + // Apply priority among subdomains, to get consistent facet orientation per subdomain-pair interface. + if (f.first->subdomain_index() < f.first->neighbor(f.second)->subdomain_index()) + f = tr.mirror_facet(f); + + // Get facet vertices in CCW order. + Vertex_handle vh1 = f.first->vertex((f.second + 1) % 4); + Vertex_handle vh2 = f.first->vertex((f.second + 2) % 4); + Vertex_handle vh3 = f.first->vertex((f.second + 3) % 4); + + // Facet orientation also depends on parity. + if (f.second % 2 != 0) + std::swap(vh2, vh3); + + os << V[vh1] << ' ' << V[vh2] << ' ' << V[vh3] << ' '; os << get(facet_pmap, *fit) << '\n'; // Print triangle again if needed if ( print_each_facet_twice ) { - for (int i=0; i<4; i++) - { - if (i != fit->second) - { - const Vertex_handle& vh = (*fit).first->vertex(i); - os << V[vh] << ' '; - } - } + os << V[vh1] << ' ' << V[vh2] << ' ' << V[vh3] << ' '; os << get(facet_twice_pmap, *fit) << '\n'; } } From 509594f21d36d5e3d8c1547ec00807d7605b5957 Mon Sep 17 00:00:00 2001 From: goran-w <44604769+goran-w@users.noreply.github.com> Date: Fri, 21 Dec 2018 11:46:04 +0100 Subject: [PATCH 2/2] Added missing typename qualifier. My bad. Visual Studio 2017 compiler did not complain about this. --- Mesh_3/include/CGAL/IO/File_medit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_3/include/CGAL/IO/File_medit.h b/Mesh_3/include/CGAL/IO/File_medit.h index 84af6a8f9a3..656a6b5db98 100644 --- a/Mesh_3/include/CGAL/IO/File_medit.h +++ b/Mesh_3/include/CGAL/IO/File_medit.h @@ -815,7 +815,7 @@ output_to_medit(std::ostream& os, fit != c3t3.facets_in_complex_end(); ++fit) { - C3T3::Facet f = (*fit); + typename C3T3::Facet f = (*fit); // Apply priority among subdomains, to get consistent facet orientation per subdomain-pair interface. if (f.first->subdomain_index() < f.first->neighbor(f.second)->subdomain_index())