MEPP2 Project
msdm2_surfacemesh.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 General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // 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 
12 #include "msdm2_surfacemesh.h"
13 
18 
19 
20 namespace msdm2 {
21 
25 void msdm2_surfacemesh(const MeshT &mesh_degraded, /* input */
26  const MeshT &mesh_original, /* input */
27  const int nb_levels, /* input */
28  double &msdm2_value, /* output */
29  Msdm2MapT &msdm2_pmap) /* output */
30 {
31  // sanity check, 1 <= nb_levels <= 3
32  if(nb_levels < 1 || nb_levels > 3)
33  {
34  std::cout << "msdm2_precompiled: nb_levels must be in [1;3]. Aborting."
35  << std::endl;
36  return;
37  }
38 
39  // retrieve Point maps
40  auto pm_degraded = get(boost::vertex_point, mesh_degraded);
41  auto pm_original = get(boost::vertex_point, mesh_original);
42 
43  using FaceNormalMap =
45  MeshT >::pmap_type;
46 
47  // create face normal map for degraded mesh
48  FaceNormalMap fnm_degraded;
49  std::cout << "create face-normal map for degraded mesh" << std::endl;//TODO-rm
50  fnm_degraded = make_property_map(FEVV::face_normal, mesh_degraded);
51 
52  // calculate faces normals of degraded mesh
53  FEVV::Filters::calculate_face_normals(mesh_degraded, pm_degraded,
54  fnm_degraded);
55 
56  // create face normal map for original mesh
57  FaceNormalMap fnm_original;
58  std::cout << "create face-normal map for original mesh" << std::endl;//TODO-rm
59  fnm_original = make_property_map(FEVV::face_normal, mesh_original);
60 
61  // calculate faces normals of original mesh
62  FEVV::Filters::calculate_face_normals(mesh_original, pm_original,
63  fnm_original);
64 
65  // create property maps bag used by msmd2 filter
66  FEVV::PMapsContainer pmaps_bag_degraded;
67  FEVV::PMapsContainer pmaps_bag_original;
68 
69  // call msdm2 filter
71  pm_degraded,
72  fnm_degraded,
73  pmaps_bag_degraded,
74  mesh_original,
75  pm_original,
76  fnm_original,
77  pmaps_bag_original,
78  nb_levels,
79  msdm2_pmap,
80  msdm2_value);
81 }
82 
83 } // namespace msdm2
msdm2
Definition: msdm2_surfacemesh.cpp:20
FEVV::face_normal_t
face_normal_t
Definition: properties.h:77
minmax_map.h
color_mesh.h
calculate_face_normals.hpp
FEVV::PMapsContainer
std::map< std::string, boost::any > PMapsContainer
Definition: properties.h:99
msdm2.h
msdm2_surfacemesh.h
msdm2::Msdm2MapT
boost::vector_property_map< double, VertexIndexMapT > Msdm2MapT
Definition: msdm2_surfacemesh.h:37
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
msdm2::msdm2_surfacemesh
void msdm2_surfacemesh(const MeshT &mesh_degraded, const MeshT &mesh_original, const int nb_levels, double &msdm2_value, Msdm2MapT &msdm2_pmap)
Computes the multiscale MSDM2 metric.
Definition: msdm2_surfacemesh.cpp:25
FEVV::Filters::process_msdm2_multires
double process_msdm2_multires(const HalfedgeGraph &m_poly_degrad, const PointMap &pm_degrad, const FaceNormalMap &fnm_degrad, FEVV::PMapsContainer &pmaps_degrad, const GeometryTraits &gt_degrad, const HalfedgeGraph &m_poly_original, const PointMap &pm_original, const FaceNormalMap &fnm_original, FEVV::PMapsContainer &, const GeometryTraits &, const int nb_level, VertexMSDM2Map &msdm2_pmap, const double maxdim, double &msdm2_value)
Definition: msdm2.h:274
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::_PMap_traits
Definition: properties.h:376
msdm2::MeshT
CGAL::Surface_mesh< CGALPoint > MeshT
Definition: msdm2_surfacemesh.h:32
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