From 0840a6e1a34dad8b44e19000e37e3b20d3f44169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 7 Oct 2019 13:07:30 +0200 Subject: [PATCH] Enforce constraints by not updating their position --- .../ARAP_parameterizer_3.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h index 2243d9e6e56..ce83d5bd726 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h @@ -311,14 +311,21 @@ private: // Copy the data from two vectors to the UVmap. template + typename VertexIndexMap, + typename VertexParameterizedMap> void assign_solution(const Vector& Xu, const Vector& Xv, const Vertex_set& vertices, VertexUVMap uvmap, - const VertexIndexMap vimap) + const VertexIndexMap vimap, + const VertexParameterizedMap vpmap) { BOOST_FOREACH(vertex_descriptor vd, vertices) { + // The solver might not have managed to exactly constrain the vertex that was marked + // as constrained; simply don't update its position. + if(get(vpmap, vd)) + continue; + int index = get(vimap, vd); NT u = Xu(index); NT v = Xv(index); @@ -1132,13 +1139,13 @@ private: BOOST_FOREACH(vertex_descriptor vd, vertices) { if(get(vpmap, vd)) { int index = get(vimap, vd); - CGAL_postcondition(std::abs(Xu[index] - Bu[index] ) < 1e-10); - CGAL_postcondition(std::abs(Xv[index] - Bv[index] ) < 1e-10); + CGAL_warning(std::abs(Xu[index] - Bu[index] ) < 1e-7); + CGAL_warning(std::abs(Xv[index] - Bv[index] ) < 1e-7); } } ) - assign_solution(Xu, Xv, vertices, uvmap, vimap); + assign_solution(Xu, Xv, vertices, uvmap, vimap, vpmap); return status; }