summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-08-29 10:54:26 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-08-29 10:54:26 +0000
commit5b76e5b635e04e4c9a92b6be4a719cfee51b5fa9 (patch)
tree123c9602c87b8bec01b881434326d3706ec9dc2f /src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
parentef84bab542eb07d83515293652841969dd462b1c (diff)
weighted/non-weighted and periodic/non-periodic with fast/exact are working well (test suites and examples)
Still utilities to rewrite Modify GUDHI_TEST_FLOAT_EQUALITY_CHECK as one test was reaching exactly std::numeric_limits<FloatingType>::epsilon() git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3842 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: bbd17f90644b4b8444d480ca95da0909e8fe5048
Diffstat (limited to 'src/Alpha_complex/include/gudhi/Alpha_complex_3d.h')
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex_3d.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
index ed58c1c0..7e2454e5 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
@@ -108,20 +108,38 @@ class Alpha_complex_3d {
using Vb = CGAL::Alpha_shape_vertex_base_3<Kernel, Tvb, Exact_tag>;
+ using TdsCb = typename std::conditional<Periodic,
+ CGAL::Periodic_3_triangulation_ds_cell_base_3<>,
+ CGAL::Triangulation_ds_cell_base_3<>>::type;
+
using Tcb = typename std::conditional<Weighted,
- CGAL::Regular_triangulation_cell_base_3<Kernel>,
- CGAL::Triangulation_cell_base_3<Kernel>>::type;
+ CGAL::Regular_triangulation_cell_base_3<Kernel, TdsCb>,
+ CGAL::Triangulation_cell_base_3<Kernel, TdsCb>>::type;
using Cb = CGAL::Alpha_shape_cell_base_3<Kernel, Tcb, Exact_tag>;
using Tds = CGAL::Triangulation_data_structure_3<Vb, Cb>;
- using Pre_triangulation_3 = typename std::conditional<Weighted,
- CGAL::Regular_triangulation_3<Kernel, Tds>,
- CGAL::Delaunay_triangulation_3<Kernel, Tds>>::type;
-
- using Triangulation_3 = typename std::conditional<(Weighted && Periodic),
- CGAL::Periodic_3_regular_triangulation_3<Kernel, Tds>,
- Pre_triangulation_3>::type;
+ // The other way to do a conditional type. Here there 4 possibilities, cannot use std::conditional
+ template<typename Kernel, typename Tds, bool Weighted_version, bool Periodic_version> struct Triangulation {};
+
+ template < typename Kernel, typename Tds >
+ struct Triangulation<Kernel, Tds, false, false> {
+ using Triangulation_3 = CGAL::Delaunay_triangulation_3<Kernel, Tds>;
+ };
+ template < typename Kernel, typename Tds >
+ struct Triangulation<Kernel, Tds, true, false> {
+ using Triangulation_3 = CGAL::Regular_triangulation_3<Kernel, Tds>;
+ };
+ template < typename Kernel, typename Tds >
+ struct Triangulation<Kernel, Tds, false, true> {
+ using Triangulation_3 = CGAL::Periodic_3_Delaunay_triangulation_3<Kernel, Tds>;
+ };
+ template < typename Kernel, typename Tds >
+ struct Triangulation<Kernel, Tds, true, true> {
+ using Triangulation_3 = CGAL::Periodic_3_regular_triangulation_3<Kernel, Tds>;
+ };
+
+ using Triangulation_3 = typename Triangulation<Kernel, Tds, Weighted, Periodic>::Triangulation_3;
public:
using Alpha_shape_3 = CGAL::Alpha_shape_3<Triangulation_3, Exact_tag>;
@@ -255,7 +273,7 @@ public:
* std::end return input iterators on a AlphaComplex3dOptions::Point_3.
* The type of x_min, y_min, z_min, x_max, y_max and z_max is AlphaComplex3dOptions::Alpha_shape_3::FT.
*/
- /*template<typename InputPointRange>
+ template<typename InputPointRange>
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) {
@@ -269,10 +287,8 @@ public:
(z_max - z_min == y_max - y_min),
std::invalid_argument("The size of the cuboid in every directions is not the same."));
- using Periodic_delaunay_triangulation_3 = typename AlphaComplex3dOptions::Periodic_delaunay_triangulation_3;
- using Iso_cuboid_3 = typename AlphaComplex3dOptions::Iso_cuboid_3;
// Define the periodic cube
- Periodic_delaunay_triangulation_3 pdt(Iso_cuboid_3(x_min, y_min, z_min, x_max, y_max, z_max));
+ Triangulation_3 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
@@ -294,7 +310,7 @@ public:
std::cout << "filtration_with_alpha_values returns : " << objects_.size() << " objects" << std::endl;
#endif // DEBUG_TRACES
- }*/
+ }
/** \brief Alpha_complex constructor from a list of points, associated weights and an iso-cuboid coordinates.
*