MEPP2 Project
test_curvature_filter_aif.cpp
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.
16 #include "FEVV/Wrappings/properties_aif.h" // for datastructure default property map
17 #include "FEVV/Filters/Generic/Manifold/Curvature/curvature.hpp" // for calculate_curvature()
19 
20 #include <fstream>
21 
22 //------------------------------------------------------------------------------
23 
24 // code from Visualization/PluginFilters/curvature/CurvaturePlugin.h
25 void
27 {
28  typedef FEVV::DataStructures::AIF::AIFMesh HalfedgeGraph;
29 
30  std::cout << "Asking to Curvature mesh ! " << std::endl;
31 
32  auto pm = get(boost::vertex_point, *mesh);
33 
34  // ---
35 
36  //using Vector = typename FEVV::Geometry_traits< HalfedgeGraph >::Vector;
37 
38  // Face normal map
39  // this one is a standard property map
40  auto f_nm = make_property_map(FEVV::face_normal, *mesh);
41 
43 
44  // ---
45 
46  // Vertex curvature map
47  // this one is a NON-standard property map!
48  auto v_cm =
49  FEVV::make_vertex_property_map< HalfedgeGraph,
51  *mesh);
52 
55  double min_nrm_min_curvature, max_nrm_min_curvature, min_nrm_max_curvature,
56  max_nrm_max_curvature;
57 
58  bool value_is_geod = false;
59  double value_radius = 0.001;
60  FEVV::Filters::calculate_curvature( // B) call the filter corresponding to
61  // your operation
62  *mesh,
63  v_cm,
64  pm,
65  f_nm,
66  value_is_geod,
67  value_radius,
68  min_nrm_min_curvature,
69  max_nrm_min_curvature,
70  min_nrm_max_curvature,
71  max_nrm_max_curvature);
72 
73  // ---
74 
75  std::cout << "Curvature mesh, isGeod: " << value_is_geod
76  << " - radius: " << value_radius << "." << std::endl;
77 }
78 
79 //------------------------------------------------------------------------------
80 
81 int
82 main(int narg, char **argv)
83 {
84  if(narg < 2)
85  {
86  std::cout << "Usage: " << argv[0] << " mesh_filename" << std::endl;
87  exit(EXIT_FAILURE);
88  }
89  std::string filename(argv[1]);
90 
92  auto m_ptr = reader.read(filename);
93 
94  if(m_ptr == NULL)
95  {
96  std::cout << "failed to read file '" << filename << std::endl;
97  return 1;
98  }
99 
100 
101  curvature(m_ptr.get());
102 
103 
104  std::cout << "Done." << std::endl;
105 
106  return 0;
107 }
main
int main(int narg, char **argv)
Definition: test_curvature_filter_aif.cpp:82
FEVV::Filters::v_Curv
Definition: curvature.hpp:41
FEVV::DataStructures::AIF::AIFMeshReader::read
ptr_output read(const std::string &filePath)
Definition: AIFMeshReader.inl:50
calculate_face_normals.hpp
properties_aif.h
curvature.hpp
Graph_properties_aif.h
FEVV::Filters::calculate_curvature
void calculate_curvature(const HalfedgeGraph &g, VertexCurvatureMap &v_cm, const PointMap &pm, const FaceNormalMap &f_nm, bool is_geod, double radius, double &min_nrm_min_curvature, double &max_nrm_min_curvature, double &min_nrm_max_curvature, double &max_nrm_max_curvature, const GeometryTraits &gt)
Calculate the curvature for a mesh.
Definition: curvature.hpp:312
AIFMesh.hpp
Graph_traits_aif.h
FEVV::make_vertex_property_map
Vertex_pmap_traits< MeshT, ValueT >::pmap_type make_vertex_property_map(const MeshT &m)
Definition: properties.h:736
FEVV::Filters::calculate_face_normals
void calculate_face_normals(const HalfedgeGraph &g, const PointMap &pm, FaceNormalMap fnm, const GeometryTraits &gt)
Calculate "some" normal of all the faces of the considered mesh and populate the argument provided Fa...
Definition: calculate_face_normals.hpp:40
Geometry_traits_aif.h
boost::get
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >::const_type get(const boost::vertex_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
Returns the vertex index property map of the mesh.
Definition: Graph_properties_aif.h:108
FEVV::DataStructures::AIF::AIFMesh
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
Definition: AIFMesh.hpp:47
FEVV::DataStructures::AIF::AIFMeshReader
This class represents an AIFMesh object reader. An AIFMeshReader reads a mesh file (....
Definition: AIFMeshReader.hpp:37
AIFMeshReader.hpp
FEVV::make_property_map
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)
Definition: properties.h:630
curvature
void curvature(FEVV::DataStructures::AIF::AIFMesh *mesh)
Definition: test_curvature_filter_aif.cpp:26
FEVV::face_normal
@ face_normal
Definition: properties.h:77