From be73897dd4288a66dad29c2b8331c35dcc6aeebd Mon Sep 17 00:00:00 2001 From: glisse Date: Sat, 17 Nov 2018 16:57:38 +0000 Subject: Make it clearer that create_complex can/should be called without a second argument. Move the test restricting propagation to dim>1 earlier. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/AC-glisse@4000 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 108a3ce1b96e097d5218f9154c7f17c13203cfa1 --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 73 +++++++++++-------------- 1 file changed, 33 insertions(+), 40 deletions(-) (limited to 'src/Alpha_complex/include/gudhi/Alpha_complex.h') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 4c07eddb..38fb6772 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -228,11 +228,6 @@ class Alpha_complex { } public: - template - bool create_complex(SimplicialComplexForAlpha& complex) { - typedef typename SimplicialComplexForAlpha::Filtration_value Filtration_value; - return create_complex(complex, std::numeric_limits::infinity()); - } /** \brief Inserts all Delaunay triangulation into the simplicial complex. * It also computes the filtration values accordingly to the \ref createcomplexalgorithm @@ -240,7 +235,7 @@ class Alpha_complex { * \tparam SimplicialComplexForAlpha must meet `SimplicialComplexForAlpha` concept. * * @param[in] complex SimplicialComplexForAlpha to be created. - * @param[in] max_alpha_square maximum for alpha square value. Default value is +\f$\infty\f$. + * @param[in] max_alpha_square maximum for alpha square value. Default value is +\f$\infty\f$, and there is very little point using anything else since it does not save time. * * @return true if creation succeeds, false otherwise. * @@ -249,8 +244,8 @@ class Alpha_complex { * * Initialization can be launched once. */ - template - bool create_complex(SimplicialComplexForAlpha& complex, Filtration_value max_alpha_square) { + template + bool create_complex(SimplicialComplexForAlpha& complex, Filtration_value max_alpha_square = std::numeric_limits::infinity()) { // From SimplicialComplexForAlpha type required to insert into a simplicial complex (with or without subfaces). typedef typename SimplicialComplexForAlpha::Vertex_handle Vertex_handle; typedef typename SimplicialComplexForAlpha::Simplex_handle Simplex_handle; @@ -333,7 +328,9 @@ class Alpha_complex { std::cout << "filt(Sigma) is NaN : filt(Sigma) =" << complex.filtration(f_simplex) << std::endl; #endif // DEBUG_TRACES } - propagate_alpha_filtration(complex, f_simplex, decr_dim); + // No need to propagate further, unweighted points all have value 0 + if (decr_dim > 1) + propagate_alpha_filtration(complex, f_simplex, decr_dim); } } } @@ -379,46 +376,42 @@ class Alpha_complex { #endif // DEBUG_TRACES // ### Else } else { - // No need to compute is_gabriel for dimension <= 2 - // i.e. : Sigma = (3,1) => Tau = 1 - if (decr_dim > 1) { - // insert the Tau points in a vector for is_gabriel function - Vector_of_CGAL_points pointVector; + // insert the Tau points in a vector for is_gabriel function + Vector_of_CGAL_points pointVector; #ifdef DEBUG_TRACES - Vertex_handle vertexForGabriel = Vertex_handle(); + Vertex_handle vertexForGabriel = Vertex_handle(); #endif // DEBUG_TRACES - for (auto vertex : complex.simplex_vertex_range(f_boundary)) { - pointVector.push_back(get_point(vertex)); - } - // Retrieve the Sigma point that is not part of Tau - parameter for is_gabriel function - Point_d point_for_gabriel; - for (auto vertex : complex.simplex_vertex_range(f_simplex)) { - point_for_gabriel = get_point(vertex); - if (std::find(pointVector.begin(), pointVector.end(), point_for_gabriel) == pointVector.end()) { + for (auto vertex : complex.simplex_vertex_range(f_boundary)) { + pointVector.push_back(get_point(vertex)); + } + // Retrieve the Sigma point that is not part of Tau - parameter for is_gabriel function + Point_d point_for_gabriel; + for (auto vertex : complex.simplex_vertex_range(f_simplex)) { + point_for_gabriel = get_point(vertex); + if (std::find(pointVector.begin(), pointVector.end(), point_for_gabriel) == pointVector.end()) { #ifdef DEBUG_TRACES - // vertex is not found in Tau - vertexForGabriel = vertex; + // vertex is not found in Tau + vertexForGabriel = vertex; #endif // DEBUG_TRACES - // No need to continue loop - break; - } + // No need to continue loop + break; } - // is_gabriel function initialization - Is_Gabriel is_gabriel = kernel_.side_of_bounded_sphere_d_object(); - bool is_gab = is_gabriel(pointVector.begin(), pointVector.end(), point_for_gabriel) - != CGAL::ON_BOUNDED_SIDE; + } + // is_gabriel function initialization + Is_Gabriel is_gabriel = kernel_.side_of_bounded_sphere_d_object(); + bool is_gab = is_gabriel(pointVector.begin(), pointVector.end(), point_for_gabriel) + != CGAL::ON_BOUNDED_SIDE; #ifdef DEBUG_TRACES - std::cout << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl; + std::cout << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl; #endif // DEBUG_TRACES - // ### If Tau is not Gabriel of Sigma - if (false == is_gab) { - // ### filt(Tau) = filt(Sigma) - Filtration_value alpha_complex_filtration = complex.filtration(f_simplex); - complex.assign_filtration(f_boundary, alpha_complex_filtration); + // ### If Tau is not Gabriel of Sigma + if (false == is_gab) { + // ### filt(Tau) = filt(Sigma) + Filtration_value alpha_complex_filtration = complex.filtration(f_simplex); + complex.assign_filtration(f_boundary, alpha_complex_filtration); #ifdef DEBUG_TRACES - std::cout << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl; + std::cout << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl; #endif // DEBUG_TRACES - } } } } -- cgit v1.2.3