MEPP2 Project
reposition_vertices.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 <boost/graph/properties.hpp>
15 
17 
18 namespace FEVV {
19 namespace Filters {
39 template< typename PropertyGraph,
40  typename PointMap,
41  typename NewPointMap,
42  typename GeometryTraits = FEVV::Geometry_traits< PropertyGraph > >
43 void
45  const PropertyGraph &g,
46  PointMap pm, // modifiable map (follows CGAL usage)
47  const NewPointMap &smoothed_pm, // const map (follows CGAL usage)
48  const GeometryTraits &/*gt*/)
49 {
50  typedef boost::graph_traits< PropertyGraph > GraphTraits;
51 
52  typedef typename GraphTraits::vertex_iterator vertex_iterator;
53  //typedef typename boost::property_traits< PointMap >::value_type Point;
54  //typedef typename boost::property_traits< PointMap >::reference Reference;
55 
56  // this code works only for Polyhedron_3, Surface Mesh, OpenMesh and AIF
57  auto iterator_pair = vertices(g); // vertices() returns a vertex_iterator pair
58  // auto smoothed_pm = get_barycenter_pm<PropertyGraph, PointMap,
59  // GeometryTraits >(g, pm, gt);
60  vertex_iterator vi = iterator_pair.first;
61  vertex_iterator vi_end = iterator_pair.second;
62 
63  for(; vi != vi_end; ++vi)
64  {
65  //Point p = pm[*vi];
66  put(pm, *vi, smoothed_pm[*vi]);
67  }
68 }
69 
70 /*
71  * \brief The only purpose of this function is to instantiate the last argument
72  * in order to simplify caller's syntax. This is to circumvent an
73  * apparent impossibility of providing a default argument out of a
74  * type drilled down from a default template parameter i.e. we cannot
75  * define something like
76  * template<,, typename Geometry=FEVV::Geometry_traits<PropertyGraph> >
77  * apply_Smoothing(,, const Geometry& gt = Geomtry( g ) )
78  */
79 template< typename PropertyGraph,
80  typename PointMap,
81  typename NewPointMap,
82  typename GeometryTraits = FEVV::Geometry_traits< PropertyGraph > >
83 void
85  const PropertyGraph &g,
86  PointMap pm, // modifiable map (follows CGAL usage)
87  const NewPointMap &smoothed_pm // const map (follows CGAL usage)
88 )
89 {
90  GeometryTraits gt(g);
91  reposition_vertices< PropertyGraph, PointMap, NewPointMap, GeometryTraits >(
92  g, pm, smoothed_pm, gt);
93 }
94 
95 } // namespace Filters
96 } // namespace FEVV
FEVV::DataStructures::AIF::vertices
std::pair< typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_iterator, typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_iterator > vertices(const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the iterator range of the vertices of the mesh.
Definition: Graph_traits_aif.h:172
FEVV::Geometry_traits
Refer to Geometry_traits_documentation_dummy for further documentation on provided types and algorith...
Definition: Geometry_traits.h:162
FEVV::Filters::reposition_vertices
void reposition_vertices(const PropertyGraph &g, PointMap pm, const NewPointMap &smoothed_pm, const GeometryTraits &)
Apply new vertex positions to vertex position property map.
Definition: reposition_vertices.hpp:44
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
Geometry_traits.h
FEVV::put
void put(FEVV::PCLPointCloudPointMap &pm, FEVV::PCLPointCloudPointMap::key_type key, const FEVV::PCLPointCloudPointMap::value_type &value)
Specialization of put(point_map, key, value) for PCLPointCloud.
Definition: Graph_properties_pcl_point_cloud.h:126