MEPP2 Project
normalize_vector_map.h
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 
14 
15 
16 namespace FEVV {
17 namespace Filters {
18 
19 
28 template< typename Iterator,
29  typename PropertyMap,
30  typename GeometryTraits >
31 void
32 normalize_vector_map(const Iterator &begin,
33  const Iterator &end,
34  PropertyMap &prop_map,
35  const GeometryTraits &gt)
36 {
37  for(Iterator it = begin; it != end; ++it)
38  {
39  auto vec = get(prop_map, *it);
40  auto vec_normalized = gt.normalize(vec);
41  put(prop_map, *it, vec_normalized);
42  }
43 }
44 
45 
52 template< typename HalfedgeGraph,
53  typename PropertyMap >
54 void
55 normalize_vector_map_vertices(const HalfedgeGraph &g,
56  PropertyMap &prop_map)
57 {
60  vertices(g).second,
61  prop_map,
62  gt);
63 }
64 
65 
72 template< typename HalfedgeGraph,
73  typename PropertyMap >
74 void
75 normalize_vector_map_faces(const HalfedgeGraph &g,
76  PropertyMap &prop_map)
77 {
79  normalize_vector_map(faces(g).first,
80  faces(g).second,
81  prop_map,
82  gt);
83 }
84 
85 
92 template< typename HalfedgeGraph,
93  typename PropertyMap >
94 void
95 normalize_vector_map_edges(const HalfedgeGraph &g,
96  PropertyMap &prop_map)
97 {
99  normalize_vector_map(edges(g).first,
100  edges(g).second,
101  prop_map,
102  gt);
103 }
104 
105 
112 template< typename HalfedgeGraph,
113  typename PropertyMap >
114 void
115 normalize_vector_map_halfedges(const HalfedgeGraph &g,
116  PropertyMap &prop_map)
117 {
119  normalize_vector_map(halfedges(g).first,
120  halfedges(g).second,
121  prop_map,
122  gt);
123 }
124 
125 
126 } // namespace Filters
127 } // 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::Filters::normalize_vector_map_vertices
void normalize_vector_map_vertices(const HalfedgeGraph &g, PropertyMap &prop_map)
Normalize each vector of the vertex property map.
Definition: normalize_vector_map.h:55
FEVV::Filters::normalize_vector_map_faces
void normalize_vector_map_faces(const HalfedgeGraph &g, PropertyMap &prop_map)
Normalize each vector of the face property map.
Definition: normalize_vector_map.h:75
FEVV::DataStructures::AIF::edges
std::pair< typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::edge_iterator, typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::edge_iterator > edges(const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the iterator range of the edges of the mesh.
Definition: Graph_traits_aif.h:238
FEVV::Filters::normalize_vector_map_halfedges
void normalize_vector_map_halfedges(const HalfedgeGraph &g, PropertyMap &prop_map)
Normalize each vector of the halfedge property map.
Definition: normalize_vector_map.h:115
FEVV::Geometry_traits< HalfedgeGraph >
FEVV::get
FEVV::PCLPointCloudPointMap::value_type get(const FEVV::PCLPointCloudPointMap &pm, FEVV::PCLPointCloudPointMap::key_type key)
Specialization of get(point_map, key) for PCLPointCloud.
Definition: Graph_properties_pcl_point_cloud.h:117
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::DataStructures::AIF::faces
std::pair< typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::face_iterator, typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::face_iterator > faces(const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns an iterator range over all faces of the mesh.
Definition: Graph_traits_aif.h:679
Geometry_traits.h
FEVV::Filters::normalize_vector_map
void normalize_vector_map(const Iterator &begin, const Iterator &end, PropertyMap &prop_map, const GeometryTraits &gt)
Normalize each vector of a property map, one by one. Generic implementation.
Definition: normalize_vector_map.h:32
FEVV::Filters::normalize_vector_map_edges
void normalize_vector_map_edges(const HalfedgeGraph &g, PropertyMap &prop_map)
Normalize each vector of the edge property map.
Definition: normalize_vector_map.h:95
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