// Copyright (c) 2006 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) : Fernando Cacciola // #ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H #define CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H 1 #include #include #include #include #include namespace CGAL { namespace Surface_mesh_simplification { template int edge_collapse ( ECM& aSurface , ShouldStop const& aShould_stop // optional mesh information policies , VertexIndexMap const& aVertex_index_map // defaults to get(vertex_index,aSurface) , VertexPointMap const& aVertex_point_map // defaults to get(vertex_point,aSurface) , EdgeIndexMap const& aEdge_index_map // defaults to get(edge_index,aSurface) , EdgeIsConstrainedMap const& aEdge_is_constrained_map // defaults to No_constrained_edge_map() // optional strategy policies - defaults to LindstomTurk , GetCost const& aGet_cost , GetPlacement const& aGet_placement , Visitor aVisitor ) { typedef EdgeCollapse< ECM , ShouldStop , VertexIndexMap , VertexPointMap , EdgeIndexMap , EdgeIsConstrainedMap , GetCost , GetPlacement , Visitor > Algorithm; Algorithm algorithm( aSurface , aShould_stop , aVertex_index_map , aVertex_point_map , aEdge_index_map , aEdge_is_constrained_map , aGet_cost , aGet_placement , aVisitor ) ; return algorithm.run(); } struct Dummy_visitor { template void OnStarted( ECM& ) const {} template void OnFinished ( ECM& ) const {} template void OnStopConditionReached( Profile const& ) const {} template void OnCollected( Profile const&, OFT const& ) const {} template void OnSelected( Profile const&, OFT const&, Size_type, Size_type ) const {} template void OnCollapsing(Profile const&, OPoint const& ) const {} template void OnCollapsed( Profile const&, VH ) const {} template void OnNonCollapsable(Profile const& ) const {} } ; template int edge_collapse ( ECM& aSurface , ShouldStop const& aShould_stop , cgal_bgl_named_params const& aParams ) { using boost::choose_param ; using boost::choose_const_pmap ; using boost::get_param ; LindstromTurk_params lPolicyParams ; boost::graph_visitor_t vis = boost::graph_visitor_t() ; return edge_collapse(aSurface ,aShould_stop ,choose_const_pmap(get_param(aParams,boost::vertex_index),aSurface,boost::vertex_index) ,choose_pmap(get_param(aParams,boost::vertex_point),aSurface,boost::vertex_point) ,choose_const_pmap(get_param(aParams,boost::halfedge_index),aSurface,boost::halfedge_index) ,choose_param (get_param(aParams,edge_is_constrained),No_constrained_edge_map()) ,choose_param (get_param(aParams,get_cost_policy), LindstromTurk_cost()) ,choose_param (get_param(aParams,get_placement_policy), LindstromTurk_placement()) ,choose_param (get_param(aParams,vis), Dummy_visitor()) ); } template int edge_collapse ( ECM& aSurface , ShouldStop const& aShould_stop , cgal_bgl_named_params const& aParams ) { using boost::choose_param ; using boost::choose_const_pmap ; using boost::get_param ; LindstromTurk_params lPolicyParams ; boost::graph_visitor_t vis = boost::graph_visitor_t() ; return edge_collapse(aSurface ,aShould_stop ,choose_const_pmap(get_param(aParams,boost::vertex_index),aSurface,boost::vertex_index) ,choose_const_pmap(get_param(aParams,boost::vertex_point),aSurface,boost::vertex_point) ,choose_const_pmap(get_param(aParams,boost::halfedge_index),aSurface,boost::halfedge_index) ,choose_param (get_param(aParams,edge_is_constrained),No_constrained_edge_map()) ,choose_param (get_param(aParams,get_cost_policy), LindstromTurk_cost()) ,choose_param (get_param(aParams,get_placement_policy), LindstromTurk_placement()) ,choose_param (get_param(aParams,vis), Dummy_visitor()) ); } template int edge_collapse ( ECM& aSurface, ShouldStop const& aShould_stop ) { return edge_collapse(aSurface,aShould_stop, halfedge_index_map(get(boost::halfedge_index,aSurface))); // AF why the halfedge_index_map? } template int edge_collapse ( ECM& aSurface, ShouldStop const& aShould_stop) { return edge_collapse(aSurface,aShould_stop, CGAL::parameters::halfedge_index_map(get(boost::halfedge_index,aSurface))); } } // namespace Surface_mesh_simplification } //namespace CGAL #endif // CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H // // EOF //