summaryrefslogtreecommitdiff
path: root/src/Alpha_complex
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-09-07 14:17:13 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-09-07 14:17:13 +0000
commit35fee4017481fd3f62fceb76a1b2bc8cd0f15b95 (patch)
tree5ba9cc138d6d900be30c46ea8c7e82b198cce1f5 /src/Alpha_complex
parent2cbaaab0cc07057542594bdd31655442acdf2fa6 (diff)
Code review : rearrange documentation and examples according to making choices more orthogonal
Rename Alpha_complex_3d_options.h Alpha_complex_options.h as it can be used by Alpha complex dD git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3875 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6c5b105248e4766a44438a187bb130a3722b310f
Diffstat (limited to 'src/Alpha_complex')
-rw-r--r--src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp26
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex_3d.h112
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex_3d_options.h179
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex_options.h64
-rw-r--r--src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp535
-rw-r--r--src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp120
6 files changed, 415 insertions, 621 deletions
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 1b60ccd8..61ceab6d 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
@@ -1,5 +1,4 @@
#include <gudhi/Alpha_complex_3d.h>
-#include <gudhi/Alpha_complex_3d_options.h>
// to construct a simplex_tree from alpha complex
#include <gudhi/Simplex_tree.h>
@@ -9,8 +8,9 @@
#include <limits> // for numeric limits
using Weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact, true, false>;
-using Point = Weighted_alpha_complex_3d::Point_3 ;
-using Vector_of_points = std::vector<Point>;
+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<Weighted_point>;
using Vector_of_weights = std::vector<Weighted_alpha_complex_3d::Alpha_shape_3::FT>;
int main(int argc, char **argv) {
@@ -23,23 +23,17 @@ int main(int argc, char **argv) {
// ----------------------------------------------------------------------------
// Init of a list of points and weights from a small molecule
// ----------------------------------------------------------------------------
- Vector_of_points points;
- Vector_of_weights weights;
- points.push_back(Point(1, -1, -1));
- weights.push_back(4.);
- points.push_back(Point(-1, 1, -1));
- weights.push_back(4.);
- points.push_back(Point(-1, -1, 1));
- weights.push_back(4.);
- points.push_back(Point(1, 1, 1));
- weights.push_back(4.);
- points.push_back(Point(2, 2, 2));
- weights.push_back(1.);
+ Vector_of_weighted_points 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.));
+ weighted_points.push_back(Weighted_point(Point(1, 1, 1), 4.));
+ weighted_points.push_back(Weighted_point(Point(2, 2, 2), 1.));
// ----------------------------------------------------------------------------
// Init of an alpha complex from the list of points
// ----------------------------------------------------------------------------
- Weighted_alpha_complex_3d alpha_complex_from_points(points, weights);
+ Weighted_alpha_complex_3d alpha_complex_from_points(weighted_points);
Gudhi::Simplex_tree<> simplex;
if (alpha_complex_from_points.create_complex(simplex)) {
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
index bbe13be2..bf1aaa99 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
@@ -31,7 +31,7 @@
#endif
#include <gudhi/Debug_utils.h>
-#include <gudhi/Alpha_complex_3d_options.h>
+#include <gudhi/Alpha_complex_options.h>
#include <CGAL/Object.h>
#include <CGAL/tuple.h>
@@ -57,13 +57,6 @@ namespace Gudhi {
namespace alpha_complex {
-enum class complexity: char
-{
- fast='f',
- safe='s',
- exact='e',
-};
-
/**
* \class Alpha_complex_3d
* \brief Alpha complex data structure for 3d specific case.
@@ -73,15 +66,30 @@ enum class complexity: char
* \details
* The data structure is constructing a <a href="https://doc.cgal.org/latest/Alpha_shapes_3/index.html">CGAL 3D Alpha
* Shapes</a> 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
+ * `Gudhi::alpha_complex::complexity::fast`.
+ *
+ * \tparam Weighted Boolean used to set/unset the weighted version of Alpha_complex_3d. Default value is false.
+ *
+ * \tparam Periodic Boolean used to set/unset the periodic version of Alpha_complex_3d. Default value is false.
*
- * \tparam AlphaComplex3dOptions can be `Gudhi::alpha_complex::Alpha_shapes_3d`,
- * `Gudhi::alpha_complex::Exact_alpha_shapes_3d`, `Gudhi::alpha_complex::Weighted_alpha_shapes_3d`,
- * `Gudhi::alpha_complex::Periodic_alpha_shapes_3d` or `Gudhi::alpha_complex::Weighted_periodic_alpha_shapes_3d`.
+ * For the weighted version, weights values are explained on CGAL
+ * <a href="https://doc.cgal.org/latest/Alpha_shapes_3/index.html#title0">Alpha shapes 3d</a> and
+ * <a href="https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation3secclassRegulartriangulation">Regular
+ * triangulation</a> documentation.
+ *
+ * For the periodic version, refer to the
+ * <a href="https://doc.cgal.org/latest/Periodic_3_triangulation_3/index.html">CGAL’s 3D Periodic Triangulations User
+ * Manual </a> for more details.
+ * The periodicity is defined by an iso-oriented cuboid with diagonal opposite vertices (x_min, y_min, z_min) and
+ * (x_max, y_max, z_max).
*
* Please refer to \ref alpha_complex for examples.
*
* \remark When Alpha_complex_3d is constructed with an infinite value of alpha (default value), the complex is a
- * Delaunay complex.
+ * 3d Delaunay complex.
*
*/
template<complexity Complexity = complexity::fast, bool Weighted = false, bool Periodic = false>
@@ -157,9 +165,9 @@ class Alpha_complex_3d {
using Triangulation_3 = CGAL::Periodic_3_regular_triangulation_3<Kernel, Tds>;
};
+public:
using Triangulation_3 = typename Triangulation<Kernel, Tds, Weighted, Periodic>::Triangulation_3;
-public:
using Alpha_shape_3 = CGAL::Alpha_shape_3<Triangulation_3, Exact_tag>;
using Point_3 = typename Kernel::Point_3;
@@ -184,20 +192,16 @@ private:
public:
/** \brief Alpha_complex constructor from a list of points.
*
- * Duplicate points are inserted once in the Alpha_complex. This is the reason why the vertices may be not contiguous.
+ * @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`.
*
- * @param[in] points Range of points to triangulate. Points must be in AlphaComplex3dOptions::Point_3
+ * @pre Available if Alpha_complex_3d is not Periodic.
*
- * @pre Available if AlphaComplex3dOptions is `Gudhi::alpha_complex::Alpha_shapes_3d` or
- * `Gudhi::alpha_complex::Exact_alpha_shapes_3d`.
- *
- * The type InputPointRange must be a range for which std::begin and
- * std::end return input iterators on a AlphaComplex3dOptions::Point_3.
+ * 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`.
*/
template<typename InputPointRange >
Alpha_complex_3d(const InputPointRange& points) {
- static_assert(!Weighted,
- "This constructor is not available for weighted versions of Alpha_complex_3d");
static_assert(!Periodic,
"This constructor is not available for periodic versions of Alpha_complex_3d");
@@ -215,23 +219,17 @@ public:
/** \brief Alpha_complex constructor from a list of points and associated weights.
*
- * Duplicate points are inserted once in the Alpha_complex. This is the reason why the vertices may be not contiguous.
- * Weights values are explained on CGAL <a href="https://doc.cgal.org/latest/Alpha_shapes_3/index.html#title0">Alpha
- * shape</a> and
- * <a href="https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation3secclassRegulartriangulation">Regular
- * triangulation</a> documentation.
- *
* @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 AlphaComplex3dOptions::Point_3
- * @param[in] weights Range of weights on points. Points must be in AlphaComplex3dOptions::Point_3
+ * @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`
*
- * @pre Available if AlphaComplex3dOptions is `Weighted_alpha_shapes_3d`.
+ * @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 AlphaComplex3dOptions::Point_3.
+ * 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 AlphaComplex3dOptions::Alpha_shape_3::FT.
+ * std::end return an input iterator on a `Alpha_complex_3d::Alpha_shape_3::FT`.
*/
template<typename InputPointRange , typename WeightRange>
Alpha_complex_3d(const InputPointRange& points, WeightRange weights) {
@@ -268,16 +266,10 @@ public:
/** \brief Alpha_complex constructor from a list of points and an iso-cuboid coordinates.
*
- * Duplicate points are inserted once in the Alpha_complex. This is the reason why the vertices may be not contiguous.
- *
- * Refer to the <a href="https://doc.cgal.org/latest/Periodic_3_triangulation_3/index.html">CGAL’s 3D Periodic
- * Triangulations User Manual </a> for more details.
- * The periodicity is defined by an iso-oriented cuboid with diagonal opposite vertices (x_min, y_min, z_min) and
- * (x_max, y_max, z_max).
- *
* @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 AlphaComplex3dOptions::Point_3
+ * @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`.
* @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.
@@ -285,18 +277,18 @@ public:
* @param[in] y_max Iso-oriented cuboid y_max.
* @param[in] z_max Iso-oriented cuboid z_max.
*
- * @pre Available if AlphaComplex3dOptions is `Periodic_alpha_shapes_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 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.
+ * 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`.
+ *
+ * @note In weighted version, please check weights are greater than zero, and lower than 1/64*cuboid length
+ * squared.
*/
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) {
- static_assert(!Weighted,
- "This constructor is not available for weighted versions of Alpha_complex_3d");
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.
@@ -332,25 +324,13 @@ public:
/** \brief Alpha_complex constructor from a list of points, associated weights and an iso-cuboid coordinates.
*
- * Duplicate points are inserted once in the Alpha_complex. This is the reason why the vertices may be not contiguous.
- *
- * Weights values are explained on CGAL <a href="https://doc.cgal.org/latest/Alpha_shapes_3/index.html#title0">Alpha
- * shape</a> and
- * <a href="https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation3secclassRegulartriangulation">Regular
- * triangulation</a> documentation.
- *
- * Refer to the <a href="https://doc.cgal.org/latest/Periodic_3_triangulation_3/index.html">CGAL’s 3D Periodic
- * Triangulations User Manual</a> for more details.
- * The periodicity is defined by an iso-oriented cuboid with diagonal opposite vertices (x_min, y_min, z_min) and
- * (x_max, y_max, z_max).
- *
* @exception std::invalid_argument In debug mode, if points and weights do not have the same size.
* @exception std::invalid_argument In debug mode, if the size of the cuboid in every directions is not the same.
* @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 AlphaComplex3dOptions::Point_3
- * @param[in] weights Range of weights on points. Points must be in AlphaComplex3dOptions::Point_3
+ * @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] 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.
@@ -358,13 +338,13 @@ public:
* @param[in] y_max Iso-oriented cuboid y_max.
* @param[in] z_max Iso-oriented cuboid z_max.
*
- * @pre Available if AlphaComplex3dOptions is `Weighted_periodic_alpha_shapes_3d`.
+ * @pre Available if Alpha_complex_3d is Weighted and Periodic.
*
* The type InputPointRange must be a range for which std::begin and
- * std::end return input iterators on a AlphaComplex3dOptions::Point_3.
+ * 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 AlphaComplex3dOptions::Alpha_shape_3::FT.
- * The type of x_min, y_min, z_min, x_max, y_max and z_max is AlphaComplex3dOptions::Alpha_shape_3::FT.
+ * 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`.
*/
template<typename InputPointRange , typename WeightRange>
Alpha_complex_3d(const InputPointRange& points, WeightRange weights,
@@ -395,7 +375,7 @@ public:
while ((index < weights.size()) && (index < points.size())) {
GUDHI_CHECK((weights[index] < maximal_possible_weight) && (weights[index] >= 0),
- std::invalid_argument("Invalid weight at line" + std::to_string(index + 1) +
+ std::invalid_argument("Invalid weight at index " + std::to_string(index + 1) +
". Must be positive and less than maximal possible weight = 1/64*cuboid length "
"squared, which is not an acceptable input."));
weighted_points_3.push_back(Weighted_point_3(points[index], weights[index]));
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d_options.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d_options.h
deleted file mode 100644
index 567b19cb..00000000
--- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d_options.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* This file is part of the Gudhi Library. The Gudhi library
- * (Geometric Understanding in Higher Dimensions) is a generic C++
- * library for computational topology.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2018 Inria
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef ALPHA_COMPLEX_3D_OPTIONS_H_
-#define ALPHA_COMPLEX_3D_OPTIONS_H_
-
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
-#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
-#include <CGAL/Periodic_3_regular_triangulation_3.h>
-#include <CGAL/Regular_triangulation_3.h>
-#include <CGAL/Alpha_shape_3.h>
-#include <CGAL/Alpha_shape_cell_base_3.h>
-#include <CGAL/Alpha_shape_vertex_base_3.h>
-
-
-namespace Gudhi {
-
-namespace alpha_complex {
-
-class Alpha_shapes_3d {
-private:
- using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
- using Vb = CGAL::Alpha_shape_vertex_base_3<Kernel>;
- using Fb = CGAL::Alpha_shape_cell_base_3<Kernel>;
- using Tds = CGAL::Triangulation_data_structure_3<Vb, Fb>;
- using Triangulation_3 = CGAL::Delaunay_triangulation_3<Kernel, Tds>;
-
-public:
- using Alpha_shape_3 = CGAL::Alpha_shape_3<Triangulation_3>;
- using Point_3 = Kernel::Point_3;
-
- static const bool weighted = false;
- static const bool periodic = false;
-
- // Default value_from_iterator as Alpha_shape_3 is not exact
- template<class Filtration_value, class Alpha_value_iterator>
- static Filtration_value value_from_iterator(const Alpha_value_iterator avi) {
- return /*std::sqrt*/ *avi;
- }
-};
-
-class Exact_alpha_shapes_3d {
-private:
- // Alpha_shape_3 templates type definitions
- using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
- using Exact_tag = CGAL::Tag_true;
- using Vb = CGAL::Alpha_shape_vertex_base_3<Kernel, CGAL::Default, Exact_tag>;
- using Fb = CGAL::Alpha_shape_cell_base_3<Kernel, CGAL::Default, Exact_tag>;
- using Tds = CGAL::Triangulation_data_structure_3<Vb, Fb>;
- using Triangulation_3 = CGAL::Delaunay_triangulation_3<Kernel, Tds>;
-
-public:
- using Alpha_shape_3 = CGAL::Alpha_shape_3<Triangulation_3, Exact_tag>;
- using Point_3 = Kernel::Point_3;
-
- static const bool weighted = false;
- static const bool periodic = false;
-
- // value_from_iterator needs to compute filtration value as Alpha_shape_3 is exact
- template<class Filtration_value, class Alpha_value_iterator>
- static Filtration_value value_from_iterator(const Alpha_value_iterator avi) {
- return /*std::sqrt*/ CGAL::to_double(avi->exact());
- }
-};
-
-class Weighted_alpha_shapes_3d {
-private:
- using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
- using Rvb = CGAL::Regular_triangulation_vertex_base_3<Kernel>;
- using Vb = CGAL::Alpha_shape_vertex_base_3<Kernel, Rvb>;
- using Rcb = CGAL::Regular_triangulation_cell_base_3<Kernel>;
- using Cb = CGAL::Alpha_shape_cell_base_3<Kernel, Rcb>;
- using Tds = CGAL::Triangulation_data_structure_3<Vb, Cb>;
- using Triangulation_3 = CGAL::Regular_triangulation_3<Kernel, Tds>;
-
-
-public:
- using Alpha_shape_3 = CGAL::Alpha_shape_3<Triangulation_3>;
- using Point_3 = Triangulation_3::Bare_point;
- using Weighted_point_3 = Triangulation_3::Weighted_point;
-
- static const bool weighted = true;
- static const bool periodic = false;
-
- // Default value_from_iterator as Alpha_shape_3 is not exact
- template<class Filtration_value, class Alpha_value_iterator>
- static Filtration_value value_from_iterator(const Alpha_value_iterator avi) {
- return /*std::sqrt*/ *avi;
- }
-};
-
-class Periodic_alpha_shapes_3d {
-private:
- // Traits
- using K = CGAL::Exact_predicates_inexact_constructions_kernel;
- using PK = CGAL::Periodic_3_Delaunay_triangulation_traits_3<K>;
-// Vertex type
- using DsVb = CGAL::Periodic_3_triangulation_ds_vertex_base_3<>;
- using Vb = CGAL::Triangulation_vertex_base_3<PK, DsVb>;
- using AsVb = CGAL::Alpha_shape_vertex_base_3<PK, Vb>;
-// Cell type
- using DsCb = CGAL::Periodic_3_triangulation_ds_cell_base_3<>;
- using Cb = CGAL::Triangulation_cell_base_3<PK, DsCb>;
- using AsCb = CGAL::Alpha_shape_cell_base_3<PK, Cb>;
- using Tds = CGAL::Triangulation_data_structure_3<AsVb, AsCb>;
-
-public:
- using Periodic_delaunay_triangulation_3 = CGAL::Periodic_3_Delaunay_triangulation_3<PK, Tds>;
- using Alpha_shape_3 = CGAL::Alpha_shape_3<Periodic_delaunay_triangulation_3>;
- using Point_3 = PK::Point_3;
- using Iso_cuboid_3 = PK::Iso_cuboid_3;
-
- static const bool weighted = false;
- static const bool periodic = true;
-
- // Default value_from_iterator as Alpha_shape_3 is not exact
- template<class Filtration_value, class Alpha_value_iterator>
- static Filtration_value value_from_iterator(const Alpha_value_iterator avi) {
- return /*std::sqrt*/ *avi;
- }
-};
-
-class Weighted_periodic_alpha_shapes_3d {
-private:
- using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
- using Periodic_kernel = CGAL::Periodic_3_regular_triangulation_traits_3<Kernel>;
- using DsVb = CGAL::Periodic_3_triangulation_ds_vertex_base_3<>;
- using Vb = CGAL::Regular_triangulation_vertex_base_3<Periodic_kernel, DsVb>;
- using AsVb = CGAL::Alpha_shape_vertex_base_3<Periodic_kernel, Vb>;
- using DsCb = CGAL::Periodic_3_triangulation_ds_cell_base_3<>;
- using Cb = CGAL::Regular_triangulation_cell_base_3<Periodic_kernel, DsCb>;
- using AsCb = CGAL::Alpha_shape_cell_base_3<Periodic_kernel, Cb>;
- using Tds = CGAL::Triangulation_data_structure_3<AsVb, AsCb>;
-
-public:
- using Periodic_delaunay_triangulation_3 = CGAL::Periodic_3_regular_triangulation_3<Periodic_kernel, Tds>;
- using Alpha_shape_3 = CGAL::Alpha_shape_3<Periodic_delaunay_triangulation_3>;
- using Point_3 = Periodic_delaunay_triangulation_3::Bare_point;
- using Weighted_point_3 = Periodic_delaunay_triangulation_3::Weighted_point;
- using Iso_cuboid_3 = Periodic_kernel::Iso_cuboid_3;
-
- static const bool weighted = true;
- static const bool periodic = true;
-
- // Default value_from_iterator as Alpha_shape_3 is not exact
- template<class Filtration_value, class Alpha_value_iterator>
- static Filtration_value value_from_iterator(const Alpha_value_iterator avi) {
- return /*std::sqrt*/ *avi;
- }
-};
-
-} // namespace alpha_complex
-
-} // namespace Gudhi
-
-#endif // ALPHA_COMPLEX_3D_OPTIONS_H_
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_options.h b/src/Alpha_complex/include/gudhi/Alpha_complex_options.h
new file mode 100644
index 00000000..32980fa7
--- /dev/null
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex_options.h
@@ -0,0 +1,64 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Vincent Rouvreau
+ *
+ * Copyright (C) 2018 Inria
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ALPHA_COMPLEX_OPTIONS_H_
+#define ALPHA_COMPLEX_OPTIONS_H_
+
+
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
+#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
+#include <CGAL/Periodic_3_regular_triangulation_3.h>
+#include <CGAL/Regular_triangulation_3.h>
+#include <CGAL/Alpha_shape_3.h>
+#include <CGAL/Alpha_shape_cell_base_3.h>
+#include <CGAL/Alpha_shape_vertex_base_3.h>
+
+
+namespace Gudhi {
+
+namespace alpha_complex {
+
+
+/**
+ * \class complexity
+ * \brief Alpha complex complexity template parameter possible values.
+ *
+ * \ingroup alpha_complex
+ */
+enum class complexity: char
+{
+ /** \brief Fast version.*/
+ fast='f',
+ /** \brief Safe version.*/
+ safe='s',
+ /** \brief Exact version.*/
+ exact='e',
+};
+
+} // namespace alpha_complex
+
+} // namespace Gudhi
+
+#endif // ALPHA_COMPLEX_OPTIONS_H_
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 7cc21475..2bd925d3 100644
--- a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp
+++ b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp
@@ -30,9 +30,9 @@
#include <string>
#include <vector>
#include <random>
+#include <cstddef> // for std::size_t
#include <gudhi/Alpha_complex_3d.h>
-#include <gudhi/Alpha_complex_3d_options.h>
#include <gudhi/graph_simplicial_complex.h>
#include <gudhi/Simplex_tree.h>
#include <gudhi/Unitary_tests_utils.h>
@@ -111,9 +111,9 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) {
}
}
-#ifdef GUDHI_DEBUG
typedef boost::mpl::list<Fast_weighted_alpha_complex_3d, Exact_weighted_alpha_complex_3d> weighted_variants_type_list;
+#ifdef GUDHI_DEBUG
BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_throw, Weighted_alpha_complex_3d, weighted_variants_type_list) {
using Point_3 = typename Weighted_alpha_complex_3d::Point_3;
std::vector<Point_3> w_points;
@@ -132,61 +132,55 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_throw, Weighted_alpha_compl
}
#endif
-BOOST_AUTO_TEST_CASE(Alpha_complex_weighted) {
- // ---------------------
- // Fast weighted version
- // ---------------------
- std::cout << "Fast weighted alpha complex 3d" << std::endl;
- std::vector<Fast_weighted_alpha_complex_3d::Point_3> w_points;
- w_points.push_back(Fast_weighted_alpha_complex_3d::Point_3(0.0, 0.0, 0.0));
- w_points.push_back(Fast_weighted_alpha_complex_3d::Point_3(0.0, 0.0, 0.2));
- w_points.push_back(Fast_weighted_alpha_complex_3d::Point_3(0.2, 0.0, 0.2));
- w_points.push_back(Fast_weighted_alpha_complex_3d::Point_3(0.6, 0.6, 0.0));
- w_points.push_back(Fast_weighted_alpha_complex_3d::Point_3(0.8, 0.8, 0.2));
- w_points.push_back(Fast_weighted_alpha_complex_3d::Point_3(0.2, 0.8, 0.6));
+BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted, Weighted_alpha_complex_3d, weighted_variants_type_list) {
+ std::cout << "Weighted alpha complex 3d from points and weights" << std::endl;
+ using Point_3 = typename Weighted_alpha_complex_3d::Point_3;
+ std::vector<Point_3> w_points;
+ w_points.push_back(Point_3(0.0, 0.0, 0.0));
+ w_points.push_back(Point_3(0.0, 0.0, 0.2));
+ w_points.push_back(Point_3(0.2, 0.0, 0.2));
+ w_points.push_back(Point_3(0.6, 0.6, 0.0));
+ w_points.push_back(Point_3(0.8, 0.8, 0.2));
+ w_points.push_back(Point_3(0.2, 0.8, 0.6));
// weights size is different from w_points size to make weighted Alpha_complex_3d throw in debug mode
std::vector<double> weights = {0.01, 0.005, 0.006, 0.01, 0.009, 0.001};
- Fast_weighted_alpha_complex_3d weighted_alpha_complex(w_points, weights);
+ Weighted_alpha_complex_3d alpha_complex_p_a_w(w_points, weights);
Gudhi::Simplex_tree<> stree;
- weighted_alpha_complex.create_complex(stree);
+ alpha_complex_p_a_w.create_complex(stree);
- // ----------------------
- // Exact weighted version
- // ----------------------
- std::cout << "Exact weighted alpha complex 3d" << std::endl;
+ std::cout << "Weighted alpha complex 3d from weighted points" << std::endl;
+ using Weighted_point_3 = typename Weighted_alpha_complex_3d::Triangulation_3::Weighted_point;
- std::vector<Exact_weighted_alpha_complex_3d::Point_3> e_w_points;
- e_w_points.push_back(Exact_weighted_alpha_complex_3d::Point_3(0.0, 0.0, 0.0));
- e_w_points.push_back(Exact_weighted_alpha_complex_3d::Point_3(0.0, 0.0, 0.2));
- e_w_points.push_back(Exact_weighted_alpha_complex_3d::Point_3(0.2, 0.0, 0.2));
- e_w_points.push_back(Exact_weighted_alpha_complex_3d::Point_3(0.6, 0.6, 0.0));
- e_w_points.push_back(Exact_weighted_alpha_complex_3d::Point_3(0.8, 0.8, 0.2));
- e_w_points.push_back(Exact_weighted_alpha_complex_3d::Point_3(0.2, 0.8, 0.6));
- Exact_weighted_alpha_complex_3d exact_alpha_complex(e_w_points, weights);
+ std::vector<Weighted_point_3> weighted_points;
- Gudhi::Simplex_tree<> exact_stree;
- exact_alpha_complex.create_complex(exact_stree);
+ for (std::size_t i=0; i < w_points.size(); i++) {
+ weighted_points.push_back(Weighted_point_3(w_points[i], weights[i]));
+ }
+ Weighted_alpha_complex_3d alpha_complex_w_p(weighted_points);
+
+ Gudhi::Simplex_tree<> stree_bis;
+ alpha_complex_w_p.create_complex(stree_bis);
// ---------------------
// Compare both versions
// ---------------------
- std::cout << "Exact weighted alpha complex 3d is of dimension " << exact_stree.dimension()
- << " - Non exact is " << stree.dimension() << std::endl;
- BOOST_CHECK(exact_stree.dimension() == stree.dimension());
- std::cout << "Exact weighted alpha complex 3d num_simplices " << exact_stree.num_simplices()
- << " - Non exact is " << stree.num_simplices() << std::endl;
- BOOST_CHECK(exact_stree.num_simplices() == stree.num_simplices());
- std::cout << "Exact weighted alpha complex 3d num_vertices " << exact_stree.num_vertices()
- << " - Non exact is " << stree.num_vertices() << std::endl;
- BOOST_CHECK(exact_stree.num_vertices() == stree.num_vertices());
+ std::cout << "Weighted alpha complex 3d is of dimension " << stree_bis.dimension()
+ << " - versus " << stree.dimension() << std::endl;
+ BOOST_CHECK(stree_bis.dimension() == stree.dimension());
+ std::cout << "Weighted alpha complex 3d num_simplices " << stree_bis.num_simplices()
+ << " - versus " << stree.num_simplices() << std::endl;
+ BOOST_CHECK(stree_bis.num_simplices() == stree.num_simplices());
+ std::cout << "Weighted alpha complex 3d num_vertices " << stree_bis.num_vertices()
+ << " - versus " << stree.num_vertices() << std::endl;
+ BOOST_CHECK(stree_bis.num_vertices() == stree.num_vertices());
auto sh = stree.filtration_simplex_range().begin();
while(sh != stree.filtration_simplex_range().end()) {
std::vector<int> simplex;
std::vector<int> exact_simplex;
- std::cout << "Non-exact ( ";
+ std::cout << " ( ";
for (auto vertex : stree.simplex_vertex_range(*sh)) {
simplex.push_back(vertex);
std::cout << vertex << " ";
@@ -195,11 +189,11 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_weighted) {
std::cout << std::endl;
// Find it in the exact structure
- auto sh_exact = exact_stree.find(simplex);
- BOOST_CHECK(sh_exact != exact_stree.null_simplex());
+ auto sh_exact = stree_bis.find(simplex);
+ BOOST_CHECK(sh_exact != stree_bis.null_simplex());
// 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));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(stree_bis.filtration(sh_exact), stree.filtration(*sh));
++sh;
}
@@ -207,7 +201,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_weighted) {
}
#ifdef GUDHI_DEBUG
-typedef boost::mpl::list<Fast_periodic_alpha_complex_3d, Fast_periodic_alpha_complex_3d> periodic_variants_type_list;
+typedef boost::mpl::list<Fast_periodic_alpha_complex_3d, Exact_periodic_alpha_complex_3d> periodic_variants_type_list;
BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_periodic_throw, Periodic_alpha_complex_3d, periodic_variants_type_list) {
std::cout << "Periodic alpha complex 3d exception throw" << std::endl;
@@ -541,10 +535,11 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_periodic) {
}
-#ifdef GUDHI_DEBUG
-typedef boost::mpl::list<Fast_weighted_periodic_alpha_complex_3d, Fast_weighted_periodic_alpha_complex_3d> wp_variants_type_list;
+typedef boost::mpl::list<Fast_weighted_periodic_alpha_complex_3d, Exact_weighted_periodic_alpha_complex_3d> wp_variants_type_list;
-BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic_throw, Weighted_periodic_alpha_complex_3d, wp_variants_type_list) {
+#ifdef GUDHI_DEBUG
+BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic_throw, Weighted_periodic_alpha_complex_3d,
+ wp_variants_type_list) {
std::cout << "Weighted periodic alpha complex 3d exception throw" << std::endl;
using Point_3 = typename Weighted_periodic_alpha_complex_3d::Point_3;
@@ -722,311 +717,186 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic_throw, Weighted_pe
}
#endif
-BOOST_AUTO_TEST_CASE(Alpha_complex_weighted_periodic) {
- // ------------------------------
- // Fast weighted periodic version
- // ------------------------------
- std::cout << "Fast weighted periodic alpha complex 3d" << std::endl;
-
- std::vector<Fast_weighted_periodic_alpha_complex_3d::Point_3> wp_points;
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.1, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.6));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.8));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.0));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.2));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.4));
- wp_points.push_back(Fast_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.6));
-
- std::vector<double> p_weights;
+BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic, Weighted_periodic_alpha_complex_3d,
+ wp_variants_type_list) {
+ std::cout << "Weighted Periodic alpha complex 3d from points and weights" << std::endl;
+ using Point_3 = typename Weighted_periodic_alpha_complex_3d::Point_3;
+ std::vector<Point_3> points;
+
+ points.push_back(Point_3(0.0, 0.0, 0.2));
+ points.push_back(Point_3(0.0, 0.0, 0.4));
+ points.push_back(Point_3(0.0, 0.0, 0.6));
+ points.push_back(Point_3(0.0, 0.0, 0.8));
+ points.push_back(Point_3(0.0, 0.2, 0.0));
+ points.push_back(Point_3(0.0, 0.2, 0.2));
+ points.push_back(Point_3(0.0, 0.2, 0.4));
+ points.push_back(Point_3(0.0, 0.2, 0.6));
+ points.push_back(Point_3(0.0, 0.2, 0.8));
+ points.push_back(Point_3(0.0, 0.4, 0.0));
+ points.push_back(Point_3(0.0, 0.4, 0.2));
+ points.push_back(Point_3(0.0, 0.4, 0.4));
+ points.push_back(Point_3(0.0, 0.4, 0.6));
+ points.push_back(Point_3(0.0, 0.4, 0.8));
+ points.push_back(Point_3(0.0, 0.6, 0.0));
+ points.push_back(Point_3(0.0, 0.6, 0.2));
+ points.push_back(Point_3(0.0, 0.6, 0.4));
+ points.push_back(Point_3(0.0, 0.6, 0.6));
+ points.push_back(Point_3(0.0, 0.6, 0.8));
+ points.push_back(Point_3(0.0, 0.8, 0.0));
+ points.push_back(Point_3(0.0, 0.8, 0.2));
+ points.push_back(Point_3(0.0, 0.8, 0.4));
+ points.push_back(Point_3(0.0, 0.8, 0.6));
+ points.push_back(Point_3(0.0, 0.8, 0.8));
+ points.push_back(Point_3(0.2, 0.0, 0.0));
+ points.push_back(Point_3(0.2, 0.0, 0.2));
+ points.push_back(Point_3(0.2, 0.0, 0.4));
+ points.push_back(Point_3(0.2, 0.0, 0.6));
+ points.push_back(Point_3(0.2, 0.0, 0.8));
+ points.push_back(Point_3(0.2, 0.2, 0.0));
+ points.push_back(Point_3(0.2, 0.2, 0.2));
+ points.push_back(Point_3(0.2, 0.2, 0.4));
+ points.push_back(Point_3(0.2, 0.2, 0.6));
+ points.push_back(Point_3(0.2, 0.2, 0.8));
+ points.push_back(Point_3(0.2, 0.4, 0.0));
+ points.push_back(Point_3(0.2, 0.4, 0.2));
+ points.push_back(Point_3(0.2, 0.4, 0.4));
+ points.push_back(Point_3(0.2, 0.4, 0.6));
+ points.push_back(Point_3(0.2, 0.4, 0.8));
+ points.push_back(Point_3(0.2, 0.6, 0.0));
+ points.push_back(Point_3(0.2, 0.6, 0.2));
+ points.push_back(Point_3(0.2, 0.6, 0.4));
+ points.push_back(Point_3(0.2, 0.6, 0.6));
+ points.push_back(Point_3(0.2, 0.6, 0.8));
+ points.push_back(Point_3(0.0, 0.0, 0.0));
+ points.push_back(Point_3(0.2, 0.8, 0.0));
+ points.push_back(Point_3(0.2, 0.8, 0.2));
+ points.push_back(Point_3(0.2, 0.8, 0.4));
+ points.push_back(Point_3(0.2, 0.8, 0.6));
+ points.push_back(Point_3(0.2, 0.8, 0.8));
+ points.push_back(Point_3(0.4, 0.0, 0.0));
+ points.push_back(Point_3(0.4, 0.0, 0.2));
+ points.push_back(Point_3(0.4, 0.0, 0.4));
+ points.push_back(Point_3(0.4, 0.0, 0.6));
+ points.push_back(Point_3(0.4, 0.0, 0.8));
+ points.push_back(Point_3(0.4, 0.2, 0.0));
+ points.push_back(Point_3(0.4, 0.2, 0.2));
+ points.push_back(Point_3(0.4, 0.2, 0.4));
+ points.push_back(Point_3(0.4, 0.2, 0.6));
+ points.push_back(Point_3(0.4, 0.2, 0.8));
+ points.push_back(Point_3(0.4, 0.4, 0.0));
+ points.push_back(Point_3(0.4, 0.4, 0.2));
+ points.push_back(Point_3(0.4, 0.4, 0.4));
+ points.push_back(Point_3(0.4, 0.4, 0.6));
+ points.push_back(Point_3(0.4, 0.4, 0.8));
+ points.push_back(Point_3(0.4, 0.6, 0.0));
+ points.push_back(Point_3(0.4, 0.6, 0.2));
+ points.push_back(Point_3(0.4, 0.6, 0.4));
+ points.push_back(Point_3(0.4, 0.6, 0.6));
+ points.push_back(Point_3(0.4, 0.6, 0.8));
+ points.push_back(Point_3(0.4, 0.8, 0.0));
+ points.push_back(Point_3(0.4, 0.8, 0.2));
+ points.push_back(Point_3(0.4, 0.8, 0.4));
+ points.push_back(Point_3(0.4, 0.8, 0.6));
+ points.push_back(Point_3(0.4, 0.8, 0.8));
+ points.push_back(Point_3(0.6, 0.0, 0.0));
+ points.push_back(Point_3(0.6, 0.0, 0.2));
+ points.push_back(Point_3(0.6, 0.0, 0.4));
+ points.push_back(Point_3(0.6, 0.0, 0.6));
+ points.push_back(Point_3(0.6, 0.0, 0.8));
+ points.push_back(Point_3(0.6, 0.1, 0.0));
+ points.push_back(Point_3(0.6, 0.2, 0.0));
+ points.push_back(Point_3(0.6, 0.2, 0.2));
+ points.push_back(Point_3(0.6, 0.2, 0.4));
+ points.push_back(Point_3(0.6, 0.2, 0.6));
+ points.push_back(Point_3(0.6, 0.2, 0.8));
+ points.push_back(Point_3(0.6, 0.4, 0.0));
+ points.push_back(Point_3(0.6, 0.4, 0.2));
+ points.push_back(Point_3(0.6, 0.4, 0.4));
+ points.push_back(Point_3(0.6, 0.4, 0.6));
+ points.push_back(Point_3(0.6, 0.4, 0.8));
+ points.push_back(Point_3(0.6, 0.6, 0.0));
+ points.push_back(Point_3(0.6, 0.6, 0.2));
+ points.push_back(Point_3(0.6, 0.6, 0.4));
+ points.push_back(Point_3(0.6, 0.6, 0.6));
+ points.push_back(Point_3(0.6, 0.6, 0.8));
+ points.push_back(Point_3(0.6, 0.8, 0.0));
+ points.push_back(Point_3(0.6, 0.8, 0.2));
+ points.push_back(Point_3(0.6, 0.8, 0.4));
+ points.push_back(Point_3(0.6, 0.8, 0.6));
+ points.push_back(Point_3(0.6, 0.8, 0.8));
+ points.push_back(Point_3(0.8, 0.0, 0.0));
+ points.push_back(Point_3(0.8, 0.0, 0.2));
+ points.push_back(Point_3(0.8, 0.0, 0.4));
+ points.push_back(Point_3(0.8, 0.0, 0.6));
+ points.push_back(Point_3(0.8, 0.0, 0.8));
+ points.push_back(Point_3(0.8, 0.2, 0.0));
+ points.push_back(Point_3(0.8, 0.2, 0.2));
+ points.push_back(Point_3(0.8, 0.2, 0.4));
+ points.push_back(Point_3(0.8, 0.2, 0.6));
+ points.push_back(Point_3(0.8, 0.2, 0.8));
+ points.push_back(Point_3(0.8, 0.4, 0.0));
+ points.push_back(Point_3(0.8, 0.4, 0.2));
+ points.push_back(Point_3(0.8, 0.4, 0.4));
+ points.push_back(Point_3(0.8, 0.4, 0.6));
+ points.push_back(Point_3(0.8, 0.4, 0.8));
+ points.push_back(Point_3(0.8, 0.6, 0.0));
+ points.push_back(Point_3(0.8, 0.6, 0.2));
+ points.push_back(Point_3(0.8, 0.6, 0.4));
+ points.push_back(Point_3(0.8, 0.6, 0.6));
+ points.push_back(Point_3(0.8, 0.6, 0.8));
+ points.push_back(Point_3(0.8, 0.8, 0.0));
+ points.push_back(Point_3(0.8, 0.8, 0.2));
+ points.push_back(Point_3(0.8, 0.8, 0.4));
+ points.push_back(Point_3(0.8, 0.8, 0.6));
+
+ std::vector<double> weights;
std::random_device rd;
std::mt19937 mt(rd());
// Weights must be in range [0, <1/64]
std::uniform_real_distribution<double> dist(0.01, 0.0156245);
- for (std::size_t i = 0; i < wp_points.size(); ++i) {
+ for (std::size_t i = 0; i < points.size(); ++i) {
double value = dist(mt);
- p_weights.push_back(value);
+ weights.push_back(value);
}
- Fast_weighted_periodic_alpha_complex_3d weighted_periodic_alpha_complex(wp_points, p_weights, 0., 0., 0., 1., 1., 1.);
+ Weighted_periodic_alpha_complex_3d weighted_periodic_alpha_complex(points, weights, 0., 0., 0., 1., 1., 1.);
Gudhi::Simplex_tree<> stree;
weighted_periodic_alpha_complex.create_complex(stree);
- // -------------------------------
- // Exact weighted periodic version
- // -------------------------------
- std::cout << "Exact weighted periodic alpha complex 3d" << std::endl;
-
- std::vector<Exact_weighted_periodic_alpha_complex_3d::Point_3> e_wp_points;
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.2, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.4, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.6, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.8, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.0, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.2, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.4, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.6, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.0, 0.0, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.2, 0.8, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.0, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.2, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.4, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.6, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.4, 0.8, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.0, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.1, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.2, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.4, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.6, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.6, 0.8, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.0, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.2, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.4, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.6));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.6, 0.8));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.0));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.2));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.4));
- e_wp_points.push_back(Exact_weighted_periodic_alpha_complex_3d::Point_3(0.8, 0.8, 0.6));
-
- Exact_weighted_periodic_alpha_complex_3d e_weighted_periodic_alpha_complex(e_wp_points, p_weights, 0., 0., 0., 1., 1., 1.);
+ std::cout << "Weighted periodic alpha complex 3d from weighted points" << std::endl;
+ using Weighted_point_3 = typename Weighted_periodic_alpha_complex_3d::Triangulation_3::Weighted_point;
- Gudhi::Simplex_tree<> exact_stree;
- e_weighted_periodic_alpha_complex.create_complex(exact_stree);
+ std::vector<Weighted_point_3> weighted_points;
+
+ for (std::size_t i=0; i < points.size(); i++) {
+ weighted_points.push_back(Weighted_point_3(points[i], weights[i]));
+ }
+ Weighted_periodic_alpha_complex_3d alpha_complex_w_p(weighted_points, 0., 0., 0., 1., 1., 1.);
+
+ Gudhi::Simplex_tree<> stree_bis;
+ alpha_complex_w_p.create_complex(stree_bis);
// ---------------------
// Compare both versions
// ---------------------
- std::cout << "Exact periodic alpha complex 3d is of dimension " << exact_stree.dimension()
- << " - Non exact is " << stree.dimension() << std::endl;
- BOOST_CHECK(exact_stree.dimension() == stree.dimension());
- std::cout << "Exact periodic alpha complex 3d num_simplices " << exact_stree.num_simplices()
- << " - Non exact is " << stree.num_simplices() << std::endl;
- // TODO(VR): BOOST_CHECK(exact_stree.num_simplices() == stree.num_simplices());
- std::cout << "Exact periodic alpha complex 3d num_vertices " << exact_stree.num_vertices()
- << " - Non exact is " << stree.num_vertices() << std::endl;
- BOOST_CHECK(exact_stree.num_vertices() == stree.num_vertices());
+ std::cout << "Weighted periodic alpha complex 3d is of dimension " << stree_bis.dimension()
+ << " - versus " << stree.dimension() << std::endl;
+ BOOST_CHECK(stree_bis.dimension() == stree.dimension());
+ std::cout << "Weighted periodic alpha complex 3d num_simplices " << stree_bis.num_simplices()
+ << " - versus " << stree.num_simplices() << std::endl;
+ BOOST_CHECK(stree_bis.num_simplices() == stree.num_simplices());
+ std::cout << "Weighted periodic alpha complex 3d num_vertices " << stree_bis.num_vertices()
+ << " - versus " << stree.num_vertices() << std::endl;
+ BOOST_CHECK(stree_bis.num_vertices() == stree.num_vertices());
auto sh = stree.filtration_simplex_range().begin();
while(sh != stree.filtration_simplex_range().end()) {
std::vector<int> simplex;
std::vector<int> exact_simplex;
- std::cout << "Non-exact ( ";
+ std::cout << " ( ";
for (auto vertex : stree.simplex_vertex_range(*sh)) {
simplex.push_back(vertex);
std::cout << vertex << " ";
@@ -1035,11 +905,12 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_weighted_periodic) {
std::cout << std::endl;
// Find it in the exact structure
- auto sh_exact = exact_stree.find(simplex);
- // TODO(VR): BOOST_CHECK(sh_exact != exact_stree.null_simplex());
+ auto sh_exact = stree_bis.find(simplex);
+ BOOST_CHECK(sh_exact != stree_bis.null_simplex());
// Exact and non-exact version is not exactly the same due to float comparison
- // TODO(VR): GUDHI_TEST_FLOAT_EQUALITY_CHECK(exact_stree.filtration(sh_exact), stree.filtration(*sh));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(stree_bis.filtration(sh_exact), stree.filtration(*sh));
+
++sh;
}
diff --git a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp
index 536de444..1a152541 100644
--- a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp
+++ b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp
@@ -24,7 +24,6 @@
#include <boost/variant.hpp>
#include <gudhi/Alpha_complex_3d.h>
-#include <gudhi/Alpha_complex_3d_options.h>
#include <gudhi/Simplex_tree.h>
#include <gudhi/Persistent_cohomology.h>
#include <gudhi/Points_3D_off_io.h>
@@ -34,16 +33,24 @@
#include <vector>
// gudhi type definition
-using Weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::Weighted_periodic_alpha_shapes_3d>;
-using Periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::Periodic_alpha_shapes_3d>;
-using Weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::Weighted_alpha_shapes_3d>;
-using Exact_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::Exact_alpha_shapes_3d>;
-using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::Alpha_shapes_3d>;
using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
using Filtration_value = Simplex_tree::Filtration_value;
using Persistent_cohomology =
Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Gudhi::persistent_cohomology::Field_Zp>;
+using Fast_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast, false, false>;
+using Safe_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe, false, false>;
+using Exact_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact, false, false>;
+using Fast_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast, true, false>;
+using Safe_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe, true, false>;
+using Exact_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact, true, false>;
+using Fast_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast, false, true>;
+using Safe_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe, false, true>;
+using Exact_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact, false, true>;
+using Fast_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast, true, true>;
+using Safe_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe, true, true>;
+using Exact_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact, true, true>;
+
void program_options(int argc, char *argv[], std::string &off_file_points, bool& exact, std::string &weight_file,
std::string &cuboid_file, std::string &output_file_diag, Filtration_value &alpha_square_max_value,
int &coeff_field_characteristic, Filtration_value &min_persistence);
@@ -98,6 +105,72 @@ int main(int argc, char **argv) {
program_options(argc, argv, off_file_points, exact_version, weight_file, cuboid_file, output_file_diag,
alpha_square_max_value, coeff_field_characteristic, min_persistence);
+ Gudhi::alpha_complex::complexity complexity = Gudhi::alpha_complex::complexity::fast;
+ if (exact_version) {
+ complexity = Gudhi::alpha_complex::complexity::exact;
+ }
+
+ switch(complexity) {
+ case Gudhi::alpha_complex::complexity::fast:
+ if (weighted_version) {
+ if (periodic_version) {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast,
+ true, true>;
+ } else {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast,
+ true, false>;
+ }
+ } else {
+ if (periodic_version) {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast,
+ false, true>;
+ } else {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::fast,
+ false, false>;
+ }
+ }
+ break;
+ case Gudhi::alpha_complex::complexity::exact:
+ if (weighted_version) {
+ if (periodic_version) {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact,
+ true, true>;
+ } else {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact,
+ true, false>;
+ }
+ } else {
+ if (periodic_version) {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact,
+ false, true>;
+ } else {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::exact,
+ false, false>;
+ }
+ }
+ break;
+ case Gudhi::alpha_complex::complexity::safe:
+ if (weighted_version) {
+ if (periodic_version) {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe,
+ true, true>;
+ } else {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe,
+ true, false>;
+ }
+ } else {
+ if (periodic_version) {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe,
+ false, true>;
+ } else {
+ using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::safe,
+ false, false>;
+ }
+ }
+ break;
+ }
+
+ /*const Gudhi::alpha_complex::complexity complexity_(complexity);
// Read the OFF file (input file name given as parameter) and triangulate points
Gudhi::Points_3D_off_reader<Alpha_complex_3d::Point_3> off_reader(off_file_points);
// Check the read operation was correct
@@ -127,35 +200,26 @@ int main(int argc, char **argv) {
Simplex_tree simplex_tree;
- if (exact_version) {
- if ((weighted_version) || (periodic_version)) {
- std::cerr << "Unable to compute exact version of a weighted and/or periodic alpha shape" << std::endl;
- exit(-1);
+ if (weighted_version) {
+ if (periodic_version) {
+ Alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights,
+ x_min, y_min, z_min, x_max, y_max, z_max);
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
} else {
- Exact_alpha_complex_3d alpha_complex(off_reader.get_point_cloud());
+ Alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights);
create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
}
} else {
- if (weighted_version) {
- if (periodic_version) {
- Weighted_periodic_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights,
- x_min, y_min, z_min, x_max, y_max, z_max);
- create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
- } else {
- Weighted_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights);
- create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
- }
+ if (periodic_version) {
+ Alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), x_min, y_min, z_min, x_max, y_max, z_max);
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
} else {
- if (periodic_version) {
- Periodic_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), x_min, y_min, z_min, x_max, y_max, z_max);
- create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
- } else {
- Alpha_complex_3d alpha_complex(off_reader.get_point_cloud());
- create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
- }
+ Alpha_complex_3d alpha_complex(off_reader.get_point_cloud());
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
}
}
+
// Sort the simplices in the order of the filtration
simplex_tree.initialize_filtration();
@@ -175,7 +239,7 @@ int main(int argc, char **argv) {
std::ofstream out(output_file_diag);
pcoh.output_diagram(out);
out.close();
- }
+ }*/
return 0;
}