From b052d3bc5f99c1b38662f2aaf5ac5d4f7c38d7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 1 Dec 2016 16:04:21 +0100 Subject: [PATCH] Distinguished between the first cone and the second cone Thus if the input cones are C_0 ... C_3, then the seam is going from C_0 to C_3. This is important because the result is not always identical. Plugin of the demo decides randomly for now, which is not satisfying. --- .../Orbital_Tutte_parameterizer_3.h | 8 ++--- .../internal/orbital_cone_helper.h | 32 ++++++++++++++++--- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbital_Tutte_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbital_Tutte_parameterizer_3.h index 82c5cb2e7e7..8554d1a9827 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbital_Tutte_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbital_Tutte_parameterizer_3.h @@ -149,12 +149,12 @@ private: if(orb_type == Parallelogram) { if(cmap.size() != 6) { std::cerr << "Using orb_type " << get_orbifold_type(orb_type) - << " requires 6 vertices marked as cones in the seam mesh :" << std::endl; + << " requires 4 vertices marked as cones (thus 6 in the seam mesh)" << std::endl; return ERROR_WRONG_PARAMETER; } } else if(cmap.size() != 4){ // orb_type == Square, Diamond, Triangle std::cerr << "Using orb_type " << get_orbifold_type(orb_type) - << " requires 4 vertices marked as cones in the seam mesh :" << std::endl; + << " requires 3 vertices marked as cones (thus 4 in the seam mesh)" << std::endl; return ERROR_WRONG_PARAMETER; } @@ -224,7 +224,7 @@ private: { typename ConeMap::const_iterator cmit = cmap.begin(), cend = cmap.end(); for(; cmit!=cend; ++cmit) { - if(cmit->second != Unique_cone) + if(cmit->second != First_unique_cone) continue; cone = cmit->first; @@ -433,7 +433,7 @@ private: constrain_seam_segment(seam_segment, ang, current_line_id_in_A, A, B); // the last cone of the seam is constrained - if(is_in_map->second == Unique_cone) { // reached the end of the seam + if(is_in_map->second == Second_unique_cone) { // reached the end of the seam CGAL_assertion(hd1_target == hd2_target); addConstraint(A, B, current_line_id_in_A, hd1t_index, 1. /*entry in A*/, tcoords.back()); diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbital_cone_helper.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbital_cone_helper.h index 0f551451d4a..921e6d1d341 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbital_cone_helper.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbital_cone_helper.h @@ -42,7 +42,8 @@ namespace Surface_mesh_parameterization { enum Cone_type { - Unique_cone = 0, + First_unique_cone = 0, + Second_unique_cone, Duplicated_cone }; @@ -127,11 +128,23 @@ void locate_cones(const Mesh& mesh, // the cones in the underlying mesh std::size_t cvdss = cone_vds_in_sm.size(); + + std::cout << cvdss << " cones to locate" << std::endl; + for(std::size_t i=0; i::PPM PPM; const PPM ppmap = get(boost::vertex_point, mesh); + bool first_cone_met = false; + // walk on the seam and mark if we encounter a cone vertex_descriptor end = vertex_on_seam; do { @@ -205,8 +220,17 @@ void locate_unordered_cones(const Mesh& mesh, CGAL_assertion(other_hd.seam); other_hd.seam = false; - Cone_type ct = (target(hd, mesh) == source(other_hd, mesh)) ? Unique_cone - : Duplicated_cone; + Cone_type ct; + if(target(hd, mesh) == source(other_hd, mesh)) { + if(first_cone_met) + ct = Second_unique_cone; + else { + ct = First_unique_cone; + first_cone_met = true; + } + } else { + ct = Duplicated_cone; + } std::cout << "new cone with type: " << ct << std::endl;