diff options
Diffstat (limited to 'src/Cech_complex/example/cech_complex_step_by_step.cpp')
-rw-r--r-- | src/Cech_complex/example/cech_complex_step_by_step.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
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 f59f0293..c8dd1585 100644 --- a/src/Cech_complex/example/cech_complex_step_by_step.cpp +++ b/src/Cech_complex/example/cech_complex_step_by_step.cpp @@ -9,11 +9,11 @@ */ #include <gudhi/graph_simplicial_complex.h> -#include <gudhi/distance_functions.h> +#include <gudhi/Cech_complex/Cech_kernel.h> #include <gudhi/Simplex_tree.h> #include <gudhi/Points_off_io.h> -#include <gudhi/Miniball.hpp> +#include <CGAL/Epeck_d.h> #include <boost/program_options.hpp> @@ -24,9 +24,9 @@ #include <map> // ---------------------------------------------------------------------------- -// rips_persistence_step_by_step is an example of each step that is required to -// build a Rips over a Simplex_tree. Please refer to rips_persistence to see -// how to do the same thing with the Rips_complex wrapper for less detailed +// cech_complex_step_by_step is an example of each step that is required to +// build a Cech over a Simplex_tree. Please refer to cech_complex_example_from_points to see +// how to do the same thing with the Cech complex wrapper for less detailed // steps. // ---------------------------------------------------------------------------- @@ -34,16 +34,14 @@ using Simplex_tree = Gudhi::Simplex_tree<>; using Simplex_handle = Simplex_tree::Simplex_handle; using Filtration_value = Simplex_tree::Filtration_value; -using Point = std::vector<double>; +using Kernel = CGAL::Epeck_d<CGAL::Dynamic_dimension_tag>; +using Point = typename Kernel::Point_d; using Points_off_reader = Gudhi::Points_off_reader<Point>; using Proximity_graph = Gudhi::Proximity_graph<Simplex_tree>; class Cech_blocker { private: using Point_cloud = std::vector<Point>; - using Point_iterator = Point_cloud::const_iterator; - using Coordinate_iterator = Point::const_iterator; - using Min_sphere = Gudhi::Miniball::Miniball<Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>; public: bool operator()(Simplex_handle sh) { @@ -54,7 +52,7 @@ class Cech_blocker { std::clog << "#(" << vertex << ")#"; #endif // DEBUG_TRACES } - Filtration_value radius = Gudhi::Minimal_enclosing_ball_radius()(points); + Filtration_value radius = Gudhi::Minimal_enclosing_ball_radius<Kernel>()(points); #ifdef DEBUG_TRACES std::clog << "radius = " << radius << " - " << (radius > max_radius_) << std::endl; #endif // DEBUG_TRACES @@ -63,14 +61,12 @@ class Cech_blocker { } Cech_blocker(Simplex_tree& simplex_tree, Filtration_value max_radius, const std::vector<Point>& point_cloud) : simplex_tree_(simplex_tree), max_radius_(max_radius), point_cloud_(point_cloud) { - dimension_ = point_cloud_[0].size(); } private: Simplex_tree simplex_tree_; Filtration_value max_radius_; std::vector<Point> point_cloud_; - int dimension_; }; void program_options(int argc, char* argv[], std::string& off_file_points, Filtration_value& max_radius, int& dim_max); @@ -87,9 +83,9 @@ int main(int argc, char* argv[]) { // Compute the proximity graph of the points Proximity_graph prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(), max_radius, - Gudhi::Minimal_enclosing_ball_radius()); + Gudhi::Minimal_enclosing_ball_radius<Kernel>()); - // Construct the Rips complex in a Simplex Tree + // Construct the Cech complex in a Simplex Tree Simplex_tree st; // insert the proximity graph in the simplex tree st.insert_graph(prox_graph); @@ -129,9 +125,9 @@ void program_options(int argc, char* argv[], std::string& off_file_points, Filtr visible.add_options()("help,h", "produce help message")( "max-radius,r", po::value<Filtration_value>(&max_radius)->default_value(std::numeric_limits<Filtration_value>::infinity()), - "Maximal length of an edge for the Rips complex construction.")( + "Maximal length of an edge for the Cech complex construction.")( "cpx-dimension,d", po::value<int>(&dim_max)->default_value(1), - "Maximal dimension of the Rips complex we want to compute."); + "Maximal dimension of the Cech complex we want to compute."); po::positional_options_description pos; pos.add("input-file", 1); |