From 7894e0e07115794a88f2cc2be950e8a2f97faf7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 2 Jul 2015 14:39:35 +0200 Subject: [PATCH] min_edge_length -> max_edge_length --- .../Mean_curvature_flow_skeletonization.h | 30 +++++++++---------- .../Detect_degeneracy.h | 12 ++++---- .../MCF_Skeleton_test.cpp | 8 ++--- .../Mean_curvature_flow_skeleton_plugin.ui | 10 +++---- ...mo_mean_curvature_flow_skeleton_plugin.cpp | 20 ++++++------- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h b/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h index 78081a62125..4644cd9d4ef 100644 --- a/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -289,8 +289,8 @@ private: double m_omega_H; /** Controling the smoothness of the medial approximation. */ double m_omega_P; - /** Edges with length less than `min_edge_length` will be collapsed. */ - double m_min_edge_length; + /** Edges with length less than `max_edge_length` will be collapsed. */ + double m_max_edge_length; /** Triangles with angle greater than `alpha_TH` will be split. */ double m_alpha_TH; /** Value very close to zero. */ @@ -356,7 +356,7 @@ double diagonal_length(const Bbox_3& bbox) } -double init_min_edge_length() +double init_max_edge_length() { vertex_iterator vb, ve; boost::tie(vb, ve) = vertices(m_tmesh); @@ -382,7 +382,7 @@ public: * - `area_variation_factor() == 0.0001` * - `max_iterations() == 500` * - `is_medially_centered() == true` - * - `min_edge_length()` == 0.002 * the length of the diagonal of the bounding box of `tmesh` + * - `max_edge_length()` == 0.002 * the length of the diagonal of the bounding box of `tmesh` * * @pre `tmesh` is a triangulated surface mesh without borders and has exactly one connected component. * @param tmesh @@ -424,10 +424,10 @@ public: } /// During the local remeshing step, an edge will be split - /// if it is longer than `min_edge_length()`. - double min_edge_length() + /// if it is longer than `max_edge_length()`. + double max_edge_length() { - return m_min_edge_length; + return m_max_edge_length; } void set_max_triangle_angle(double value) @@ -435,9 +435,9 @@ public: m_alpha_TH = value; } - void set_min_edge_length(double value) + void set_max_edge_length(double value) { - m_min_edge_length = value; + m_max_edge_length = value; } /// @} @@ -679,7 +679,7 @@ public: } /** - * Collapses edges of the meso-skeleton with length less than `min_edge_length()` and returns the number of edges collapsed. + * Collapses edges of the meso-skeleton with length less than `max_edge_length()` and returns the number of edges collapsed. */ std::size_t collapse_edges() { @@ -864,7 +864,7 @@ private: m_delta_area = 0.0001; m_max_iterations = 500; m_is_medially_centered = true; - m_min_edge_length = init_min_edge_length(); + m_max_edge_length = init_max_edge_length(); m_alpha_TH = 110 * (CGAL_PI / 180.0); m_zero_TH = 1e-7; } @@ -1104,10 +1104,10 @@ private: vertex_descriptor vi = source(h, m_tmesh); vertex_descriptor vj = target(h, m_tmesh); - /// \todo do not use sqrt but square m_min_edge_length + /// \todo do not use sqrt but square m_max_edge_length double edge_length = sqrt(squared_distance(get(m_tmesh_point_pmap, vi), get(m_tmesh_point_pmap, vj))); - if (internal::is_collapse_ok(m_tmesh, h) && edge_length < m_min_edge_length) + if (internal::is_collapse_ok(m_tmesh, h) && edge_length < m_max_edge_length) { Point p = midpoint( get(vertex_point, m_tmesh, source(h, m_tmesh)), @@ -1310,7 +1310,7 @@ private: if (m_is_vertex_fixed_map.find(idx) == m_is_vertex_fixed_map.end()) { bool willbefixed = internal::is_vertex_degenerate(m_tmesh, m_tmesh_point_pmap, - v, m_min_edge_length); + v, m_max_edge_length); if (willbefixed) { m_is_vertex_fixed_map[idx] = willbefixed; @@ -1329,7 +1329,7 @@ private: std::size_t detect_degeneracies_heuristic() { std::size_t num_fixed = 0; - double elength_fixed = m_min_edge_length; + double elength_fixed = m_max_edge_length; BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh)) { diff --git a/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Detect_degeneracy.h b/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Detect_degeneracy.h index 25c50454b08..a8e39c39dae 100644 --- a/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Detect_degeneracy.h +++ b/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Detect_degeneracy.h @@ -46,13 +46,13 @@ namespace internal { * @param hg the mesh containing the given vertex * @param root the given vertex -* @param min_edge_length the diameter of the geodesic disk +* @param max_edge_length the diameter of the geodesic disk */ template bool is_vertex_degenerate(TriangleMesh& hg, TriangleMeshPointPMap& hg_point_pmap, typename boost::graph_traits::vertex_descriptor root, - double min_edge_length) + double max_edge_length) { typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -64,7 +64,7 @@ bool is_vertex_degenerate(TriangleMesh& hg, std::set faces_in_disk; vertices_in_disk.clear(); - search_vertices_in_disk(hg, hg_point_pmap, root, vertices_in_disk, min_edge_length); + search_vertices_in_disk(hg, hg_point_pmap, root, vertices_in_disk, max_edge_length); BOOST_FOREACH(vertex_descriptor vd, vertices_in_disk) { @@ -114,14 +114,14 @@ bool is_vertex_degenerate(TriangleMesh& hg, * @param hg the mesh containing the vertices * @param root the center of the geodesic disk * @param vertices_in_disk containing the found vertices within the disk -* @param min_edge_length the diameter of the geodesic disk +* @param max_edge_length the diameter of the geodesic disk */ template void search_vertices_in_disk(TriangleMesh& hg, TriangleMeshPointPMap& hg_point_pmap, typename boost::graph_traits::vertex_descriptor root, std::set::vertex_descriptor>& vertices_in_disk, - double min_edge_length) + double max_edge_length) { typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -134,7 +134,7 @@ void search_vertices_in_disk(TriangleMesh& hg, vertices_in_disk.insert(root); vertex_visited[root] = true; - double dist_TH = min_edge_length; + double dist_TH = max_edge_length; while (!Q.empty()) { vertex_descriptor v = Q.front(); diff --git a/Mean_curvature_skeleton/test/Mean_curvature_skeleton/MCF_Skeleton_test.cpp b/Mean_curvature_skeleton/test/Mean_curvature_skeleton/MCF_Skeleton_test.cpp index 20ed42d7a43..699286e6855 100644 --- a/Mean_curvature_skeleton/test/Mean_curvature_skeleton/MCF_Skeleton_test.cpp +++ b/Mean_curvature_skeleton/test/Mean_curvature_skeleton/MCF_Skeleton_test.cpp @@ -100,10 +100,10 @@ int main() return EXIT_FAILURE; } - double min_edge_length = 0.002; - mcs->set_min_edge_length(min_edge_length); - value = mcs->min_edge_length(); - if (!check_value_equal(min_edge_length, value)) + double max_edge_length = 0.002; + mcs->set_max_edge_length(max_edge_length); + value = mcs->max_edge_length(); + if (!check_value_equal(max_edge_length, value)) { return EXIT_FAILURE; } diff --git a/Polyhedron/demo/Polyhedron/Mean_curvature_flow_skeleton_plugin.ui b/Polyhedron/demo/Polyhedron/Mean_curvature_flow_skeleton_plugin.ui index e266aa78ff1..f85167f20d1 100644 --- a/Polyhedron/demo/Polyhedron/Mean_curvature_flow_skeleton_plugin.ui +++ b/Polyhedron/demo/Polyhedron/Mean_curvature_flow_skeleton_plugin.ui @@ -66,14 +66,14 @@ - + - min_edge_length + max_edge_length - + @@ -162,9 +162,9 @@ omega_H - min_edge_length + max_edge_length label_omega_H - label_min_edge_length + label_max_edge_length pushButton_contract pushButton_collapse pushButton_split diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp index 067f5c9a058..05a9f403eab 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp @@ -139,9 +139,9 @@ public: ui->omega_P->setValue(0.2); ui->omega_P->setSingleStep(0.1); ui->omega_P->setDecimals(3); - ui->min_edge_length->setDecimals(7); - ui->min_edge_length->setValue(0.002 * diag); - ui->min_edge_length->setSingleStep(0.0000001); + ui->max_edge_length->setDecimals(7); + ui->max_edge_length->setValue(0.002 * diag); + ui->max_edge_length->setSingleStep(0.0000001); ui->delta_area->setDecimals(7); ui->delta_area->setValue(1e-4); ui->delta_area->setSingleStep(1e-5); @@ -210,7 +210,7 @@ public: bool check_mesh(Scene_polyhedron_item* item) { double omega_H = ui->omega_H->value(); double omega_P = ui->omega_P->value(); - double min_edge_length = ui->min_edge_length->value(); + double max_edge_length = ui->max_edge_length->value(); double delta_area = ui->delta_area->value(); bool is_medially_centered = ui->is_medially_centered->isChecked(); @@ -229,7 +229,7 @@ public: //set algorithm parameters mcs->set_quality_speed_tradeoff(omega_H); mcs->set_medially_centered_speed_tradeoff(omega_P); - mcs->set_min_edge_length(min_edge_length); + mcs->set_max_edge_length(max_edge_length); mcs->set_is_medially_centered(is_medially_centered); mcs->set_area_variation_factor(delta_area); @@ -263,7 +263,7 @@ public: //set algorithm parameters mcs->set_quality_speed_tradeoff(omega_H); mcs->set_medially_centered_speed_tradeoff(omega_P); - mcs->set_min_edge_length(min_edge_length); + mcs->set_max_edge_length(max_edge_length); mcs->set_is_medially_centered(is_medially_centered); mcs->set_area_variation_factor(delta_area); @@ -284,7 +284,7 @@ public: { mcs->set_quality_speed_tradeoff(omega_H); mcs->set_medially_centered_speed_tradeoff(omega_P); - mcs->set_min_edge_length(min_edge_length); + mcs->set_max_edge_length(max_edge_length); mcs->set_area_variation_factor(delta_area); mcs->set_is_medially_centered(is_medially_centered); } @@ -303,13 +303,13 @@ public: { double omega_H = ui->omega_H->value(); double omega_P = ui->omega_P->value(); - double min_edge_length = ui->min_edge_length->value(); + double max_edge_length = ui->max_edge_length->value(); double delta_area = ui->delta_area->value(); bool is_medially_centered = ui->is_medially_centered->isChecked(); mcs->set_quality_speed_tradeoff(omega_H); mcs->set_medially_centered_speed_tradeoff(omega_P); - mcs->set_min_edge_length(min_edge_length); + mcs->set_max_edge_length(max_edge_length); mcs->set_area_variation_factor(delta_area); mcs->set_is_medially_centered(is_medially_centered); } @@ -402,7 +402,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionMCFSkeleton_t void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionUpdateBBox() { double diag = scene->len_diagonal(); - ui->min_edge_length->setValue(0.002 * diag); + ui->max_edge_length->setValue(0.002 * diag); } void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment()