diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_impl.h index 0fd7fb480a4..199310f4408 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_impl.h @@ -165,14 +165,14 @@ public: #endif } - void area_relaxation(const double& precision) + void area_relaxation(const double& tolerance) { std::size_t moved_points = 0; BOOST_FOREACH(vertex_descriptor v, vrange_) { if(!is_border(v, mesh_) && !is_constrained(v)) { - if (gradient_descent(v, precision)) + if (gradient_descent(v, tolerance)) moved_points++; } } @@ -465,7 +465,7 @@ private: // gradient descent // ---------------- - bool gradient_descent(const vertex_descriptor& v, const double& precision) + bool gradient_descent(const vertex_descriptor& v, const double& tolerance) { bool move_flag; double x, y, z, x_new, y_new, z_new, drdx, drdy, drdz; @@ -481,14 +481,14 @@ private: return false; double energy_new = 0; - double relative_energy = precision + 1; + double relative_energy = 1; unsigned int t = 1; double eta0 = 0.01; //double power_t = 0.25; double t0 = 0.001; double eta = eta0 / (1 + t0*t); - while(relative_energy > precision) + while(relative_energy > tolerance) { drdx=0, drdy=0, drdz=0; compute_derivatives(drdx, drdy, drdz, v, S_av); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smoothing.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smoothing.h index e6124ad06ef..68d00f820c1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smoothing.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smoothing.h @@ -364,7 +364,7 @@ void area_smoothing(PolygonMesh& pmesh, const FaceRange& faces, const NamedParam unsigned int nb_iterations = choose_param(get_param(np, internal_np::number_of_iterations), 1); //gradient descent precision - double gd_precision = choose_param(get_param(np, internal_np::gradient_descent_precision), 0.001); + double gd_precision = choose_param(get_param(np, internal_np::gradient_descent_precision), 0.000001); internal::Compatible_remesher remesher(pmesh, vpmap, vcmap, ecmap); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.cpp index 3fb13d81503..012a30716b9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.cpp @@ -119,6 +119,7 @@ public: ui_widget.iterations_spinBox->setSingleStep(1); ui_widget.iterations_spinBox->setMinimum(1); + /* ui_widget.curv_iterations_spinBox->setValue(1); ui_widget.curv_iterations_spinBox->setSingleStep(1); ui_widget.curv_iterations_spinBox->setMinimum(1); @@ -126,6 +127,7 @@ public: ui_widget.curv_iterations_spinBox_2->setValue(1); ui_widget.curv_iterations_spinBox_2->setSingleStep(1); ui_widget.curv_iterations_spinBox_2->setMinimum(1); + */ } @@ -167,8 +169,7 @@ public Q_SLOTS: { unsigned int nb_iter = ui_widget.Angle_spinBox->value(); //bool use_weights = ui_widget.use_weights_checkBox->isChecked(); - angle_smoothing(pmesh, - parameters::number_of_iterations(nb_iter)); + angle_smoothing(pmesh, parameters::number_of_iterations(nb_iter)); poly_item->invalidateOpenGLBuffers(); Q_EMIT poly_item->itemChanged(); @@ -176,11 +177,9 @@ public Q_SLOTS: if(ui_widget.Area_checkBox->isChecked()) { - std::cout<<"Area_checkBox\n"; unsigned int nb_iter = ui_widget.Area_spinBox->value(); //double gd_precision = ui_widget.gd_dSpinBox->value(); - area_smoothing(pmesh, - parameters::number_of_iterations(nb_iter)); + area_smoothing(pmesh, parameters::number_of_iterations(nb_iter)); poly_item->invalidateOpenGLBuffers(); Q_EMIT poly_item->itemChanged(); @@ -202,9 +201,9 @@ public Q_SLOTS: QApplication::setOverrideCursor(Qt::WaitCursor); - unsigned int nb_iter = ui_widget.curv_iterations_spinBox->value(); - curvature_flow_smoothing(pmesh, - parameters::number_of_iterations(nb_iter)); + //unsigned int nb_iter = ui_widget.curv_iterations_spinBox->value(); + unsigned int nb_iter = 1; + curvature_flow_smoothing(pmesh, parameters::number_of_iterations(nb_iter)); poly_item->invalidateOpenGLBuffers(); Q_EMIT poly_item->itemChanged(); @@ -226,7 +225,8 @@ public Q_SLOTS: QApplication::setOverrideCursor(Qt::WaitCursor); - unsigned int nb_iter = ui_widget.curv_iterations_spinBox_2->value(); + //unsigned int nb_iter = ui_widget.curv_iterations_spinBox_2->value(); + unsigned int nb_iter = 1; if(!is_stiffness_matrix_setup) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.ui index ccbc80f3a4c..759e1de3582 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.ui @@ -6,8 +6,8 @@ 0 0 - 590 - 387 + 570 + 383 @@ -19,50 +19,38 @@ 10 230 - 571 + 551 121 Shape smoothing - + - 10 + 160 40 - 551 - 33 + 211 + 30 - - - - - MCF - - - - + + MCF + - + - 10 + 160 80 - 551 - 33 + 211 + 30 - - - - - Modified MCF - - - - + + Modified MCF + @@ -70,7 +58,7 @@ 10 0 - 571 + 551 227 @@ -82,7 +70,7 @@ 10 30 - 551 + 531 183