12#ifndef MEB_FILTRATION_H_
13#define MEB_FILTRATION_H_
15#include <CGAL/NT_converter.h>
21namespace Gudhi::cech_complex {
45template<
bool Output_squared_values = true,
typename Kernel,
typename SimplicialComplexForMEB,
typename Po
intRange>
47 using Point_d =
typename Kernel::Point_d;
48 using FT =
typename Kernel::FT;
49 using Sphere = std::pair<Point_d, FT>;
58 std::vector<Sphere> cache_;
59 std::vector<Point_d> pts;
60 CGAL::NT_converter<FT, Filtration_value> cvt;
63 if(std::begin(points) == std::end(points)) {
67 int ambient_dim = k.point_dimension_d_object()(*std::begin(points));
69 auto fun = [&](Simplex_handle sh,
int dim){
76 auto vert_it = verts.begin();
79 auto&& pu = points[u];
80 Point_d m = k.midpoint_d_object()(pu, points[v]);
81 FT r = k.squared_distance_d_object()(m, pu);
82 if (exact) CGAL::exact(r);
85 if constexpr (!Output_squared_values)
88 cache_.emplace_back(std::move(m), std::move(r));
89 }
else if (dim > ambient_dim) {
92 for (
auto face : complex.boundary_simplex_range(sh)) {
100 maxf = max(maxf, complex.
filtration(face_opposite_vertex.first));
102 auto key = complex.
key(face_opposite_vertex.first);
103 Sphere
const& sph = cache_[key];
104 if (k.squared_distance_d_object()(sph.first, points[face_opposite_vertex.second]) > sph.second)
continue;
116 pts.push_back(points[vertex]);
117 Point_d c = k.construct_circumcenter_d_object()(pts.begin(), pts.end());
118 FT r = k.squared_distance_d_object()(c, pts.front());
119 if (exact) CGAL::exact(r);
125 if constexpr (!Output_squared_values)
128 maxf = max(maxf, filt);
131 cache_.emplace_back(std::move(c), std::move(r));
void assign_MEB_filtration(Kernel &&k, SimplicialComplexForMEB &complex, PointRange const &points, bool exact=false)
Given a simplicial complex and an embedding of its vertices, this assigns to each simplex a filtratio...
Definition: MEB_filtration.h:46
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20
Definition: SimplicialComplexForMEB.h:22
unspecified Simplex_handle
Handle for a simplex.
Definition: SimplicialComplexForMEB.h:24
Simplex_key key(Simplex_handle simplex)
Returns the key assigned to the 'simplex' with assign_key().
Filtration_value filtration(Simplex_handle simplex)
Returns the filtration value to the 'simplex'.
Boundary_opposite_vertex_simplex_range boundary_opposite_vertex_simplex_range(Simplex_handle simplex)
Returns a range of the pairs (simplex, opposite vertex) of the boundary of the 'simplex'.
unspecified Filtration_value
Type of filtration values.
Definition: SimplicialComplexForMEB.h:29
void assign_key(Simplex_handle simplex, Simplex_key key)
Assigns this 'key' to the 'simplex'.
Simplex_vertex_range simplex_vertex_range(Simplex_handle simplex)
Returns a range over vertices (as Vertex_handle) of a given simplex.
unspecified Vertex_handle
Handle for a vertex. Must be a non-negative integer, it is also used as an index into the input list ...
Definition: SimplicialComplexForMEB.h:27
int assign_filtration(Simplex_handle simplex, Filtration_value filtration)
Assigns this 'filtration' value to the 'simplex'.
void for_each_simplex(auto callback)
Calls callback(simplex, dim) for every simplex of the complex, with the guarantee that faces are visi...
Handle type for the vertices of a cell complex.
Definition: VertexHandle.h:15