MEPP2 Project
collapse_edge_euler.hpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include <boost/graph/graph_traits.hpp>
14 #include <CGAL/boost/graph/iterator.h>
15 #include <CGAL/boost/graph/Euler_operations.h>
16 
17 namespace FEVV {
18 namespace Operators {
19 
34 template< typename MutableFaceGraph >
35 void
37  MutableFaceGraph &g,
38  typename boost::graph_traits< MutableFaceGraph >::halfedge_descriptor &h)
39 {
40  // use CGAL::Euler function
41  std::cout << "Warning: using CGAL::Euler::collapse_edge()"
42  << "\n";
43  // CGAL's documentation doesn't specify which one of the
44  // source and the target vertex is removed.
45  // We experimentaly found that the target vertex is removed,
46  // so we need to use "opposite()" here to remove the source
47  // vertex.
48  CGAL::Euler::collapse_edge(edge(opposite(h, g), g), g);
49 }
50 
65 template< typename MutableFaceGraph >
66 void
68  MutableFaceGraph &g,
69  typename boost::graph_traits< MutableFaceGraph >::halfedge_descriptor &h)
70 {
71  typedef boost::graph_traits< MutableFaceGraph > GraphTraits;
72  typedef typename GraphTraits::halfedge_descriptor halfedge_descriptor;
73 
74  halfedge_descriptor ho = opposite(h, g);
76  // todo
77  // calling collapse_edge_keep_source(g, opposite(h, g))
78  // doesn't compile. WHY ?
79 }
80 
81 } // namespace Operators
82 } // namespace FEVV
FEVV::Operators::collapse_edge_keep_target_euler
void collapse_edge_keep_target_euler(MutableFaceGraph &g, typename boost::graph_traits< MutableFaceGraph >::halfedge_descriptor &h)
Collapse an edge of the graph. The edge to collapse is given as a halfedge. The halfedge target verte...
Definition: collapse_edge_euler.hpp:67
FEVV::DataStructures::AIF::opposite
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor opposite(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor h, const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the halfedge with source and target swapped.
Definition: Graph_traits_aif.h:625
FEVV::DataStructures::AIF::edge
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::edge_descriptor edge(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor h, const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the edge corresponding to h and opposite(h).
Definition: Graph_traits_aif.h:345
FEVV::Operators::collapse_edge_keep_source_euler
void collapse_edge_keep_source_euler(MutableFaceGraph &g, typename boost::graph_traits< MutableFaceGraph >::halfedge_descriptor &h)
Collapse an edge of the graph. The edge to collapse is given as a halfedge. The halfedge source verte...
Definition: collapse_edge_euler.hpp:36
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16