From 9fc5621abbf55da2883a33e53e7d1a18218dc99a Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Nov 2018 14:23:54 +0000 Subject: Doc review : User version bad description for Alpha complex 3d Add a comment for alpha complex 3d example creation for templates Code review : SAFE is now the default version git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3990 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a283cc630ac78634d6700aefb981d130c9464024 --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index 00a47d5c..b441a5b2 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -146,7 +146,7 @@ struct Value_from_iterator { * Duplicate points are inserted once in the Alpha_complex. This is the reason why the vertices may be not contiguous. * * \tparam Complexity shall be `Gudhi::alpha_complex::complexity`. Default value is - * `Gudhi::alpha_complex::complexity::FAST`. + * `Gudhi::alpha_complex::complexity::SAFE`. * * \tparam Weighted Boolean used to set/unset the weighted version of Alpha_complex_3d. Default value is false. * @@ -169,7 +169,7 @@ struct Value_from_iterator { * 3d Delaunay complex. * */ -template +template class Alpha_complex_3d { // Epick = Exact_predicates_inexact_constructions_kernel // Epeck = Exact_predicates_exact_constructions_kernel -- cgit v1.2.3 From 88c9b123f044c8e03c4831a321de760932881195 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Nov 2018 14:40:13 +0000 Subject: Code review : Boost minimal version is now 1.56. No more need to test if < 1.53. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3991 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a38b391f763d9aa0aff7746f3a82ee305386b28e --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index b441a5b2..f2165035 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -26,10 +26,6 @@ #include #include -#if BOOST_VERSION >= 105400 -#include -#endif - #include #include @@ -50,6 +46,8 @@ #include #include +#include + #include #include #include @@ -269,11 +267,7 @@ class Alpha_complex_3d { using Facet = typename Alpha_shape_3::Facet; using Edge = typename Alpha_shape_3::Edge; using Alpha_vertex_handle = typename Alpha_shape_3::Vertex_handle; -#if BOOST_VERSION >= 105400 using Vertex_list = boost::container::static_vector; -#else - using Vertex_list = std::vector; -#endif public: /** \brief Alpha_complex constructor from a list of points. -- cgit v1.2.3 From e2c2bda2f4a501863ea3de4c88d2c56aacbaa27a Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Nov 2018 14:58:50 +0000 Subject: Doc review : "shall be of complexity ***type***" git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3992 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 8ab7645755e3aa0211d39935db6edeb059c05b43 --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index f2165035..d5aa152a 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -143,7 +143,7 @@ struct Value_from_iterator { * Shapes from a range of points (can be read from an OFF file, cf. Points_off_reader). * Duplicate points are inserted once in the Alpha_complex. This is the reason why the vertices may be not contiguous. * - * \tparam Complexity shall be `Gudhi::alpha_complex::complexity`. Default value is + * \tparam Complexity shall be `Gudhi::alpha_complex::complexity` type. Default value is * `Gudhi::alpha_complex::complexity::SAFE`. * * \tparam Weighted Boolean used to set/unset the weighted version of Alpha_complex_3d. Default value is false. -- cgit v1.2.3 From 83b8e026c0ca3171615e7dc760f0cc61cc7ee933 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Nov 2018 15:29:05 +0000 Subject: Code review : Factorize some templates git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3994 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fe719a7bae84c6378bc9dc583de97414e6f8cf74 --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index d5aa152a..95e68b7e 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -114,17 +114,8 @@ struct Value_from_iterator { } }; -template <> -struct Value_from_iterator { - template - static double perform(Iterator it) { - // In EXACT mode, we are with Epeck or Epick with EXACT value set to CGAL::Tag_true. - return CGAL::to_double(it->exact()); - } -}; - -template <> -struct Value_from_iterator { +template +struct Value_from_iterator{ template static double perform(Iterator it) { // In EXACT mode, we are with Epeck or Epick with EXACT value set to CGAL::Tag_true. @@ -190,14 +181,11 @@ class Alpha_complex_3d { template struct Kernel_3 {}; - template - struct Kernel_3 { - using Kernel = Predicates; - }; - template - struct Kernel_3 { + template + struct Kernel_3 { using Kernel = Predicates; }; + template struct Kernel_3 { using Kernel = CGAL::Periodic_3_Delaunay_triangulation_traits_3; -- cgit v1.2.3 From 8e3cb05c8187b8ab8c8fe6622f5d5f605efaed5a Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Nov 2018 15:42:32 +0000 Subject: Doc review : Add a note to explain setting max_alpha_square value won't speed up the complex creation, on the contrary. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3995 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 293e99e3946641f042f862c267baf548b08e53ca --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 3 +++ src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 4c07eddb..5c577c29 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -244,6 +244,9 @@ class Alpha_complex { * * @return true if creation succeeds, false otherwise. * + * @note Setting the max_alpha_square with a smaller value will not accelerate the complex creation. On the contrary + * it will launch SimplicialComplexForAlpha::prune_above_filtration after the complete creation. + * * @pre Delaunay triangulation must be already constructed with dimension strictly greater than 0. * @pre The simplicial complex must be empty (no vertices) * diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index 95e68b7e..9c9bc929 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -437,9 +437,10 @@ class Alpha_complex_3d { * * @return true if creation succeeds, false otherwise. * - * @pre The simplicial complex must be empty (no vertices) + * @note Setting the max_alpha_square with a smaller value will not accelerate the complex creation. On the contrary + * it will launch SimplicialComplexForAlpha3d::prune_above_filtration after the complete creation. * - * Initialization can be launched once. + * @pre The simplicial complex must be empty (no vertices). * */ template Date: Mon, 19 Nov 2018 22:03:05 +0000 Subject: Merge last trunk modifications and remove the note about create_complex max_alpha_square git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@4004 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 64548e4d0674fb5dd07645eee5c63785b099a168 --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 3 --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 6 ++---- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 53216e2f..08db14fb 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -240,9 +240,6 @@ class Alpha_complex { * * @return true if creation succeeds, false otherwise. * - * @note Setting the max_alpha_square with a smaller value will not accelerate the complex creation. On the contrary - * it will launch SimplicialComplexForAlpha::prune_above_filtration after the complete creation. - * * @pre Delaunay triangulation must be already constructed with dimension strictly greater than 0. * @pre The simplicial complex must be empty (no vertices) * diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index 9c9bc929..f40a08f9 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -433,13 +433,11 @@ class Alpha_complex_3d { * \tparam SimplicialComplexForAlpha3d must meet `SimplicialComplexForAlpha3d` concept. * * @param[in] complex SimplicialComplexForAlpha3d 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. * - * @note Setting the max_alpha_square with a smaller value will not accelerate the complex creation. On the contrary - * it will launch SimplicialComplexForAlpha3d::prune_above_filtration after the complete creation. - * * @pre The simplicial complex must be empty (no vertices). * */ -- cgit v1.2.3 From ab6719fb3391569be1231dc9e9dedba5df86c2fd Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 19 Nov 2018 22:38:57 +0000 Subject: Fix compilation issue in debug mode to_double(*it) is also available if *it is a double Bad comment in Value_from_iterator between Epeck and Epick git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@4005 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: cba42be09eeee39a12a6f0adf8ff72f9147f5d1a --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 13 ++----------- src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 15 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index f40a08f9..ca3c5fc3 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -82,16 +82,7 @@ template struct Value_from_iterator { template static double perform(Iterator it) { - // Default behaviour is to return the value pointed by the given iterator - return *it; - } -}; - -template <> -struct Value_from_iterator { - template - static double perform(Iterator it) { - // In SAFE mode, we are with Epick with EXACT value set to CGAL::Tag_true. + // Default behaviour return CGAL::to_double(*it); } }; @@ -118,7 +109,7 @@ template struct Value_from_iterator{ template static double perform(Iterator it) { - // In EXACT mode, we are with Epeck or Epick with EXACT value set to CGAL::Tag_true. + // In EXACT mode, we are with Epeck, or with Epick and EXACT value set to CGAL::Tag_true. return CGAL::to_double(it->exact()); } }; diff --git a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp index 9e071195..b818fb2e 100644 --- a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp @@ -432,13 +432,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic_throw, Weighted_pe wp_variants_type_list) { std::cout << "Weighted periodic alpha complex 3d exception throw" << std::endl; - using Creator = CGAL::Creator_uniform_3; + using Creator = CGAL::Creator_uniform_3; CGAL::Random random(7); - CGAL::Random_points_in_cube_3 in_cube(1, random); - std::vector wp_points; + CGAL::Random_points_in_cube_3 in_cube(1, random); + std::vector wp_points; for (int i = 0; i < 50; i++) { - Weighted_periodic_alpha_complex_3d::Point_3 p = *in_cube++; + typename Weighted_periodic_alpha_complex_3d::Point_3 p = *in_cube++; wp_points.push_back(p); } std::vector p_weights; -- cgit v1.2.3 From eef89bb492169faeb57dfdc65222b6a0483cb7c8 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 21 Nov 2018 08:49:55 +0000 Subject: Code review : Use # error instead of static_assert(false, ...) for CGAL version detection Doc review : Better document CGAL types (FT, Weighted_point_3, Point_3, ...) Weighted alpha complex 3d example simplification git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@4009 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 187d7a08468c96192b3cb82c93a2df5b425290f9 --- .../benchmark/Alpha_complex_3d_benchmark.cpp | 4 +- .../Weighted_alpha_complex_3d_from_points.cpp | 12 +- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 129 ++++++++++++++------- .../test/Alpha_complex_3d_unit_test.cpp | 2 +- src/common/doc/main_page.h | 7 +- 5 files changed, 94 insertions(+), 60 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp b/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp index 96a4baf3..005a712a 100644 --- a/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp +++ b/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp @@ -116,7 +116,7 @@ void benchmark_weighted_points_on_torus_3D(const std::string& msg) { std::vector points_on_torus = Gudhi::generate_points_on_torus_3D(nb_points, 1.0, 0.5); using Point = typename Weighted_alpha_complex_3d::Point_3; - using Weighted_point = typename Weighted_alpha_complex_3d::Triangulation_3::Weighted_point; + using Weighted_point = typename Weighted_alpha_complex_3d::Weighted_point_3; std::vector points; @@ -207,7 +207,7 @@ void benchmark_weighted_periodic_points(const std::string& msg) { << std::endl; using Point = typename Weighted_periodic_alpha_complex_3d::Point_3; - using Weighted_point = typename Weighted_periodic_alpha_complex_3d::Triangulation_3::Weighted_point; + using Weighted_point = typename Weighted_periodic_alpha_complex_3d::Weighted_point_3; std::vector points; for (double i = 0; i < nb_points; i++) { diff --git a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp index 3a69623f..734b4f37 100644 --- a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp +++ b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp @@ -11,21 +11,13 @@ using Weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; using Point = Weighted_alpha_complex_3d::Point_3; -using Weighted_point = Weighted_alpha_complex_3d::Triangulation_3::Weighted_point; -using Vector_of_weighted_points = std::vector; -using Vector_of_weights = std::vector; +using Weighted_point = Weighted_alpha_complex_3d::Weighted_point_3; int main(int argc, char **argv) { - if (argc != 1) { - std::cerr << "Error: Number of arguments (" << argc << ") is not correct\n"; - std::cerr << "Usage: " << (argv[0] - 1) << " \n"; - exit(-1); // ----- >> - } - // ---------------------------------------------------------------------------- // Init of a list of points and weights from a small molecule // ---------------------------------------------------------------------------- - Vector_of_weighted_points weighted_points; + std::vector weighted_points; weighted_points.push_back(Weighted_point(Point(1, -1, -1), 4.)); weighted_points.push_back(Weighted_point(Point(-1, 1, -1), 4.)); weighted_points.push_back(Weighted_point(Point(-1, -1, 1), 4.)); diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index ca3c5fc3..c33b9cf8 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -58,7 +58,7 @@ #if CGAL_VERSION_NR < 1041101000 // Make compilation fail - required for external projects - https://gitlab.inria.fr/GUDHI/gudhi-devel/issues/10 -static_assert(false, "Alpha_complex_3d is only available for CGAL >= 4.11"); +# error Alpha_complex_3d is only available for CGAL >= 4.11 #endif namespace Gudhi { @@ -153,7 +153,7 @@ template ::Kernel; - using Exact_tag = typename std::conditional<(Complexity == complexity::FAST), CGAL::Tag_false, CGAL::Tag_true>::type; + using Exact_alpha_comparison_tag = typename std::conditional<(Complexity == complexity::FAST), CGAL::Tag_false, CGAL::Tag_true>::type; using TdsVb = typename std::conditional, CGAL::Triangulation_ds_vertex_base_3<>>::type; @@ -196,7 +196,7 @@ class Alpha_complex_3d { using Tvb = typename std::conditional, CGAL::Triangulation_vertex_base_3>::type; - using Vb = CGAL::Alpha_shape_vertex_base_3; + using Vb = CGAL::Alpha_shape_vertex_base_3; using TdsCb = typename std::conditional, CGAL::Triangulation_ds_cell_base_3<>>::type; @@ -204,43 +204,84 @@ class Alpha_complex_3d { using Tcb = typename std::conditional, CGAL::Triangulation_cell_base_3>::type; - using Cb = CGAL::Alpha_shape_cell_base_3; + using Cb = CGAL::Alpha_shape_cell_base_3; using Tds = CGAL::Triangulation_data_structure_3; // The other way to do a conditional type. Here there 4 possibilities, cannot use std::conditional template - struct Triangulation {}; + struct Triangulation_3 {}; template - struct Triangulation { - using Triangulation_3 = CGAL::Delaunay_triangulation_3; + struct Triangulation_3 { + using Dt = CGAL::Delaunay_triangulation_3; + using Weighted_point_3 = void; }; template - struct Triangulation { - using Triangulation_3 = CGAL::Regular_triangulation_3; + struct Triangulation_3 { + using Dt = CGAL::Regular_triangulation_3; + using Weighted_point_3 = typename Dt::Weighted_point; }; template - struct Triangulation { - using Triangulation_3 = CGAL::Periodic_3_Delaunay_triangulation_3; + struct Triangulation_3 { + using Dt = CGAL::Periodic_3_Delaunay_triangulation_3; + using Weighted_point_3 = void; }; template - struct Triangulation { - using Triangulation_3 = CGAL::Periodic_3_regular_triangulation_3; + struct Triangulation_3 { + using Dt = CGAL::Periodic_3_regular_triangulation_3; + using Weighted_point_3 = typename Dt::Weighted_point; }; - public: - using Triangulation_3 = typename Triangulation::Triangulation_3; - - using Alpha_shape_3 = CGAL::Alpha_shape_3; + /** \brief Is either Delaunay_triangulation_3 (Weighted = false and Periodic = false), + * Regular_triangulation_3 (Weighted = true and Periodic = false), + * Periodic_3_Delaunay_triangulation_3 (Weighted = false and Periodic = true) + * or Periodic_3_regular_triangulation_3 (Weighted = true and Periodic = true). + * + * This type is required by `Gudhi::alpha_complex::Alpha_complex_3d::Alpha_shape_3`. + * */ + using Dt = typename Triangulation_3::Dt; +public: + /** \brief The CGAL 3D Alpha + * Shapes type. + * + * The `Gudhi::alpha_complex::Alpha_complex_3d` is a wrapper on top of this class to ease the standard, weighted + * and/or periodic build of the Alpha complex 3d.*/ + using Alpha_shape_3 = CGAL::Alpha_shape_3; + + /** \brief The alpha values type. + * Must be compatible with double. */ + using FT = typename Alpha_shape_3::FT; + + /** \brief Gives public access to the Point_3 type. Here is a Point_3 constructor example: +\code{.cpp} +using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + +// x0 = 1., y0 = -1.1, z0 = -1.. +Alpha_complex_3d::Point_3 p0(1., -1.1, -1.); +\endcode + * */ using Point_3 = typename Kernel::Point_3; - private: - using Alpha_value_type = typename Alpha_shape_3::FT; + /** \brief Gives public access to the Weighted_point_3 type. A Weighted point can be constructed as follows: +\code{.cpp} +using Weighted_alpha_complex_3d = + Gudhi::alpha_complex::Alpha_complex_3d; + +// x0 = 1., y0 = -1.1, z0 = -1., weight = 4. +Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Point_3(1., -1.1, -1.), 4.); +\endcode + * + * Note: This type is defined to void if Alpha complex is not weighted. + * + * */ + using Weighted_point_3 = typename Triangulation_3::Weighted_point_3; + +private: using Dispatch = - CGAL::Dispatch_output_iterator, + CGAL::Dispatch_output_iterator, CGAL::cpp11::tuple>, - std::back_insert_iterator>>>; + std::back_insert_iterator>>>; using Cell_handle = typename Alpha_shape_3::Cell_handle; using Facet = typename Alpha_shape_3::Facet; @@ -252,12 +293,12 @@ class Alpha_complex_3d { /** \brief Alpha_complex constructor from a list of points. * * @param[in] points Range of points to triangulate. Points must be in `Alpha_complex_3d::Point_3` or - * `Alpha_complex_3d::Triangulation_3::Weighted_point`. + * `Alpha_complex_3d::Weighted_point_3`. * * @pre Available if Alpha_complex_3d is not Periodic. * * The type InputPointRange must be a range for which std::begin and std::end return input iterators on a - * `Alpha_complex_3d::Point_3` or a `Alpha_complex_3d::Triangulation_3::Weighted_point`. + * `Alpha_complex_3d::Point_3` or a `Alpha_complex_3d::Weighted_point_3`. */ template Alpha_complex_3d(const InputPointRange& points) { @@ -271,15 +312,15 @@ class Alpha_complex_3d { * * @exception std::invalid_argument In debug mode, if points and weights do not have the same size. * - * @param[in] points Range of points to triangulate. Points must be in `Alpha_complex_3d::Point_3` - * @param[in] weights Range of weights on points. Weights shall be in `Alpha_complex_3d::Alpha_shape_3::FT` + * @param[in] points Range of points to triangulate. Points must be in `Alpha_complex_3d::Point_3`. + * @param[in] weights Range of weights on points. Weights shall be in double. * * @pre Available if Alpha_complex_3d is Weighted and not Periodic. * * The type InputPointRange must be a range for which std::begin and * std::end return input iterators on a `Alpha_complex_3d::Point_3`. * The type WeightRange must be a range for which std::begin and - * std::end return an input iterator on a `Alpha_complex_3d::Alpha_shape_3::FT`. + * std::end return an input iterator on a double. */ template Alpha_complex_3d(const InputPointRange& points, WeightRange weights) { @@ -288,7 +329,6 @@ class Alpha_complex_3d { GUDHI_CHECK((weights.size() == points.size()), std::invalid_argument("Points number in range different from weights range number")); - using Weighted_point_3 = typename Triangulation_3::Weighted_point; std::vector weighted_points_3; std::size_t index = 0; @@ -307,7 +347,7 @@ class Alpha_complex_3d { * @exception std::invalid_argument In debug mode, if the size of the cuboid in every directions is not the same. * * @param[in] points Range of points to triangulate. Points must be in `Alpha_complex_3d::Point_3` or - * `Alpha_complex_3d::Triangulation_3::Weighted_point`. + * `Alpha_complex_3d::Weighted_point_3`. * @param[in] x_min Iso-oriented cuboid x_min. * @param[in] y_min Iso-oriented cuboid y_min. * @param[in] z_min Iso-oriented cuboid z_min. @@ -318,14 +358,14 @@ class Alpha_complex_3d { * @pre Available if Alpha_complex_3d is Periodic. * * The type InputPointRange must be a range for which std::begin and std::end return input iterators on a - * `Alpha_complex_3d::Point_3` or a `Alpha_complex_3d::Triangulation_3::Weighted_point`. + * `Alpha_complex_3d::Point_3` or a `Alpha_complex_3d::Weighted_point_3`. * * @note In weighted version, please check weights are greater than zero, and lower than 1/64*cuboid length * squared. */ template - Alpha_complex_3d(const InputPointRange& points, Alpha_value_type x_min, Alpha_value_type y_min, - Alpha_value_type z_min, Alpha_value_type x_max, Alpha_value_type y_max, Alpha_value_type z_max) { + Alpha_complex_3d(const InputPointRange& points, FT x_min, FT y_min, + FT z_min, FT x_max, FT y_max, FT z_max) { static_assert(Periodic, "This constructor is not available for non-periodic versions of Alpha_complex_3d"); // Checking if the cuboid is the same in x,y and z direction. If not, CGAL will not process it. GUDHI_CHECK( @@ -333,7 +373,7 @@ class Alpha_complex_3d { std::invalid_argument("The size of the cuboid in every directions is not the same.")); // Define the periodic cube - Triangulation_3 pdt(typename Kernel::Iso_cuboid_3(x_min, y_min, z_min, x_max, y_max, z_max)); + Dt pdt(typename Kernel::Iso_cuboid_3(x_min, y_min, z_min, x_max, y_max, z_max)); // Heuristic for inserting large point sets (if pts is reasonably large) pdt.insert(std::begin(points), std::end(points), true); // As pdt won't be modified anymore switch to 1-sheeted cover if possible @@ -354,8 +394,8 @@ class Alpha_complex_3d { * @exception std::invalid_argument In debug mode, if a weight is negative, zero, or greater than 1/64*cuboid length * squared. * - * @param[in] points Range of points to triangulate. Points must be in `Alpha_complex_3d::Point_3` - * @param[in] weights Range of weights on points. Weights shall be in `Alpha_complex_3d::Alpha_shape_3::FT` + * @param[in] points Range of points to triangulate. Points must be in `Alpha_complex_3d::Point_3`. + * @param[in] weights Range of weights on points. Weights shall be in double. * @param[in] x_min Iso-oriented cuboid x_min. * @param[in] y_min Iso-oriented cuboid y_min. * @param[in] z_min Iso-oriented cuboid z_min. @@ -368,12 +408,12 @@ class Alpha_complex_3d { * The type InputPointRange must be a range for which std::begin and * std::end return input iterators on a `Alpha_complex_3d::Point_3`. * The type WeightRange must be a range for which std::begin and - * std::end return an input iterator on a `Alpha_complex_3d::Alpha_shape_3::FT`. - * The type of x_min, y_min, z_min, x_max, y_max and z_max is `Alpha_complex_3d::Alpha_shape_3::FT`. + * std::end return an input iterator on a double. + * The type of x_min, y_min, z_min, x_max, y_max and z_max must be a double. */ template - Alpha_complex_3d(const InputPointRange& points, WeightRange weights, Alpha_value_type x_min, Alpha_value_type y_min, - Alpha_value_type z_min, Alpha_value_type x_max, Alpha_value_type y_max, Alpha_value_type z_max) { + Alpha_complex_3d(const InputPointRange& points, WeightRange weights, FT x_min, FT y_min, + FT z_min, FT x_max, FT y_max, FT z_max) { static_assert(Weighted, "This constructor is not available for non-weighted versions of Alpha_complex_3d"); static_assert(Periodic, "This constructor is not available for non-periodic versions of Alpha_complex_3d"); GUDHI_CHECK((weights.size() == points.size()), @@ -383,7 +423,6 @@ class Alpha_complex_3d { (x_max - x_min == y_max - y_min) && (x_max - x_min == z_max - z_min) && (z_max - z_min == y_max - y_min), std::invalid_argument("The size of the cuboid in every directions is not the same.")); - using Weighted_point_3 = typename Triangulation_3::Weighted_point; std::vector weighted_points_3; std::size_t index = 0; @@ -391,7 +430,7 @@ class Alpha_complex_3d { #ifdef GUDHI_DEBUG // Defined in GUDHI_DEBUG to avoid unused variable warning for GUDHI_CHECK - Alpha_value_type maximal_possible_weight = 0.015625 * (x_max - x_min) * (x_max - x_min); + FT maximal_possible_weight = 0.015625 * (x_max - x_min) * (x_max - x_min); #endif while ((index < weights.size()) && (index < points.size())) { @@ -404,7 +443,7 @@ class Alpha_complex_3d { } // Define the periodic cube - Triangulation_3 pdt(typename Kernel::Iso_cuboid_3(x_min, y_min, z_min, x_max, y_max, z_max)); + Dt pdt(typename Kernel::Iso_cuboid_3(x_min, y_min, z_min, x_max, y_max, z_max)); // Heuristic for inserting large point sets (if pts is reasonably large) pdt.insert(std::begin(weighted_points_3), std::end(weighted_points_3), true); // As pdt won't be modified anymore switch to 1-sheeted cover if possible @@ -453,9 +492,9 @@ class Alpha_complex_3d { std::size_t count_cells = 0; #endif // DEBUG_TRACES std::vector objects; - std::vector alpha_values; + std::vector alpha_values; - Dispatch dispatcher = CGAL::dispatch_output(std::back_inserter(objects), + Dispatch dispatcher = CGAL::dispatch_output(std::back_inserter(objects), std::back_inserter(alpha_values)); alpha_shape_3_ptr_->filtration_with_alpha_values(dispatcher); @@ -464,7 +503,7 @@ class Alpha_complex_3d { #endif // DEBUG_TRACES Alpha_shape_simplex_tree_map map_cgal_simplex_tree; - using Alpha_value_iterator = typename std::vector::const_iterator; + using Alpha_value_iterator = typename std::vector::const_iterator; Alpha_value_iterator alpha_value_iterator = alpha_values.begin(); for (auto object_iterator : objects) { Vertex_list vertex_list; diff --git a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp index b818fb2e..e4a45791 100644 --- a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp @@ -228,7 +228,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted, Weighted_alpha_complex_3d, alpha_complex_p_a_w.create_complex(stree); std::cout << "Weighted alpha complex 3d from weighted points" << std::endl; - using Weighted_point_3 = typename Weighted_alpha_complex_3d::Triangulation_3::Weighted_point; + using Weighted_point_3 = typename Weighted_alpha_complex_3d::Weighted_point_3; std::vector weighted_points; diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h index 35b84d2e..b33a95a1 100644 --- a/src/common/doc/main_page.h +++ b/src/common/doc/main_page.h @@ -29,7 +29,9 @@ Author: Vincent Rouvreau
Introduced in: GUDHI 1.3.0
Copyright: GPL v3
- Requires: \ref cgal ≥ 4.11.0 and \ref eigen3 + Requires: \ref eigen3 and
+ \ref cgal ≥ 4.7.0 for Alpha_complex
+ \ref cgal ≥ 4.11.0 for Alpha_complex_3d Alpha_complex is a simplicial complex constructed from the finite cells of a Delaunay Triangulation.
@@ -38,7 +40,8 @@ values of the codimension 1 cofaces that make it not Gabriel otherwise. All simplices that have a filtration value strictly greater than a given alpha squared value are not inserted into the complex.
- User manual: \ref alpha_complex - Reference manual: Gudhi::alpha_complex::Alpha_complex + User manual: \ref alpha_complex - Reference manual: Gudhi::alpha_complex::Alpha_complex and + Gudhi::alpha_complex::Alpha_complex_3d -- cgit v1.2.3 From 88a83fe20ce9100f2292c3945d26e4696fd2e7d2 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 23 Nov 2018 09:06:04 +0000 Subject: // We could use Epick + CGAL::Tag_true for not weighted nor periodic, but during benchmark, we found a bug // https://github.com/CGAL/cgal/issues/3460 // This is the reason we only use Epick + CGAL::Tag_false, or Epeck // // FAST SAFE EXACT // Epick + CGAL::Tag_false Epeck Epeck git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@4012 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 88e844333b5bae8fcfd1104e493cdada1e4a4a3b --- .../example/Alpha_complex_3d_from_points.cpp | 2 +- .../Weighted_alpha_complex_3d_from_points.cpp | 4 +- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 22 ++++---- .../test/Alpha_complex_3d_unit_test.cpp | 61 +++++++++++----------- 4 files changed, 43 insertions(+), 46 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp index 3acebd2e..0e359a27 100644 --- a/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp +++ b/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp @@ -7,7 +7,7 @@ #include #include // for numeric limits -using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; using Point = Alpha_complex_3d::Point_3; using Vector_of_points = std::vector; diff --git a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp index 734b4f37..ac11b68c 100644 --- a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp +++ b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp @@ -7,9 +7,9 @@ #include #include // for numeric limits -// Complexity = EXACT, weighted = true, periodic = false +// Complexity = FAST, weighted = true, periodic = false using Weighted_alpha_complex_3d = - Gudhi::alpha_complex::Alpha_complex_3d; + Gudhi::alpha_complex::Alpha_complex_3d; using Point = Weighted_alpha_complex_3d::Point_3; using Weighted_point = Weighted_alpha_complex_3d::Weighted_point_3; diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index c33b9cf8..b5d4201d 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -155,16 +155,16 @@ class Alpha_complex_3d { // Epeck = Exact_predicates_exact_constructions_kernel // Exact_alpha_comparison_tag = exact version of CGAL Alpha_shape_3 and of its objects (Alpha_shape_vertex_base_3 and // Alpha_shape_cell_base_3). Not available if weighted or periodic. - // Can be CGAL::Tag_false or CGAL::Tag_true + // Can be CGAL::Tag_false or CGAL::Tag_true. Default is False. // cf. https://doc.cgal.org/latest/Alpha_shapes_3/classCGAL_1_1Alpha__shape__3.html // + // We could use Epick + CGAL::Tag_true for not weighted nor periodic, but during benchmark, we found a bug + // https://github.com/CGAL/cgal/issues/3460 + // This is the reason we only use Epick + CGAL::Tag_false, or Epeck // - // FAST SAFE EXACT - // not weighted and Epick + CGAL::Tag_false Epick + CGAL::Tag_true Epick + CGAL::Tag_true - // not periodic - // - // otherwise Epick + CGAL::Tag_false Epeck Epeck - using Predicates = typename std::conditional<((!Weighted && !Periodic) || (Complexity == complexity::FAST)), + // FAST SAFE EXACT + // Epick + CGAL::Tag_false Epeck Epeck + using Predicates = typename std::conditional<(Complexity == complexity::FAST), CGAL::Exact_predicates_inexact_constructions_kernel, CGAL::Exact_predicates_exact_constructions_kernel>::type; @@ -188,15 +188,13 @@ class Alpha_complex_3d { using Kernel = typename Kernel_3::Kernel; - using Exact_alpha_comparison_tag = typename std::conditional<(Complexity == complexity::FAST), CGAL::Tag_false, CGAL::Tag_true>::type; - using TdsVb = typename std::conditional, CGAL::Triangulation_ds_vertex_base_3<>>::type; using Tvb = typename std::conditional, CGAL::Triangulation_vertex_base_3>::type; - using Vb = CGAL::Alpha_shape_vertex_base_3; + using Vb = CGAL::Alpha_shape_vertex_base_3; using TdsCb = typename std::conditional, CGAL::Triangulation_ds_cell_base_3<>>::type; @@ -204,7 +202,7 @@ class Alpha_complex_3d { using Tcb = typename std::conditional, CGAL::Triangulation_cell_base_3>::type; - using Cb = CGAL::Alpha_shape_cell_base_3; + using Cb = CGAL::Alpha_shape_cell_base_3; using Tds = CGAL::Triangulation_data_structure_3; // The other way to do a conditional type. Here there 4 possibilities, cannot use std::conditional @@ -247,7 +245,7 @@ public: * * The `Gudhi::alpha_complex::Alpha_complex_3d` is a wrapper on top of this class to ease the standard, weighted * and/or periodic build of the Alpha complex 3d.*/ - using Alpha_shape_3 = CGAL::Alpha_shape_3; + using Alpha_shape_3 = CGAL::Alpha_shape_3
; /** \brief The alpha values type. * Must be compatible with double. */ diff --git a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp index c408dc75..ec905d5b 100644 --- a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp @@ -48,20 +48,27 @@ using Safe_alpha_complex_3d = using Exact_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +template +std::vector get_points() { + std::vector points; + points.push_back(Point(0.0, 0.0, 0.0)); + points.push_back(Point(0.0, 0.0, 0.2)); + points.push_back(Point(0.2, 0.0, 0.2)); + points.push_back(Point(0.6, 0.6, 0.0)); + points.push_back(Point(0.8, 0.8, 0.2)); + points.push_back(Point(0.2, 0.8, 0.6)); + + return points; +} + + BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // ----------------- // Fast version // ----------------- std::cout << "Fast alpha complex 3d" << std::endl; - std::vector points; - points.push_back(Fast_alpha_complex_3d::Point_3(0.0, 0.0, 0.0)); - points.push_back(Fast_alpha_complex_3d::Point_3(0.0, 0.0, 0.2)); - points.push_back(Fast_alpha_complex_3d::Point_3(0.2, 0.0, 0.2)); - points.push_back(Fast_alpha_complex_3d::Point_3(0.6, 0.6, 0.0)); - points.push_back(Fast_alpha_complex_3d::Point_3(0.8, 0.8, 0.2)); - points.push_back(Fast_alpha_complex_3d::Point_3(0.2, 0.8, 0.6)); - Fast_alpha_complex_3d alpha_complex(points); + Fast_alpha_complex_3d alpha_complex(get_points()); Gudhi::Simplex_tree<> stree; alpha_complex.create_complex(stree); @@ -71,7 +78,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // ----------------- std::cout << "Exact alpha complex 3d" << std::endl; - Exact_alpha_complex_3d exact_alpha_complex(points); + Exact_alpha_complex_3d exact_alpha_complex(get_points()); Gudhi::Simplex_tree<> exact_stree; exact_alpha_complex.create_complex(exact_stree); @@ -79,13 +86,13 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // --------------------- // Compare both versions // --------------------- - std::cout << "Exact Alpha complex 3d is of dimension " << exact_stree.dimension() << " - Non exact is " + std::cout << "Exact Alpha complex 3d is of dimension " << exact_stree.dimension() << " - Fast is " << stree.dimension() << std::endl; BOOST_CHECK(exact_stree.dimension() == stree.dimension()); - std::cout << "Exact Alpha complex 3d num_simplices " << exact_stree.num_simplices() << " - Non exact is " + std::cout << "Exact Alpha complex 3d num_simplices " << exact_stree.num_simplices() << " - Fast is " << stree.num_simplices() << std::endl; BOOST_CHECK(exact_stree.num_simplices() == stree.num_simplices()); - std::cout << "Exact Alpha complex 3d num_vertices " << exact_stree.num_vertices() << " - Non exact is " + std::cout << "Exact Alpha complex 3d num_vertices " << exact_stree.num_vertices() << " - Fast is " << stree.num_vertices() << std::endl; BOOST_CHECK(exact_stree.num_vertices() == stree.num_vertices()); @@ -93,19 +100,18 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { while (sh != stree.filtration_simplex_range().end()) { std::vector simplex; std::vector exact_simplex; - std::cout << "Non-exact ( "; + std::cout << "Fast ( "; for (auto vertex : stree.simplex_vertex_range(*sh)) { simplex.push_back(vertex); std::cout << vertex << " "; } - std::cout << ") -> " - << "[" << stree.filtration(*sh) << "] "; - std::cout << std::endl; + std::cout << ") -> [" << stree.filtration(*sh) << "] "; // Find it in the exact structure auto sh_exact = exact_stree.find(simplex); BOOST_CHECK(sh_exact != exact_stree.null_simplex()); + std::cout << " versus [" << exact_stree.filtration(sh_exact) << "] " << std::endl; // Exact and non-exact version is not exactly the same due to float comparison GUDHI_TEST_FLOAT_EQUALITY_CHECK(exact_stree.filtration(sh_exact), stree.filtration(*sh)); @@ -116,7 +122,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // ----------------- std::cout << "Safe alpha complex 3d" << std::endl; - Safe_alpha_complex_3d safe_alpha_complex(points); + Safe_alpha_complex_3d safe_alpha_complex(get_points()); Gudhi::Simplex_tree<> safe_stree; safe_alpha_complex.create_complex(safe_stree); @@ -124,13 +130,13 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // --------------------- // Compare both versions // --------------------- - std::cout << "Exact Alpha complex 3d is of dimension " << safe_stree.dimension() << " - Non exact is " + std::cout << "Safe Alpha complex 3d is of dimension " << safe_stree.dimension() << " - Fast is " << stree.dimension() << std::endl; BOOST_CHECK(safe_stree.dimension() == stree.dimension()); - std::cout << "Exact Alpha complex 3d num_simplices " << safe_stree.num_simplices() << " - Non exact is " + std::cout << "Safe Alpha complex 3d num_simplices " << safe_stree.num_simplices() << " - Fast is " << stree.num_simplices() << std::endl; BOOST_CHECK(safe_stree.num_simplices() == stree.num_simplices()); - std::cout << "Exact Alpha complex 3d num_vertices " << safe_stree.num_vertices() << " - Non exact is " + std::cout << "Safe Alpha complex 3d num_vertices " << safe_stree.num_vertices() << " - Fast is " << stree.num_vertices() << std::endl; BOOST_CHECK(safe_stree.num_vertices() == stree.num_vertices()); @@ -138,27 +144,20 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { while (safe_sh != stree.filtration_simplex_range().end()) { std::vector simplex; std::vector exact_simplex; -#ifdef DEBUG_TRACES - std::cout << "Non-exact ( "; -#endif + std::cout << "Fast ( "; for (auto vertex : stree.simplex_vertex_range(*safe_sh)) { simplex.push_back(vertex); -#ifdef DEBUG_TRACES std::cout << vertex << " "; -#endif } -#ifdef DEBUG_TRACES - std::cout << ") -> " - << "[" << stree.filtration(*safe_sh) << "] "; - std::cout << std::endl; -#endif + std::cout << ") -> [" << stree.filtration(*safe_sh) << "] "; // Find it in the exact structure auto sh_exact = safe_stree.find(simplex); BOOST_CHECK(sh_exact != safe_stree.null_simplex()); + std::cout << " versus [" << safe_stree.filtration(sh_exact) << "] " << std::endl; // Exact and non-exact version is not exactly the same due to float comparison - GUDHI_TEST_FLOAT_EQUALITY_CHECK(safe_stree.filtration(sh_exact), stree.filtration(*safe_sh)); + GUDHI_TEST_FLOAT_EQUALITY_CHECK(safe_stree.filtration(sh_exact), stree.filtration(*safe_sh), 1e-15); ++safe_sh; } -- cgit v1.2.3 From bfd989dae36a22450c1da3dc21cea57bb7d2e96e Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 23 Nov 2018 10:49:43 +0000 Subject: Code review : Use CGAL::to_double(it->exact()) for Exact version, and CGAL::to_double(*it) otherwise git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@4013 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5ff40181e71c7df721df38fa90635cee8ab7e799 --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 32 ++++------------------ 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'src/Alpha_complex/include') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index b5d4201d..19445637 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -72,13 +72,10 @@ thread_local // Value_from_iterator returns the filtration value from an iterator on alpha shapes values // -// FAST SAFE EXACT -// not weighted and *iterator Specific case due to CGAL CGAL::to_double(iterator->exact()) -// not periodic issue # 3153 -// -// otherwise *iterator CGAL::to_double(*iterator) CGAL::to_double(iterator->exact()) +// FAST SAFE EXACT +// CGAL::to_double(*iterator) CGAL::to_double(*iterator) CGAL::to_double(iterator->exact()) -template +template struct Value_from_iterator { template static double perform(Iterator it) { @@ -88,28 +85,9 @@ struct Value_from_iterator { }; template <> -struct Value_from_iterator { - template - static double perform(Iterator it) { - // In SAFE mode, we are with Epeck with EXACT value set to CGAL::Tag_true. - // Specific case due to CGAL issue https://github.com/CGAL/cgal/issues/3153 - auto approx = it->approx(); - double r; - if (CGAL::fit_in_double(approx, r)) return r; - - // If it's precise enough, then OK. - if (CGAL::has_smaller_relative_precision(approx, RELATIVE_PRECISION_OF_TO_DOUBLE)) return CGAL::to_double(approx); - - it->exact(); - return CGAL::to_double(it->approx()); - } -}; - -template -struct Value_from_iterator{ +struct Value_from_iterator { template static double perform(Iterator it) { - // In EXACT mode, we are with Epeck, or with Epick and EXACT value set to CGAL::Tag_true. return CGAL::to_double(it->exact()); } }; @@ -568,7 +546,7 @@ private: } } // Construction of the simplex_tree - Filtration_value filtr = Value_from_iterator::perform(alpha_value_iterator); + Filtration_value filtr = Value_from_iterator::perform(alpha_value_iterator); #ifdef DEBUG_TRACES std::cout << "filtration = " << filtr << std::endl; -- cgit v1.2.3