// Copyright (c) 2006 GeometryFactory (France). All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL: https://github.com/CGAL/cgal/blob/v5.2/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/edge_collapse.h $ // $Id: edge_collapse.h bfd4e99 2020-09-15T15:42:24+02:00 Jane Tournois // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Fernando Cacciola // #ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H #define CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H #include #include #include #include #include #include #include namespace CGAL { namespace Surface_mesh_simplification { namespace internal { template int edge_collapse(TM& tmesh, const ShouldStop& should_stop, // optional mesh information policies const GT& traits, const VertexIndexMap& vim, // defaults to get(vertex_index, tmesh) const VertexPointMap& vpm, // defaults to get(vertex_point, tmesh) const HalfedgeIndexMap& him, // defaults to get(edge_index, tmesh) const EdgeIsConstrainedMap& ecm, // defaults to No_constrained_edge_map() // optional strategy policies - defaults to LindstomTurk const GetCost& get_cost, const GetPlacement& get_placement, Visitor visitor) { typedef EdgeCollapse Algorithm; Algorithm algorithm(tmesh, traits, should_stop, vim, vpm, him, ecm, get_cost, get_placement, visitor); return algorithm.run(); } struct Dummy_visitor { template void OnStarted(TM&) const {} template void OnFinished(TM&) const {} template void OnStopConditionReached(const Profile&) const {} template void OnCollected(const Profile&, const OFT&) const {} template void OnSelected(const Profile&, const OFT&, Size_type, Size_type) const {} template void OnCollapsing(const Profile&, const OPoint&) const {} template void OnCollapsed(const Profile&, VH) const {} template void OnNonCollapsable(const Profile&) const {} }; } // namespace internal template int edge_collapse(TM& tmesh, const ShouldStop& should_stop, const NamedParameters& np) { using parameters::choose_parameter; using parameters::get_parameter; typedef typename GetGeomTraits::type Geom_traits; return internal::edge_collapse(tmesh, should_stop, choose_parameter(get_parameter(np, internal_np::geom_traits)), CGAL::get_initialized_vertex_index_map(tmesh, np), choose_parameter(get_parameter(np, internal_np::vertex_point), get_property_map(vertex_point, tmesh)), CGAL::get_initialized_halfedge_index_map(tmesh, np), choose_parameter >(get_parameter(np, internal_np::edge_is_constrained)), choose_parameter >(get_parameter(np, internal_np::get_cost_policy)), choose_parameter >(get_parameter(np, internal_np::get_placement_policy)), choose_parameter(get_parameter(np, internal_np::visitor))); } template int edge_collapse(TM& tmesh, const ShouldStop& should_stop) { return edge_collapse(tmesh, should_stop, CGAL::parameters::all_default()); } } // namespace Surface_mesh_simplification } // namespace CGAL #endif // CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H