diff --git a/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h b/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h index c714c198072..12f0c30f0a9 100644 --- a/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Mean_curvature_skeleton/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -46,15 +46,6 @@ // Simplification function #include -// Stop-condition policy -#include - -// Non-default cost and placement policies -#include - -// Skip the geometric test -#include - // Curve skeleton data structure #include @@ -69,9 +60,6 @@ // Some helper functions #include -// For correspondence tracking -#include - // For Fixed_edge_map #include @@ -94,8 +82,6 @@ #include // for sparse linear system solver #endif -namespace SMS = CGAL::Surface_mesh_simplification; - namespace CGAL { namespace parameters { @@ -127,14 +113,6 @@ struct Skel_polyhedron_items_3: CGAL::Polyhedron_items_with_id_3 { } //end of namespace internal -/// \ingroup PkgMeanCurvatureSkeleton3 -///@brief Edge collapse algorithm tag. -enum Collapse_algorithm_tag -{ - SIMPLIFICATION, /**< algorithm from simplification package */ - LINEAR /**< iterative linear search */ -}; - /// \ingroup PkgMeanCurvatureSkeleton3 ///@brief Degeneracy detection algorithm tag. enum Degeneracy_algorithm_tag @@ -190,8 +168,6 @@ enum Degeneracy_algorithm_tag /// \endcode /// /// @cond CGAL_DOCUMENT_INTERNAL -/// @tparam Collapse_algorithm_tag -/// tag for selecting the edge collapse algorithm /// @tparam Degeneracy_algorithm_tag /// tag for selecting the degeneracy detection algorithm /// @endcond @@ -205,7 +181,6 @@ template #endif class Mean_curvature_flow_skeletonization @@ -286,9 +261,6 @@ public: HalfedgeIndexMap, mVertexPointMap> Curve_skeleton; - // Mesh simplification types - typedef SMS::Edge_profile Profile; - // Repeat Triangulation types typedef CGAL::Exact_predicates_exact_constructions_kernel Exact_kernel; typedef CGAL::Triangulation_vertex_base_with_info_3 @@ -717,12 +689,7 @@ public: std::size_t num_collapses = 0; while (true) { - std::size_t cnt; - if (Collapse_tag == SIMPLIFICATION) - cnt = collapse_edges_simplification(); - else - if (Collapse_tag == LINEAR) - cnt = collapse_edges_linear(fixed_edge_map); + std::size_t cnt = collapse_edges_linear(fixed_edge_map); if (cnt == 0) break; num_collapses += cnt; @@ -1098,45 +1065,6 @@ private: // Edge collapse // -------------------------------------------------------------------------- - /// Collapse short edges using simplification package. - std::size_t collapse_edges_simplification() - { - internal::Fixed_edge_map fixed_edge_map(m_tmesh); - - init_fixed_edge_map(fixed_edge_map); - - - int edge_id = -1; - BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh)) - { - put(m_hedge_id_pmap, hd, ++edge_id); - } - - // This is a stop predicate (defines when the algorithm terminates). - // The simplification stops when the length of all edges is greater - // than the minimum threshold. - CGAL::internal::Minimum_length_predicate stop(m_min_edge_length); - - // midpoint placement without geometric test - SMS::Geometric_test_skipper< SMS::Midpoint_placement > placement; - - internal::Track_correspondence_visitor vis - (&m_tmesh_point_pmap, m_max_id, m_is_medially_centered); - - // Workaround, as PMP has get_cost in a sub namespace - using namespace CGAL::parameters; - std::size_t r = SMS::edge_collapse - (m_tmesh - ,stop - ,get_cost(SMS::Edge_length_cost()) - .get_placement(placement) - .visitor(vis) - .edge_is_constrained_map(fixed_edge_map) - ); - - return r; - } - /// Track correspondent original surface points during collapse. /// \todo remove this function and use a data member of the vertex instead for the poles void track_correspondence(vertex_descriptor v0, vertex_descriptor v1, diff --git a/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Edge_minimum_length_stop_predicate.h b/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Edge_minimum_length_stop_predicate.h deleted file mode 100644 index a273e9f208f..00000000000 --- a/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Edge_minimum_length_stop_predicate.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2013 GeometryFactory (France). All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// 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. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Xiang Gao -// - -#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_MINIMUM_LENGTH_PREDICATE_H -#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_MINIMUM_LENGTH_PREDICATE_H 1 - -/// @cond CGAL_DOCUMENT_INTERNAL - -#include -#include - -namespace SMS = CGAL::Surface_mesh_simplification; - -namespace CGAL { - -namespace internal { - -//******************************************************************************************************************* -// -= stopping condition predicate =- -// -// Determines whether the simplification has finished. -// The arguments are (current_cost,vertex,vertex,is_edge,initial_pair_count,current_pair_count,surface) and the result is bool -// -//******************************************************************************************************************* - -// -// Stops when all the edges have length greater than the minimum required edge length -// -template -class Minimum_length_predicate -{ -public: - - typedef ECM_ ECM ; - - typedef SMS::Edge_profile Profile ; - -private : - - typedef typename ECM::Traits::Point_3 Point ; //temporary it should be a point property map - typedef typename Kernel_traits::Kernel Kernel ; - -public : - - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor ; - typedef typename boost::graph_traits::edges_size_type size_type ; - - typedef typename Kernel::FT FT ; - -public : - - Minimum_length_predicate( FT aThres ) : mThres(aThres * aThres) {} - - bool operator()( FT const& aCurrentCost - , Profile const& //aEdgeProfile - , size_type //aInitialCount - , size_type //aCurrentCount - ) const - { - return aCurrentCost > mThres ; - } - -private: - - FT mThres ; -}; - -} //namespace internal - -} //namespace CGAL - -/// @endcond - -#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_MINIMUM_LENGTH_PREDICATE_H // -// EOF // - diff --git a/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Track_correspondence_visitor.h b/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Track_correspondence_visitor.h deleted file mode 100644 index 1dd05dc99ab..00000000000 --- a/Mean_curvature_skeleton/include/CGAL/internal/Mean_curvature_skeleton/Track_correspondence_visitor.h +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2013 GeometryFactory (France). All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// 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. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Xiang Gao -// - -#ifndef CGAL_MCFSKEL_TRACK_CORRESPONDENCE_H -#define CGAL_MCFSKEL_TRACK_CORRESPONDENCE_H - -/// @cond CGAL_DOCUMENT_INTERNAL - -/** - * @file Track_correspondence_visitor.h - * @brief This file contains the visitor class to track the correspondent vertices - * during edge collapse. - * - * The visitor class track vertices that are collapsed onto the given vertex. - * It is needed when using simplification package to do the edge collapse. - * - */ - -// Visitor base -#include -#include - -namespace SMS = CGAL::Surface_mesh_simplification; - -namespace CGAL { -namespace internal { - -template -struct Track_correspondence_visitor : SMS::Edge_collapse_visitor_base -{ - // TriangleMesh types - typedef typename TriangleMesh::Traits Kernel; - typedef typename Kernel::Point_3 Point; - typedef typename TriangleMesh::Vertex_handle Vertex_handle; - - // Mesh simplification types - typedef SMS::Edge_profile Profile; - - Track_correspondence_visitor(){} - - Track_correspondence_visitor(TriangleMeshPointPMap* point_pmap, - int max_id, - bool is_medially_centered) : - hg_point_pmap(point_pmap), - max_id(max_id), - is_medially_centered(is_medially_centered) - {} - - void OnCollapsing (Profile const &profile, boost::optional< Point >) - { - // the mesh is closed, v0 is always removed - std::vector& vec_kept = profile.v1()->vertices; - std::vector& vec_removed = profile.v0()->vertices; - vec_kept.insert(vec_kept.end(), vec_removed.begin(), vec_removed.end()); - } - // Called AFTER each edge has been collapsed - void OnCollapsed(Profile const& edge, Vertex_handle /* v */) - { - Vertex_handle v0 = edge.v0(); - Vertex_handle v1 = edge.v1(); - //~ int id0 = v0->id(); - //~ int id1 = v1->id(); - //~ int vid = v->id(); - //~ int from, to; - //~ if (id0 == vid) - //~ { - //~ from = id1; - //~ to = id0; - //~ } - //~ else if (id1 == vid) - //~ { - //~ from = id0; - //~ to = id1; - //~ } - - //~ if ((*corr).find(to) == (*corr).end()) - //~ { - //~ (*corr)[to] = std::vector(); - //~ } - //~ // only track vertex in the original mesh - //~ if (from < max_id) - //~ { - //~ (*corr)[to].push_back(from); - //~ } - //~ std::map >::iterator iter = (*corr).find(from); - //~ if (iter != (*corr).end()) - //~ { - //~ for (size_t i = 0; i < (iter->second).size(); ++i) - //~ { - //~ (*corr)[to].push_back((iter->second)[i]); - //~ } - //~ (iter->second).clear(); - //~ (*corr).erase(iter); - //~ } - - // also track the poles - if (is_medially_centered) - { - Point pole0 = v0->pole; - Point pole1 = v1->pole; - Point p1 = boost::get(*hg_point_pmap, v1); - double dis_to_pole0 = std::sqrt(squared_distance(pole0, p1)); - double dis_to_pole1 = std::sqrt(squared_distance(pole1, p1)); - if (dis_to_pole0 < dis_to_pole1) - v1->pole=v0->pole; - } - } - - TriangleMeshPointPMap* hg_point_pmap; - - int max_id; - - bool is_medially_centered; -}; - -} //namespace internal -} //namespace CGAL - -/// @endcond - -#endif //CGAL_MCFSKEL_TRACK_CORRESPONDENCE_H