summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-09-14 17:27:40 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-09-14 17:27:40 +0200
commitde39546182c20a69e45aa07830351f6e9d2e4b84 (patch)
tree99975f0a612d79b3bc86c411160ee7442a269262
parent5e3871c2d99249bd7560faa4e1229d3b3751b0ff (diff)
Add but comment a test to compare dD and 3D alpha complex
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h2
-rw-r--r--src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp79
2 files changed, 78 insertions, 3 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index 00231e1c..e1aae2d4 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -267,8 +267,6 @@ class Alpha_complex {
// Save index value as data to retrieve it after insertion
pos->data() = index;
hint = pos->full_cell();
- } else {
- std::cout << "NULLPTR" << std::endl;
}
}
// --------------------------------------------------------------------------------------------
diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp
index 57a57058..bf659ef7 100644
--- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp
+++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp
@@ -79,4 +79,81 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kerne
}
BOOST_CHECK(zw_simplex == simplex);
-} \ No newline at end of file
+}
+
+template <typename Point_d>
+bool cgal_3d_point_sort (Point_d a,Point_d b) {
+ if (a[0] != b[0])
+ return a[0] < b[0];
+ if (a[1] != b[1])
+ return a[1] < b[1];
+ return a[2] < b[2];
+}
+
+/*BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) {
+ // Random points construction
+ using Kernel_dD = CGAL::Epeck_d< CGAL::Dimension_tag<3> >;
+ using Bare_point_d = typename Kernel_dD::Point_d;
+ using Weighted_point_d = typename Kernel_dD::Weighted_point_d;
+ std::vector<Weighted_point_d> w_points_d;
+
+ using Exact_weighted_alpha_complex_3d =
+ Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::EXACT, true, false>;
+ using Bare_point_3 = typename Exact_weighted_alpha_complex_3d::Bare_point_3;
+ using Weighted_point_3 = typename Exact_weighted_alpha_complex_3d::Weighted_point_3;
+ std::vector<Weighted_point_3> w_points_3;
+
+ std::uniform_real_distribution<double> rd_pts(-10., 10.);
+ std::uniform_real_distribution<double> rd_wghts(-0.5, 0.5);
+ std::random_device rand_dev;
+ std::mt19937 rand_engine(rand_dev());
+ for (int idx = 0; idx < 20; idx++) {
+ std::vector<double> point {rd_pts(rand_engine), rd_pts(rand_engine), rd_pts(rand_engine)};
+ double weight = rd_wghts(rand_engine);
+ w_points_d.emplace_back(Weighted_point_d(Bare_point_d(point.begin(), point.end()), weight));
+ w_points_3.emplace_back(Weighted_point_3(Bare_point_3(point[0], point[1], point[2]), weight));
+ }
+
+ // Weighted alpha complex for dD version
+ Gudhi::alpha_complex::Alpha_complex<Kernel_dD, true> alpha_complex_dD_from_weighted_points(w_points_d);
+ Gudhi::Simplex_tree<> w_simplex_d;
+ BOOST_CHECK(alpha_complex_dD_from_weighted_points.create_complex(w_simplex_d));
+
+ std::clog << "Iterator on weighted alpha complex dD simplices in the filtration order, with [filtration value]:" << std::endl;
+ for (auto f_simplex : w_simplex_d.filtration_simplex_range()) {
+ std::clog << " ( ";
+ std::vector<Bare_point_d> points;
+ for (auto vertex : w_simplex_d.simplex_vertex_range(f_simplex)) {
+ points.emplace_back(alpha_complex_dD_from_weighted_points.get_point(vertex).point());
+ }
+ std::sort (points.begin(), points.end(), cgal_3d_point_sort<Bare_point_d>);
+ for (auto point : points) {
+ std::clog << point[0] << " " << point[1] << " " << point[2] << " | ";
+ }
+ std::clog << ") -> " << "[" << w_simplex_d.filtration(f_simplex) << "] ";
+ std::clog << std::endl;
+ }
+
+ // Weighted alpha complex for 3D version
+ Exact_weighted_alpha_complex_3d alpha_complex_3D_from_weighted_points(w_points_3);
+ Gudhi::Simplex_tree<> w_simplex_3;
+ BOOST_CHECK(alpha_complex_3D_from_weighted_points.create_complex(w_simplex_3));
+
+ std::clog << "Iterator on weighted alpha complex 3D simplices in the filtration order, with [filtration value]:" << std::endl;
+ for (auto f_simplex : w_simplex_3.filtration_simplex_range()) {
+ std::clog << " ( ";
+ std::vector<Bare_point_3> points;
+ for (auto vertex : w_simplex_3.simplex_vertex_range(f_simplex)) {
+ points.emplace_back(alpha_complex_3D_from_weighted_points.get_point(vertex).point());
+ }
+ std::sort (points.begin(), points.end());
+ for (auto point : points) {
+ std::clog << point[0] << " " << point[1] << " " << point[2] << " | ";
+ }
+ std::clog << ") -> " << "[" << w_simplex_3.filtration(f_simplex) << "] ";
+ std::clog << std::endl;
+ }
+
+ BOOST_CHECK(w_simplex_d == w_simplex_3);
+
+}*/ \ No newline at end of file