diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/non_rigid_mesh_registration_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/non_rigid_mesh_registration_example.cpp index 5aa632b88ed..5b5fe2af64b 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/non_rigid_mesh_registration_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/non_rigid_mesh_registration_example.cpp @@ -9,6 +9,7 @@ #include #include +#include using K = CGAL::Exact_predicates_inexact_constructions_kernel; using Mesh = CGAL::Surface_mesh; @@ -41,7 +42,6 @@ int main(int, char**) { if (corr.is_open()) { std::size_t v0, v1; while (corr >> v0 >> v1) { - std::cout << v0 << " " << v1 << std::endl; correspondences_mesh.push_back(std::make_pair(*(source.vertices_begin() + v0), *(target.vertices_begin() + v1))); } } @@ -53,13 +53,23 @@ int main(int, char**) { Mesh::Property_map> vrm = source.add_property_map>("v:rotation").first; Mesh::Property_map vtm = source.add_property_map("v:translation").first; - FT w1 = 2.0; - FT w2 = 2.0; - FT w3 = 50; + FT w1 = 0.2; + FT w2 = 0.2; + FT w3 = 5000; + new_arap = true; + + std::ostringstream out; + out.precision(2); + if (new_arap) + out << "bear_" << std::fixed << w1 << "_" << w2 << "_" << w3 << "_new.off"; + else + out << "bear_" << std::fixed << w1 << "_" << w2 << "_" << w3 << "_old.off"; + + std::cout << std::endl << out.str() << std::endl; PMP::non_rigid_mesh_to_mesh_registration(source, target, vtm, vrm, CGAL::parameters::point_to_point_energy(w1).point_to_plane_energy(w2).as_rigid_as_possible_energy(w3).correspondences(std::cref(correspondences_mesh))); PMP::apply_non_rigid_transformation(source, vtm); - CGAL::IO::write_polygon_mesh("bear_" + std::to_string(w1) + "_" + std::to_string(w2) + "_" + std::to_string(w3) + ".off", source); + CGAL::IO::write_polygon_mesh(out.str(), source); return EXIT_SUCCESS; } \ No newline at end of file diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/non_rigid_mesh_registration.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/non_rigid_mesh_registration.h index a71f289015b..edbcd2b64b8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/non_rigid_mesh_registration.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/non_rigid_mesh_registration.h @@ -41,6 +41,8 @@ #include +bool new_arap = true; + namespace CGAL { namespace Polygon_mesh_processing { namespace internal { @@ -619,7 +621,6 @@ void non_rigid_mesh_to_points_registration(TriangleMesh& source, #endif // Update edge neighborhoods by new local rotation - bool new_arap = true; if (it == (iter - 1)) { if (new_arap) { for (Index i = 0; i < Z.rows(); ++i)