summaryrefslogtreecommitdiff
path: root/src/Cech_complex/include/gudhi
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cech_complex/include/gudhi')
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex.h19
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex_blocker.h18
-rw-r--r--src/Cech_complex/include/gudhi/Sphere_circumradius.h (renamed from src/Cech_complex/include/gudhi/sphere_circumradius.h)2
3 files changed, 20 insertions, 19 deletions
diff --git a/src/Cech_complex/include/gudhi/Cech_complex.h b/src/Cech_complex/include/gudhi/Cech_complex.h
index 375be1d2..fc39f75b 100644
--- a/src/Cech_complex/include/gudhi/Cech_complex.h
+++ b/src/Cech_complex/include/gudhi/Cech_complex.h
@@ -11,7 +11,7 @@
#ifndef CECH_COMPLEX_H_
#define CECH_COMPLEX_H_
-#include <gudhi/sphere_circumradius.h> // for Gudhi::cech_complex::Sphere_circumradius
+#include <gudhi/Sphere_circumradius.h> // for Gudhi::cech_complex::Sphere_circumradius
#include <gudhi/graph_simplicial_complex.h> // for Gudhi::Proximity_graph
#include <gudhi/Debug_utils.h> // for GUDHI_CHECK
#include <gudhi/Cech_complex_blocker.h> // for Gudhi::cech_complex::Cech_blocker
@@ -25,15 +25,15 @@ namespace cech_complex {
/**
* \class Cech_complex
- * \brief Cech complex data structure.
+ * \brief Cech complex class.
*
* \ingroup cech_complex
*
* \details
- * The data structure is a proximity graph, containing edges when the edge length is less or equal
- * to a given max_radius. Edge length is computed from `Gudhi::cech_complex::Sphere_circumradius` distance function.
+ * Cech complex is a simplicial complex constructed from a proximity graph, where the set of all simplices is filtered
+ * by the radius of their minimal enclosing ball and bounded by the given max_radius.
*
- * \tparam Kernel CGAL kernel.
+ * \tparam Kernel CGAL kernel: either Epick_d or Epeck_d.
*
* \tparam SimplicialComplexForCechComplex furnishes `Vertex_handle` and `Filtration_value` type definition required
* by `Gudhi::Proximity_graph` and Cech blocker.
@@ -58,15 +58,16 @@ class Cech_complex {
using Sphere = typename cech_blocker::Sphere;
public:
- /** \brief Cech_complex constructor from a list of points.
+ /** \brief Cech_complex constructor from a range of points.
*
- * @param[in] points Vector of points where each point is defined as `kernel::Point_d`.
+ * @param[in] points Range of points where each point is defined as `kernel::Point_d`.
* @param[in] max_radius Maximal radius value.
*
*/
- Cech_complex(const Point_cloud & points, Filtration_value max_radius) : max_radius_(max_radius) {
+ template<typename InputPointRange >
+ Cech_complex(const InputPointRange & points, Filtration_value max_radius) : max_radius_(max_radius) {
- point_cloud_.assign(points.begin(), points.end());
+ point_cloud_.assign(std::begin(points), std::end(points));
cech_skeleton_graph_ = Gudhi::compute_proximity_graph<SimplicialComplexForCechComplex>(
point_cloud_, max_radius_, Sphere_circumradius<Kernel>());
diff --git a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
index 1a696422..1a09f7e1 100644
--- a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
+++ b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
@@ -11,7 +11,7 @@
#ifndef CECH_COMPLEX_BLOCKER_H_
#define CECH_COMPLEX_BLOCKER_H_
-#include <CGAL/NT_converter.h> // for casting from FT to double
+#include <CGAL/NT_converter.h> // for casting from FT to Filtration_value and double to FT
#include <iostream>
#include <vector>
@@ -36,7 +36,7 @@ namespace cech_complex {
*
* \tparam Cech_complex is required by the blocker.
*
- * \tparam Kernel CGAL kernel.
+ * \tparam Kernel CGAL kernel: either Epick_d or Epeck_d.
*/
template <typename SimplicialComplexForCech, typename Cech_complex, typename Kernel>
class Cech_blocker {
@@ -69,8 +69,8 @@ class Cech_blocker {
* \return true if the simplex radius is greater than the Cech_complex max_radius*/
bool operator()(Simplex_handle sh) {
using Point_cloud = std::vector<Point_d>;
- CGAL::NT_converter<FT, double> cast_to_double;
- Filtration_value radius = 0.;
+ CGAL::NT_converter<FT, Filtration_value> cast_to_fv;
+ Filtration_value radius = 0;
// for each face of simplex sh, test outsider point is indeed inside enclosing ball, if yes, take it and exit loop, otherwise, new sphere is circumsphere of all vertices
Sphere min_enclos_ball;
@@ -105,18 +105,18 @@ class Cech_blocker {
face_points.clear();
if (kernel_.squared_distance_d_object()(sph.first, cc_ptr_->get_point(extra)) <= sph.second) {
- radius = std::sqrt(cast_to_double(sph.second));
+ radius = std::sqrt(cast_to_fv(sph.second));
#ifdef DEBUG_TRACES
std::clog << "center: " << sph.first << ", radius: " << radius << std::endl;
#endif // DEBUG_TRACES
- if (cast_to_double(sph.second) < cast_to_double(min_enclos_ball.second))
+ if (sph.second < min_enclos_ball.second)
min_enclos_ball = sph;
break;
}
}
// Get the minimal radius of all faces enclosing balls if exists
- if(cast_to_double(min_enclos_ball.second) != std::numeric_limits<double>::max()) {
- radius = std::sqrt(cast_to_double(min_enclos_ball.second));
+ if(min_enclos_ball.second != std::numeric_limits<double>::max()) {
+ radius = std::sqrt(cast_to_fv(min_enclos_ball.second));
sc_ptr_->assign_key(sh, cc_ptr_->get_cache().size());
cc_ptr_->get_cache().push_back(min_enclos_ball);
@@ -128,7 +128,7 @@ class Cech_blocker {
points.push_back(cc_ptr_->get_point(vertex));
}
Sphere sph = get_sphere(points.cbegin(), points.cend());
- radius = std::sqrt(cast_to_double(sph.second));
+ radius = std::sqrt(cast_to_fv(sph.second));
sc_ptr_->assign_key(sh, cc_ptr_->get_cache().size());
cc_ptr_->get_cache().push_back(sph);
diff --git a/src/Cech_complex/include/gudhi/sphere_circumradius.h b/src/Cech_complex/include/gudhi/Sphere_circumradius.h
index a6dec3dc..b0d9f7cc 100644
--- a/src/Cech_complex/include/gudhi/sphere_circumradius.h
+++ b/src/Cech_complex/include/gudhi/Sphere_circumradius.h
@@ -20,7 +20,7 @@ namespace Gudhi {
namespace cech_complex {
-/** @brief Compute the circumradius of the sphere passing through points given by a range of coordinates.
+/** \private @brief Compute the circumradius of the sphere passing through points given by a range of coordinates.
* The points are assumed to have the same dimension. */
template<typename Kernel>
class Sphere_circumradius {