diff options
Diffstat (limited to 'src/Cech_complex/example/cech_complex_example_from_points.cpp')
-rw-r--r-- | src/Cech_complex/example/cech_complex_example_from_points.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/Cech_complex/example/cech_complex_example_from_points.cpp b/src/Cech_complex/example/cech_complex_example_from_points.cpp index 3cc5a4df..ef9071ec 100644 --- a/src/Cech_complex/example/cech_complex_example_from_points.cpp +++ b/src/Cech_complex/example/cech_complex_example_from_points.cpp @@ -1,30 +1,33 @@ #include <gudhi/Cech_complex.h> #include <gudhi/Simplex_tree.h> +#include <CGAL/Epeck_d.h> // For EXACT or SAFE version + #include <iostream> #include <string> #include <vector> -#include <array> int main() { // Type definitions - using Point_cloud = std::vector<std::array<double, 2>>; using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>; using Filtration_value = Simplex_tree::Filtration_value; - using Cech_complex = Gudhi::cech_complex::Cech_complex<Simplex_tree, Point_cloud>; + using Kernel = CGAL::Epeck_d<CGAL::Dimension_tag<2>>; + using Point = typename Kernel::Point_d; + using Point_cloud = std::vector<Point>; + using Cech_complex = Gudhi::cech_complex::Cech_complex<Kernel, Simplex_tree>; Point_cloud points; - points.push_back({1., 0.}); // 0 - points.push_back({0., 1.}); // 1 - points.push_back({2., 1.}); // 2 - points.push_back({3., 2.}); // 3 - points.push_back({0., 3.}); // 4 - points.push_back({3. + std::sqrt(3.), 3.}); // 5 - points.push_back({1., 4.}); // 6 - points.push_back({3., 4.}); // 7 - points.push_back({2., 4. + std::sqrt(3.)}); // 8 - points.push_back({0., 4.}); // 9 - points.push_back({-0.5, 2.}); // 10 + points.emplace_back(1., 0.); // 0 + points.emplace_back(0., 1.); // 1 + points.emplace_back(2., 1.); // 2 + points.emplace_back(3., 2.); // 3 + points.emplace_back(0., 3.); // 4 + points.emplace_back(3. + std::sqrt(3.), 3.); // 5 + points.emplace_back(1., 4.); // 6 + points.emplace_back(3., 4.); // 7 + points.emplace_back(2., 4. + std::sqrt(3.)); // 8 + points.emplace_back(0., 4.); // 9 + points.emplace_back(-0.5, 2.); // 10 // ---------------------------------------------------------------------------- // Init of a Cech complex from points @@ -37,18 +40,18 @@ int main() { // ---------------------------------------------------------------------------- // Display information about the one skeleton Cech complex // ---------------------------------------------------------------------------- - std::cout << "Cech complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " + std::clog << "Cech complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on Cech complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on Cech complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : stree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " + std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << std::endl; } return 0; } |