MEPP2 Project
test_curvature_filter.inl
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.
12  // for calculate_curvature()
14  // for calculate_face_normals
15 #include "FEVV/Filters/Generic/generic_reader.hpp" // for read_mesh()
16 
17 
18 // code from Visualization/PluginFilters/curvature/CurvaturePlugin.h
19 template< typename HalfedgeGraph >
20 void
21 curvature(HalfedgeGraph *mesh)
22 {
23  std::cout << "Asking to Curvature mesh ! " << std::endl;
24 
25  auto pm = get(boost::vertex_point, *mesh);
26 
27  // ---
28 
29  //using Vector = typename FEVV::Geometry_traits< HalfedgeGraph >::Vector;
30 
31  // Face normal map
32  // this one is a standard property map
33  auto f_nm = make_property_map(FEVV::face_normal, *mesh);
34 
36 
37  // ---
38 
39  // Vertex curvature map
40  // this one is a NON-standard property map!
41  auto v_cm =
42  FEVV::make_vertex_property_map< HalfedgeGraph,
44  *mesh);
45 
48  double min_nrm_min_curvature, max_nrm_min_curvature, min_nrm_max_curvature,
49  max_nrm_max_curvature;
50 
51  bool value_is_geod = true; //=false
52  double value_radius = 0.003; //=0.001
53  FEVV::Filters::calculate_curvature( // B) call the filter corresponding to
54  // your operation
55  *mesh,
56  v_cm,
57  pm,
58  f_nm,
59  value_is_geod,
60  value_radius,
61  min_nrm_min_curvature,
62  max_nrm_min_curvature,
63  min_nrm_max_curvature,
64  max_nrm_max_curvature);
65 
66  // ---
67 
68  std::cout << "Curvature mesh, isGeod: " << value_is_geod
69  << " - radius: " << value_radius << "." << std::endl;
70 }
71 
72 //------------------------------------------------------------------------------
73 
74 template< typename MeshT >
75 int
76 test_curvature_filter(int narg, const char **argv)
77 {
78  if(narg < 2)
79  {
80  std::cout << "Usage: " << argv[0] << " mesh_filename" << std::endl;
81  exit(EXIT_FAILURE);
82  }
83  std::string filename(argv[1]);
84 
85  MeshT m;
86  FEVV::PMapsContainer pmaps_bag;
87  FEVV::Filters::read_mesh(filename, m, pmaps_bag);
88 
89  curvature(&m);
90 
91  std::cout << "Done." << std::endl;
92 
93  return 0;
94 }
FEVV::Filters::v_Curv
Definition: curvature.hpp:41
test_curvature_filter
int test_curvature_filter(int narg, const char **argv)
Definition: test_curvature_filter.inl:76
generic_reader.hpp
curvature
void curvature(HalfedgeGraph *mesh)
Definition: test_curvature_filter.inl:21
calculate_face_normals.hpp
FEVV::PMapsContainer
std::map< std::string, boost::any > PMapsContainer
Definition: properties.h:99
curvature.hpp
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
FEVV::Filters::read_mesh
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
Definition: cgal_point_set_reader.hpp:110
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
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::make_property_map
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)
Definition: properties.h:630
FEVV::face_normal
@ face_normal
Definition: properties.h:77