MEPP2 Project
calculate_vertices_one_ring_angles_based_centroid.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 
18 
19 namespace FEVV {
20 namespace Filters {
21 
44 template< typename FaceGraph,
45  typename PointMap,
46  typename CentroidMap,
47  typename GeometryTraits = FEVV::Geometry_traits< FaceGraph > >
48 void
50  const FaceGraph &g,
51  const PointMap &pm, // const map
52  CentroidMap
53  angles_based_centroids_pm, // modifiable map (follows CGAL usage)
54  const typename GeometryTraits::Scalar smoothing_factor,
55  const GeometryTraits &gt)
56 {
57  typedef boost::graph_traits< FaceGraph > GraphTraits;
58 
59  typedef typename GraphTraits::vertex_iterator vertex_iterator;
60  //typedef typename GraphTraits::vertex_descriptor vertex_descriptor;
61  //typedef typename boost::property_traits< PointMap >::value_type Point;
62  //typedef typename boost::property_traits< PointMap >::reference Reference;
63 
64  // this code works only for Polyhedron_3, Surface Mesh, OpenMesh and AIF
65  auto iterator_pair = vertices(g); // vertices() returns a vertex_iterator pair
66 
67  // VertexMap barycenters_pm(get(boost::vertex_index, g));
68  vertex_iterator vi = iterator_pair.first;
69  vertex_iterator vi_end = iterator_pair.second;
70  int cpt = 0;
71  for(; vi != vi_end; ++vi)
72  {
73  cpt++;
74  angles_based_centroids_pm[*vi] =
76  PointMap,
77  GeometryTraits >(
78  *vi, g, pm, smoothing_factor, gt);
79  }
80 }
81 
82 template< typename FaceGraph,
83  typename PointMap,
84  typename CentroidMap,
85  typename GeometryTraits = FEVV::Geometry_traits< FaceGraph > >
86 void
88  const FaceGraph &g,
89  const PointMap &pm, // const map (follows CGAL usage)
90  CentroidMap
91  angles_based_centroids_pm, // modifiable map (follows CGAL usage)
92  const typename GeometryTraits::Scalar smoothing_factor = 0.1)
93 
94 {
95  GeometryTraits gt(g);
97  PointMap,
98  CentroidMap,
99  GeometryTraits >(
100  g, pm, angles_based_centroids_pm, smoothing_factor, gt);
101 }
102 
103 } // namespace Filters
104 } // 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::Operators::vertex_one_ring_angles_based_centroid
boost::property_traits< PointMap >::value_type vertex_one_ring_angles_based_centroid(typename boost::graph_traits< FaceGraph >::vertex_descriptor v, const FaceGraph &g, const PointMap &pm, const typename GeometryTraits::Scalar smoothing_factor, const GeometryTraits &gt)
Angle-based smoothing of the vertex' one ring of vertex positions. Increases the min angle and decrea...
Definition: vertex_one_ring_angles_based_centroid.hpp:51
FEVV::Geometry_traits
Refer to Geometry_traits_documentation_dummy for further documentation on provided types and algorith...
Definition: Geometry_traits.h:162
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
Geometry_traits.h
vertex_one_ring_angles_based_centroid.hpp
FEVV::Filters::calculate_vertices_one_ring_angles_based_centroid
void calculate_vertices_one_ring_angles_based_centroid(const FaceGraph &g, const PointMap &pm, CentroidMap angles_based_centroids_pm, const typename GeometryTraits::Scalar smoothing_factor, const GeometryTraits &gt)
Compute angle-based centroids for all vertices and store them in bangles_based_centroids_pm.
Definition: calculate_vertices_one_ring_angles_based_centroid.hpp:49