11 #ifndef UTILS_VERTEX_COLLAPSOR_H_
12 #define UTILS_VERTEX_COLLAPSOR_H_
16 #include "utils/Edge_contractor.h"
17 #include "utils/Furthest_point_epsilon_net.h"
18 #include "utils/UI_utils.h"
25 SkBlComplex& complex_;
26 size_t num_collapses_;
29 typedef typename SkBlComplex::Vertex_handle Vertex_handle;
30 typedef typename SkBlComplex::Edge_handle Edge_handle;
37 complex_(complex), num_collapses_(num_collapses) {
43 std::list<Vertex_handle> vertices;
45 UIDBG(
"Compute eps net");
48 for (
auto vh : eps_net.net_filtration_)
49 vertices.push_back(vh.vertex_handle);
51 UIDBG(
"Collapse vertices");
52 collapse_vertices(vertices);
56 void collapse_vertices(std::list<Vertex_handle>& vertices) {
57 while (!vertices.empty() && num_collapses_--) {
60 if (is_link_reducible(current_vertex))
61 complex_.remove_vertex(current_vertex);
66 auto link = complex_.link(v);
67 if (link.empty())
return false;
68 if (link.is_cone())
return true;
69 if (link.num_connected_components() > 1)
return false;
72 return (link.num_vertices() == 1);
Definition: Edge_contractor.h:24
Definition: Furthest_point_epsilon_net.h:22
Definition: Vertex_collapsor.h:23
Vertex_collapsor(SkBlComplex &complex, size_t num_collapses)
Modify complex to be the expansion of the k-nearest neighbor symetric graph.
Definition: Vertex_collapsor.h:36
Handle type for the vertices of a cell complex.
Definition: VertexHandle.h:15