MEPP2 Project
translation.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 {
20 
34 template< typename HalfedgeGraph,
35  typename PointMap,
36  typename GeometryTraits = FEVV::Geometry_traits< HalfedgeGraph > >
37 void
38 translate(const HalfedgeGraph &g,
39  PointMap &pm,
40  typename GeometryTraits::Scalar offset_x,
41  typename GeometryTraits::Scalar offset_y,
42  typename GeometryTraits::Scalar offset_z,
43  const GeometryTraits &gt)
44 {
45  typedef boost::graph_traits< HalfedgeGraph > GraphTraits;
46  typedef typename GraphTraits::vertex_iterator vertex_iterator;
47  typedef typename boost::property_traits< PointMap >::value_type Point;
48  //typedef typename boost::property_traits< PointMap >::reference Reference;
49 
50  vertex_iterator vi;
51  for(vi = vertices(g).first; vi != vertices(g).second; ++vi)
52  {
53  Point p = pm[*vi];
54  put(pm,
55  *vi,
56  Point(gt.get_x(p) + offset_x,
57  gt.get_y(p) + offset_y,
58  gt.get_z(p) + offset_z));
59  }
60 }
61 
73 template< typename HalfedgeGraph,
74  typename PointMap,
75  typename GeometryTraits = FEVV::Geometry_traits< HalfedgeGraph > >
76 void
77 translate(const HalfedgeGraph &g,
78  PointMap &pm,
79  typename GeometryTraits::Scalar offset_x,
80  typename GeometryTraits::Scalar offset_y,
81  typename GeometryTraits::Scalar offset_z)
82 
83 {
84  GeometryTraits gt(g);
85  translate< HalfedgeGraph, PointMap, GeometryTraits >(
86  g, pm, offset_x, offset_y, offset_z, gt);
87 }
88 
89 } // namespace Filters
90 } // 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::translate
void translate(const HalfedgeGraph &g, PointMap &pm, typename GeometryTraits::Scalar offset_x, typename GeometryTraits::Scalar offset_y, typename GeometryTraits::Scalar offset_z, const GeometryTraits &gt)
Translate a mesh.
Definition: translation.hpp:38
FEVV::Geometry_traits< HalfedgeGraph >
Point
AIFMesh::Point Point
Definition: Graph_properties_aif.h:21
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
FEVV::DataStructures::AIF::AIFPoint
Definition: AIFProperties.h:31