summaryrefslogtreecommitdiff
path: root/src/Alpha_complex
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-11-19 22:00:44 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-11-19 22:00:44 +0000
commitc9f8f4b0fbe1e603015e324c980ad81213b428e2 (patch)
treebc551962fcff0ecd12d476b6102b9184141eb0c6 /src/Alpha_complex
parentff9818929e33aaf95c407ae6b7539051ca55ad88 (diff)
parent2ead33fd01bbe97e3b88070d169647c68c3db359 (diff)
Merge last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@4003 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 94bbb0a5588ceee1ecf73d0503892e2f6c78274f
Diffstat (limited to 'src/Alpha_complex')
-rw-r--r--src/Alpha_complex/doc/Intro_alpha_complex.h2
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_points.cpp20
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h82
3 files changed, 43 insertions, 61 deletions
diff --git a/src/Alpha_complex/doc/Intro_alpha_complex.h b/src/Alpha_complex/doc/Intro_alpha_complex.h
index fddab003..ab7c4794 100644
--- a/src/Alpha_complex/doc/Intro_alpha_complex.h
+++ b/src/Alpha_complex/doc/Intro_alpha_complex.h
@@ -106,7 +106,7 @@ namespace alpha_complex {
* \quad\quad\quad\quad \text{filtration(} \tau \text{) = min( filtration(} \tau \text{), filtration(} \sigma
* \text{) )}\\
* \quad\quad\quad \textbf{else}\\
- * \quad\quad\quad\quad \textbf{if } \textbf{if } \tau \text{ is not Gabriel for } \sigma \textbf{ then}\\
+ * \quad\quad\quad\quad \textbf{if } \tau \text{ is not Gabriel for } \sigma \textbf{ then}\\
* \quad\quad\quad\quad\quad \text{filtration(} \tau \text{) = filtration(} \sigma \text{)}\\
* \quad\quad\quad\quad \textbf{end if}\\
* \quad\quad\quad \textbf{end if}\\
diff --git a/src/Alpha_complex/example/Alpha_complex_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
index c19f7cc8..981aa470 100644
--- a/src/Alpha_complex/example/Alpha_complex_from_points.cpp
+++ b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
@@ -5,29 +5,13 @@
#include <CGAL/Epick_d.h>
#include <iostream>
-#include <string>
#include <vector>
-#include <limits> // for numeric limits
using Kernel = CGAL::Epick_d< CGAL::Dimension_tag<2> >;
using Point = Kernel::Point_d;
using Vector_of_points = std::vector<Point>;
-void usage(int nbArgs, char * const progName) {
- std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
- std::cerr << "Usage: " << progName << " [alpha_square_max_value]\n";
- std::cerr << " i.e.: " << progName << " 60.0\n";
- exit(-1); // ----- >>
-}
-
-int main(int argc, char **argv) {
- if ((argc != 1) && (argc != 2)) usage(argc, (argv[0] - 1));
-
- // Delaunay complex if alpha_square_max_value is not given by the user.
- double alpha_square_max_value {std::numeric_limits<double>::infinity()};
- if (argc == 2)
- alpha_square_max_value = atof(argv[1]);
-
+int main() {
// ----------------------------------------------------------------------------
// Init of a list of points
// ----------------------------------------------------------------------------
@@ -46,7 +30,7 @@ int main(int argc, char **argv) {
Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex_from_points(points);
Gudhi::Simplex_tree<> simplex;
- if (alpha_complex_from_points.create_complex(simplex, alpha_square_max_value)) {
+ if (alpha_complex_from_points.create_complex(simplex)) {
// ----------------------------------------------------------------------------
// Display information about the alpha complex
// ----------------------------------------------------------------------------
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index 5c577c29..53216e2f 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -228,11 +228,6 @@ class Alpha_complex {
}
public:
- template <typename SimplicialComplexForAlpha>
- bool create_complex(SimplicialComplexForAlpha& complex) {
- typedef typename SimplicialComplexForAlpha::Filtration_value Filtration_value;
- return create_complex(complex, std::numeric_limits<Filtration_value>::infinity());
- }
/** \brief Inserts all Delaunay triangulation into the simplicial complex.
* It also computes the filtration values accordingly to the \ref createcomplexalgorithm
@@ -240,7 +235,8 @@ class Alpha_complex {
* \tparam SimplicialComplexForAlpha must meet `SimplicialComplexForAlpha` concept.
*
* @param[in] complex SimplicialComplexForAlpha 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.
*
@@ -252,8 +248,10 @@ class Alpha_complex {
*
* Initialization can be launched once.
*/
- template <typename SimplicialComplexForAlpha, typename Filtration_value>
- bool create_complex(SimplicialComplexForAlpha& complex, Filtration_value max_alpha_square) {
+ template <typename SimplicialComplexForAlpha,
+ typename Filtration_value = typename SimplicialComplexForAlpha::Filtration_value>
+ bool create_complex(SimplicialComplexForAlpha& complex,
+ Filtration_value max_alpha_square = std::numeric_limits<Filtration_value>::infinity()) {
// From SimplicialComplexForAlpha type required to insert into a simplicial complex (with or without subfaces).
typedef typename SimplicialComplexForAlpha::Vertex_handle Vertex_handle;
typedef typename SimplicialComplexForAlpha::Simplex_handle Simplex_handle;
@@ -275,7 +273,9 @@ class Alpha_complex {
// --------------------------------------------------------------------------------------------
// Simplex_tree construction from loop on triangulation finite full cells list
if (triangulation_->number_of_vertices() > 0) {
- for (auto cit = triangulation_->finite_full_cells_begin(); cit != triangulation_->finite_full_cells_end(); ++cit) {
+ for (auto cit = triangulation_->finite_full_cells_begin();
+ cit != triangulation_->finite_full_cells_end();
+ ++cit) {
Vector_vertex vertexVector;
#ifdef DEBUG_TRACES
std::cout << "Simplex_tree insertion ";
@@ -336,7 +336,9 @@ class Alpha_complex {
std::cout << "filt(Sigma) is NaN : filt(Sigma) =" << complex.filtration(f_simplex) << std::endl;
#endif // DEBUG_TRACES
}
- propagate_alpha_filtration(complex, f_simplex, decr_dim);
+ // No need to propagate further, unweighted points all have value 0
+ if (decr_dim > 1)
+ propagate_alpha_filtration(complex, f_simplex);
}
}
}
@@ -353,7 +355,7 @@ class Alpha_complex {
private:
template <typename SimplicialComplexForAlpha, typename Simplex_handle>
- void propagate_alpha_filtration(SimplicialComplexForAlpha& complex, Simplex_handle f_simplex, int decr_dim) {
+ void propagate_alpha_filtration(SimplicialComplexForAlpha& complex, Simplex_handle f_simplex) {
// From SimplicialComplexForAlpha type required to assign filtration values.
typedef typename SimplicialComplexForAlpha::Filtration_value Filtration_value;
#ifdef DEBUG_TRACES
@@ -382,46 +384,42 @@ class Alpha_complex {
#endif // DEBUG_TRACES
// ### Else
} else {
- // No need to compute is_gabriel for dimension <= 2
- // i.e. : Sigma = (3,1) => Tau = 1
- if (decr_dim > 1) {
- // insert the Tau points in a vector for is_gabriel function
- Vector_of_CGAL_points pointVector;
+ // insert the Tau points in a vector for is_gabriel function
+ Vector_of_CGAL_points pointVector;
#ifdef DEBUG_TRACES
- Vertex_handle vertexForGabriel = Vertex_handle();
+ Vertex_handle vertexForGabriel = Vertex_handle();
#endif // DEBUG_TRACES
- for (auto vertex : complex.simplex_vertex_range(f_boundary)) {
- pointVector.push_back(get_point(vertex));
- }
- // Retrieve the Sigma point that is not part of Tau - parameter for is_gabriel function
- Point_d point_for_gabriel;
- for (auto vertex : complex.simplex_vertex_range(f_simplex)) {
- point_for_gabriel = get_point(vertex);
- if (std::find(pointVector.begin(), pointVector.end(), point_for_gabriel) == pointVector.end()) {
+ for (auto vertex : complex.simplex_vertex_range(f_boundary)) {
+ pointVector.push_back(get_point(vertex));
+ }
+ // Retrieve the Sigma point that is not part of Tau - parameter for is_gabriel function
+ Point_d point_for_gabriel;
+ for (auto vertex : complex.simplex_vertex_range(f_simplex)) {
+ point_for_gabriel = get_point(vertex);
+ if (std::find(pointVector.begin(), pointVector.end(), point_for_gabriel) == pointVector.end()) {
#ifdef DEBUG_TRACES
- // vertex is not found in Tau
- vertexForGabriel = vertex;
+ // vertex is not found in Tau
+ vertexForGabriel = vertex;
#endif // DEBUG_TRACES
- // No need to continue loop
- break;
- }
+ // No need to continue loop
+ break;
}
- // is_gabriel function initialization
- Is_Gabriel is_gabriel = kernel_.side_of_bounded_sphere_d_object();
- bool is_gab = is_gabriel(pointVector.begin(), pointVector.end(), point_for_gabriel)
- != CGAL::ON_BOUNDED_SIDE;
+ }
+ // is_gabriel function initialization
+ Is_Gabriel is_gabriel = kernel_.side_of_bounded_sphere_d_object();
+ bool is_gab = is_gabriel(pointVector.begin(), pointVector.end(), point_for_gabriel)
+ != CGAL::ON_BOUNDED_SIDE;
#ifdef DEBUG_TRACES
- std::cout << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl;
+ std::cout << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl;
#endif // DEBUG_TRACES
- // ### If Tau is not Gabriel of Sigma
- if (false == is_gab) {
- // ### filt(Tau) = filt(Sigma)
- Filtration_value alpha_complex_filtration = complex.filtration(f_simplex);
- complex.assign_filtration(f_boundary, alpha_complex_filtration);
+ // ### If Tau is not Gabriel of Sigma
+ if (false == is_gab) {
+ // ### filt(Tau) = filt(Sigma)
+ Filtration_value alpha_complex_filtration = complex.filtration(f_simplex);
+ complex.assign_filtration(f_boundary, alpha_complex_filtration);
#ifdef DEBUG_TRACES
- std::cout << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl;
+ std::cout << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl;
#endif // DEBUG_TRACES
- }
}
}
}