summaryrefslogtreecommitdiff
path: root/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
diff options
context:
space:
mode:
authorHind-M <hind.montassif@gmail.com>2022-08-05 15:22:28 +0200
committerHind-M <hind.montassif@gmail.com>2022-08-05 15:22:28 +0200
commit93b4fc9db0feb92e14e176c7ee5b6bbe8cf5a832 (patch)
tree5d43e1aae64f6acdc2b8873224d50ea82f6800d5 /src/Cech_complex/include/gudhi/Cech_complex_blocker.h
parentcfdde35b30bdb49319b2806588de0e487aec654e (diff)
parent01e24eef930bbfa131fa18709ae7f080991bb00f (diff)
Merge remote-tracking branch 'upstream/master' into cech_exact
Diffstat (limited to 'src/Cech_complex/include/gudhi/Cech_complex_blocker.h')
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex_blocker.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
index 961da1fd..62b0d25c 100644
--- a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
+++ b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
@@ -54,6 +54,7 @@ class Cech_blocker {
using Simplex_handle = typename SimplicialComplexForCech::Simplex_handle;
using Filtration_value = typename SimplicialComplexForCech::Filtration_value;
+ using Simplex_key = typename SimplicialComplexForCech::Simplex_key;
template<class PointIterator>
Sphere get_sphere(PointIterator begin, PointIterator end) const {
@@ -70,7 +71,6 @@ 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, Filtration_value> cast_to_fv;
Filtration_value radius = 0;
bool is_min_enclos_ball = false;
Point_cloud points;
@@ -78,10 +78,10 @@ class Cech_blocker {
// 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
for (auto face_opposite_vertex : sc_ptr_->boundary_opposite_vertex_simplex_range(sh)) {
- Sphere sph;
auto k = sc_ptr_->key(face_opposite_vertex.first);
+ Simplex_key sph_key;
if(k != sc_ptr_->null_key()) {
- sph = cc_ptr_->get_cache().at(k);
+ sph_key = k;
}
else {
for (auto vertex : sc_ptr_->simplex_vertex_range(face_opposite_vertex.first)) {
@@ -90,25 +90,22 @@ class Cech_blocker {
std::clog << "#(" << vertex << ")#";
#endif // DEBUG_TRACES
}
- sph = get_sphere(points.cbegin(), points.cend());
// Put edge sphere in cache
- sc_ptr_->assign_key(face_opposite_vertex.first, cc_ptr_->get_cache().size());
- cc_ptr_->get_cache().push_back(sph);
+ sph_key = cc_ptr_->get_cache().size();
+ sc_ptr_->assign_key(face_opposite_vertex.first, sph_key);
+ cc_ptr_->get_cache().push_back(get_sphere(points.cbegin(), points.cend()));
// Clear face points
points.clear();
}
// Check if the minimal enclosing ball of current face contains the extra point/opposite vertex
+ Sphere const& sph = cc_ptr_->get_cache()[sph_key];
if (kernel_.squared_distance_d_object()(sph.first, cc_ptr_->get_point(face_opposite_vertex.second)) <= sph.second) {
+ is_min_enclos_ball = true;
+ sc_ptr_->assign_key(sh, sph_key);
+ radius = sc_ptr_->filtration(face_opposite_vertex.first);
#ifdef DEBUG_TRACES
std::clog << "center: " << sph.first << ", radius: " << radius << std::endl;
#endif // DEBUG_TRACES
- is_min_enclos_ball = true;
-#if CGAL_VERSION_NR >= 1050000000
- if(cc_ptr_->is_exact()) CGAL::exact(sph.second);
-#endif
- 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);
break;
}
}
@@ -121,6 +118,7 @@ class Cech_blocker {
#if CGAL_VERSION_NR >= 1050000000
if(cc_ptr_->is_exact()) CGAL::exact(sph.second);
#endif
+ CGAL::NT_converter<FT, Filtration_value> cast_to_fv;
radius = std::sqrt(cast_to_fv(sph.second));
sc_ptr_->assign_key(sh, cc_ptr_->get_cache().size());