From 599d68cd916f533bdb66dd9e684dd5703233b6bb Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Wed, 25 Sep 2019 14:29:41 +0200 Subject: Delete all files in order to incorporate upstream's move to git. --- GudhUI/utils/Edge_collapsor.h | 97 ------------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 GudhUI/utils/Edge_collapsor.h (limited to 'GudhUI/utils/Edge_collapsor.h') diff --git a/GudhUI/utils/Edge_collapsor.h b/GudhUI/utils/Edge_collapsor.h deleted file mode 100644 index b3cc7df7..00000000 --- a/GudhUI/utils/Edge_collapsor.h +++ /dev/null @@ -1,97 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): David Salinas - * - * Copyright (C) 2014 Inria - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef UTILS_EDGE_COLLAPSOR_H_ -#define UTILS_EDGE_COLLAPSOR_H_ - -#include -#include "utils/Edge_contractor.h" -#include "utils/UI_utils.h" - -/** - * Iteratively puts every vertex at the center of its neighbors - */ -template class Edge_collapsor { - private: - SkBlComplex& complex_; - unsigned num_collapses_; - - public: - typedef typename SkBlComplex::Vertex_handle Vertex_handle; - typedef typename SkBlComplex::Edge_handle Edge_handle; - - /** - * @brief Collapse num_collapses edges. If num_collapses<0 then it collapses all possible edges. - * Largest edges are collapsed first. - * - */ - Edge_collapsor(SkBlComplex& complex, unsigned num_collapses) : - complex_(complex), num_collapses_(num_collapses) { - std::list edges; - edges.insert(edges.begin(), complex_.edge_range().begin(), complex_.edge_range().end()); - - edges.sort( - [&](Edge_handle e1, Edge_handle e2) { - return squared_edge_length(e1) < squared_edge_length(e2); - }); - - collapse_edges(edges); - } - - private: - void collapse_edges(std::list& edges) { - while (!edges.empty() && num_collapses_--) { - Edge_handle current_edge = edges.front(); - edges.pop_front(); - if (is_link_reducible(current_edge)) - complex_.remove_edge(current_edge); - } - } - - bool is_link_reducible(Edge_handle e) { - auto link = complex_.link(e); - - if (link.empty()) - return false; - - if (link.is_cone()) - return true; - - if (link.num_connected_components() > 1) - return false; - - Edge_contractor contractor(link, link.num_vertices() - 1); - - return (link.num_vertices() == 1); - } - - double squared_edge_length(Edge_handle e) const { - return squared_eucl_distance(complex_.point(complex_.first_vertex(e)), complex_.point(complex_.second_vertex(e))); - } - - double squared_eucl_distance(const Point& p1, const Point& p2) const { - return Geometry_trait::Squared_distance_d()(p1, p2); - } -}; - -#endif // UTILS_EDGE_COLLAPSOR_H_ -- cgit v1.2.3