12 #ifndef UTILS_IS_MANIFOLD_H_
13 #define UTILS_IS_MANIFOLD_H_
15 #include "utils/UI_utils.h"
16 #include "utils/Edge_contractor.h"
26 const SkBlComplex& input_complex_;
27 typedef typename SkBlComplex::Vertex_handle Vertex_handle;
35 Is_manifold(
const SkBlComplex& input_complex,
unsigned& dim,
bool & res) : input_complex_(input_complex) {
38 if (!input_complex_.empty()) {
39 for (
auto v : input_complex_.vertex_range()) {
40 dim = local_dimension(v);
44 for (
auto v : input_complex_.vertex_range()) {
45 if (!is_k_sphere(v, dim - 1)) {
54 unsigned local_dimension(Vertex_handle v) {
56 for (
const auto& s : input_complex_.star_simplex_range(v))
57 dim = (std::max)(dim, (
unsigned) s.dimension());
61 bool is_k_sphere(Vertex_handle v,
int k) {
62 auto link = input_complex_.link(v);
65 return (is_sphere_simplex(link) == k);
73 template<
typename SubComplex>
74 int is_sphere_simplex(
const SubComplex& complex) {
75 if (complex.empty())
return -1;
76 if (complex.num_blockers() != 1)
return -2;
79 auto first_blocker = *(complex.const_blocker_range().begin());
81 if (first_blocker->dimension() + 1 != complex.num_vertices())
84 return (first_blocker->dimension() - 1);
Definition: Edge_contractor.h:24
Definition: Is_manifold.h:24