Go to the documentation of this file.
11 #include <CGAL/Cartesian.h>
12 #include <CGAL/Surface_mesh.h>
13 #include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
37 using MeshT = CGAL::Surface_mesh< CGALPoint >;
41 main(
int argc,
const char **argv)
46 <<
"Load 2 meshes from input files, compute their MSDM2, write it to "
47 "an output file, then compare the output file with a reference file."
49 std::cout <<
"Usage: " << argv[0]
50 <<
" input_original_mesh_file input_deformed_mesh_file "
51 "output_mesh_file reference_mesh_file"
53 std::cout <<
"Example: " << argv[0]
54 <<
" armadillo.obj armadillo_simplified.obj armadillo.out.obj "
55 "armadillo_output_reference.obj"
60 std::string input_original_file_path = argv[1];
61 std::string input_deformed_file_path = argv[2];
62 std::string output_file_path = argv[3];
63 std::string reference_file_path = argv[4];
75 input_original_file_path, m_original, pmaps_bag_original);
80 input_deformed_file_path, m_degraded, pmaps_bag_degraded);
82 auto pm_degrad =
get(boost::vertex_point, m_degraded);
83 auto pm_original =
get(boost::vertex_point, m_original);
88 FaceNormalMap fnm_degrad;
91 std::cout <<
"use existing face-normal map for degraded mesh" << std::endl;
97 std::cout <<
"create face-normal map for degraded mesh" << std::endl;
105 FaceNormalMap fnm_original;
108 std::cout <<
"use existing face-normal map for original mesh" << std::endl;
114 std::cout <<
"create face-normal map for original mesh" << std::endl;
120 m_original, pm_original, fnm_original);
126 VertexMSDM2Map msdm2_pmap;
128 if(
FEVV::has_map(pmaps_bag_degraded, std::string(
"v:msdm2")))
131 boost::any_cast< VertexMSDM2Map >(pmaps_bag_degraded.at(
"v:msdm2"));
136 FEVV::make_vertex_property_map< FEVV::MeshSurface, double >(m_degraded);
137 pmaps_bag_degraded[
"v:msdm2"] = msdm2_pmap;
155 std::cout <<
"Calculated MSDM2 : " << msd_m2 << std::endl;
157 using VertexColorMap =
163 std::cout <<
"use existing vertex-color map" << std::endl;
168 std::cout <<
"create vertex-color map" << std::endl;
174 double max_msd_m2, min_msd_m2;
177 m_degraded, msdm2_pmap, min_msd_m2, max_msd_m2);
180 m_degraded, msdm2_pmap, v_cm, min_msd_m2, max_msd_m2, lut_courbure_clust);
185 std::cout <<
"Comparing output file '" << output_file_path
186 <<
"' with reference file '" << reference_file_path <<
"'..."
195 std::cout <<
"Files are different!" << std::endl;
204 std::cout <<
"Files are different!" << std::endl;
209 std::cout <<
"Files are identical." << std::endl;
void put_property_map(PropertyT p, const MeshT &, PMapsContainer &pmaps, const typename PMap_traits< PropertyT, MeshT >::pmap_type &pmap)
void compute_min_max_vertices(const HalfedgeGraph &g, const PropertyMap &prop_map, MapType &min_metric, MapType &max_metric)
Compute min and max value of a numerical property map for the vertices of a mesh.
PMap_traits< PropertyT, MeshT >::pmap_type get_property_map(PropertyT p, const MeshT &, const PMapsContainer &pmaps)
bool has_map(const PMapsContainer &pmaps, const std::string &map_name)
(refer to Property Maps API)
bool are_meshes_equal(std::string filename_a, std::string filename_b, bool verbose)
CGAL::Surface_mesh< CGALPoint > MeshSurface
std::map< std::string, boost::any > PMapsContainer
void color_vertices_from_map(const HalfedgeGraph &g, const PropertyMap &prop_map, ColorMap &color_pmap, const MapType min_metric, const MapType max_metric, const ColorMeshLUT &colors=make_LUT())
Fill the color map for the vertices of a mesh using a numerical property map.
ColorMeshLUT make_LUT(bool color_in_0_255=true, unsigned int colors_nbr=256, float h1=240, float h2=0)
Create a RGB LUT based on an HSV range. Default range creates a blue-cyan-green-yellow-red gradient.
bool identical_text_based_files(std::string filename_a, std::string filename_b, const std::vector< std::string > &skip=std::vector< std::string >())
CGAL::Cartesian< double > CGALKernel
std::vector< float > ColorMeshLUT
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
void calculate_face_normals(const HalfedgeGraph &g, const PointMap &pm, FaceNormalMap fnm, const GeometryTraits >)
Calculate "some" normal of all the faces of the considered mesh and populate the argument provided Fa...
typename Vertex_pmap_traits< MeshT, ValueT >::pmap_type Vertex_pmap
double process_msdm2_multires(const HalfedgeGraph &m_poly_degrad, const PointMap &pm_degrad, const FaceNormalMap &fnm_degrad, FEVV::PMapsContainer &pmaps_degrad, const GeometryTraits >_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)
void write_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps)
Write mesh to file.
CGALKernel::Point_3 CGALPoint
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.
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
bool has_extension(const std::string &file_name)
int main(int argc, const char **argv)
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)