From 1f3716292673a56413d3501b4b98b54416d193ed Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 22 Mar 2018 10:10:08 +0000 Subject: code review : Rename Radius_distance Minimal_enclosing_ball_radius git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3304 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 204aa7a7098773b2d290e35a12a1c92449743d7d --- .../benchmark/cech_complex_benchmark.cpp | 32 ++++++++++++---------- .../example/cech_complex_step_by_step.cpp | 4 +-- src/Cech_complex/include/gudhi/Cech_complex.h | 11 ++++---- .../include/gudhi/Cech_complex_blocker.h | 4 +-- src/Cech_complex/test/test_cech_complex.cpp | 4 +-- src/common/include/gudhi/distance_functions.h | 8 +++--- 6 files changed, 34 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp index 6ba52419..2fa255ed 100644 --- a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp +++ b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp @@ -46,7 +46,7 @@ using Rips_complex = Gudhi::rips_complex::Rips_complex; using Cech_complex = Gudhi::cech_complex::Cech_complex; -class Radius_distance { +class Minimal_enclosing_ball_radius { public: // boost::range_value is not SFINAE-friendly so we cannot use it in the return type template< typename Point > @@ -80,24 +80,26 @@ int main(int argc, char * argv[]) { Gudhi::Clock euclidean_clock("Gudhi::Euclidean_distance"); // Compute the proximity graph of the points Proximity_graph euclidean_prox_graph = Gudhi::compute_proximity_graph(off_reader.get_point_cloud(), - threshold, - Gudhi::Euclidean_distance()); + threshold, + Gudhi::Euclidean_distance()); std::cout << euclidean_clock << std::endl; - Gudhi::Clock radius_clock("Radius_distance"); + Gudhi::Clock miniball_clock("Minimal_enclosing_ball_radius"); // Compute the proximity graph of the points - Proximity_graph radius_prox_graph = Gudhi::compute_proximity_graph(off_reader.get_point_cloud(), - threshold, - Radius_distance()); - std::cout << radius_clock << std::endl; + Proximity_graph miniball_prox_graph = + Gudhi::compute_proximity_graph(off_reader.get_point_cloud(), + threshold, + Minimal_enclosing_ball_radius()); + std::cout << miniball_clock << std::endl; - Gudhi::Clock common_radius_clock("Gudhi::Radius_distance()"); + Gudhi::Clock common_miniball_clock("Gudhi::Minimal_enclosing_ball_radius()"); // Compute the proximity graph of the points - Proximity_graph sq_radius_prox_graph = Gudhi::compute_proximity_graph(off_reader.get_point_cloud(), - threshold, - Gudhi::Radius_distance()); - std::cout << common_radius_clock << std::endl; + Proximity_graph common_miniball_prox_graph = + Gudhi::compute_proximity_graph(off_reader.get_point_cloud(), + threshold, + Gudhi::Minimal_enclosing_ball_radius()); + std::cout << common_miniball_clock << std::endl; boost::filesystem::path full_path(boost::filesystem::current_path()); @@ -121,7 +123,9 @@ int main(int argc, char * argv[]) { std::cout << itr->path().stem() << ";"; std::cout << radius << ";"; Gudhi::Clock rips_clock("Rips computation"); - Rips_complex rips_complex_from_points(off_reader.get_point_cloud(), radius, Gudhi::Radius_distance()); + Rips_complex rips_complex_from_points(off_reader.get_point_cloud(), + radius, + Gudhi::Minimal_enclosing_ball_radius()); Simplex_tree rips_stree; rips_complex_from_points.create_complex(rips_stree, p0.size() - 1); // ------------------------------------------ diff --git a/src/Cech_complex/example/cech_complex_step_by_step.cpp b/src/Cech_complex/example/cech_complex_step_by_step.cpp index 0e7c4bbd..760b53dc 100644 --- a/src/Cech_complex/example/cech_complex_step_by_step.cpp +++ b/src/Cech_complex/example/cech_complex_step_by_step.cpp @@ -65,7 +65,7 @@ class Cech_blocker { std::cout << "#(" << vertex << ")#"; #endif // DEBUG_TRACES } - Filtration_value radius = Gudhi::Radius_distance()(points); + Filtration_value radius = Gudhi::Minimal_enclosing_ball_radius()(points); #ifdef DEBUG_TRACES std::cout << "radius = " << radius << " - " << (radius > max_radius_) << std::endl; #endif // DEBUG_TRACES @@ -105,7 +105,7 @@ int main(int argc, char * argv[]) { // Compute the proximity graph of the points Proximity_graph prox_graph = Gudhi::compute_proximity_graph(off_reader.get_point_cloud(), max_radius, - Gudhi::Radius_distance()); + Gudhi::Minimal_enclosing_ball_radius()); // Construct the Rips complex in a Simplex Tree Simplex_tree st; diff --git a/src/Cech_complex/include/gudhi/Cech_complex.h b/src/Cech_complex/include/gudhi/Cech_complex.h index 612c73c3..8b1a9221 100644 --- a/src/Cech_complex/include/gudhi/Cech_complex.h +++ b/src/Cech_complex/include/gudhi/Cech_complex.h @@ -23,7 +23,7 @@ #ifndef CECH_COMPLEX_H_ #define CECH_COMPLEX_H_ -#include // for Gudhi::Radius_distance +#include // for Gudhi::Minimal_enclosing_ball_radius #include // for Gudhi::Proximity_graph #include // for GUDHI_CHECK #include // for Gudhi::cech_complex::Cech_blocker @@ -43,7 +43,7 @@ namespace cech_complex { * * \details * The data structure is a proximity graph, containing edges when the edge length is less or equal - * to a given max_radius. Edge length is computed from `Gudhi::Radius_distance` distance function. + * to a given max_radius. Edge length is computed from `Gudhi::Minimal_enclosing_ball_radius` distance function. * * \tparam SimplicialComplexForProximityGraph furnishes `Vertex_handle` and `Filtration_value` type definition required * by `Gudhi::Proximity_graph`. @@ -71,9 +71,10 @@ class Cech_complex { Cech_complex(const ForwardPointRange& points, Filtration_value max_radius) : max_radius_(max_radius), point_cloud_(points) { - cech_skeleton_graph_ = Gudhi::compute_proximity_graph(point_cloud_, - max_radius_, - Gudhi::Radius_distance()); + cech_skeleton_graph_ = + Gudhi::compute_proximity_graph(point_cloud_, + max_radius_, + Gudhi::Minimal_enclosing_ball_radius()); } /** \brief Initializes the simplicial complex from the proximity graph and expands it until a given maximal diff --git a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h index 5ba17c51..c082815d 100644 --- a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h +++ b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h @@ -24,7 +24,7 @@ #define CECH_COMPLEX_BLOCKER_H_ #include // Cech_blocker is using a pointer on Gudhi::cech_complex::Cech_complex -#include // for Gudhi::Radius_distance +#include // for Gudhi::Minimal_enclosing_ball_radius #include #include @@ -75,7 +75,7 @@ class Cech_blocker { std::cout << "#(" << vertex << ")#"; #endif // DEBUG_TRACES } - Filtration_value radius = Gudhi::Radius_distance()(points); + Filtration_value radius = Gudhi::Minimal_enclosing_ball_radius()(points); #ifdef DEBUG_TRACES if (radius > cc_ptr_->max_radius()) std::cout << "radius > max_radius => expansion is blocked\n"; diff --git a/src/Cech_complex/test/test_cech_complex.cpp b/src/Cech_complex/test/test_cech_complex.cpp index 4aa85057..8658729b 100644 --- a/src/Cech_complex/test/test_cech_complex.cpp +++ b/src/Cech_complex/test/test_cech_complex.cpp @@ -111,10 +111,10 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) { std::cout << vertex << ","; vp.push_back(points.at(vertex)); } - std::cout << ") - distance =" << Gudhi::Radius_distance()(vp.at(0), vp.at(1)) << + std::cout << ") - distance =" << Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1)) << " - filtration =" << st.filtration(f_simplex) << std::endl; BOOST_CHECK(vp.size() == 2); - GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), Gudhi::Radius_distance()(vp.at(0), vp.at(1))); + GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1))); } } diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h index 93956a69..429a5fa7 100644 --- a/src/common/include/gudhi/distance_functions.h +++ b/src/common/include/gudhi/distance_functions.h @@ -70,9 +70,9 @@ class Euclidean_distance { } }; -/** @brief Compute the squared radius between Points given by a range of coordinates. The points are assumed to - * have the same dimension. */ -class Radius_distance { +/** @brief Compute the radius of the minimal enclosing ball between Points given by a range of coordinates. + * The points are assumed to have the same dimension. */ +class Minimal_enclosing_ball_radius { public: // boost::range_value is not SFINAE-friendly so we cannot use it in the return type template< typename Point > @@ -92,7 +92,7 @@ class Radius_distance { Min_sphere ms(point_cloud.begin()->end() - point_cloud.begin()->begin(), point_cloud.begin(),point_cloud.end()); #ifdef DEBUG_TRACES - std::cout << "Radius_distance = " << std::sqrt(ms.squared_radius()) << " | nb points = " + std::cout << "Minimal_enclosing_ball_radius = " << std::sqrt(ms.squared_radius()) << " | nb points = " << point_cloud.end() - point_cloud.begin() << " | dimension = " << point_cloud.begin()->end() - point_cloud.begin()->begin() << std::endl; #endif // DEBUG_TRACES -- cgit v1.2.3