MEPP2 Project
utils_are_meshes_identical.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 <string>
14 
15 
16 typedef float FloatT;
17 
18 
19 /*
20  * \brief Compare two .off files and determine if meshes are equal.
21  * Use an exact comparison.
22  *
23  * \param filenameA Filename of first .off file
24  * \param filenameB Filename of second .off file
25  * \param verbose Display meshes
26  *
27  * \result true when meshes are equal, false otherwise
28  *
29  * \note Limitations. The method is based on replacing the vertex index
30  * by the vertex coordinates in faces descriptions. The comparison
31  * may fail if several vertices have the exact same coordinates.
32  * For example, if vertices #3 and #4 have the same coordinates,
33  * face #1-#2-#3 can be confused with face #1-#2-#4. Then the
34  * comparison may report equality while the meshes are topologically
35  * different.
36  */
37 bool
38 are_meshes_equal(std::string filename_a, std::string filename_b, bool verbose);
39 
40 
41 /*
42  * \brief Compare two .off files and determine if meshes are equal.
43  * Use a "close enough" comparison using an absolute or relative
44  * threshold.
45  *
46  * \param filenameA Filename of first .off file
47  * \param filenameB Filename of second .off file
48  * \param verbose Display meshes
49  * \param threshold relative or absolute error tolerated in float comparison
50  * for both geometry and attributes ; if the threshold
51  * is zero, an exact comparison occurs
52  * \param relative_threshold if true, the threshold is considered as
53  * a relative value, else it is considered as
54  * an absolute value
55  *
56  *
57  * \result true when meshes are equal, false otherwise
58  *
59  * \note Limitations. The method is based on replacing the vertex index
60  * by the vertex coordinates in faces descriptions. The comparison
61  * may fail if several vertices have the exact same coordinates.
62  * For example, if vertices #3 and #4 have the same coordinates,
63  * face #1-#2-#3 can be confused with face #1-#2-#4. Then the
64  * comparison may report equality while the meshes are topologically
65  * different.
66  */
67 bool
68 are_meshes_equal(std::string filename_a,
69  std::string filename_b,
70  bool verbose,
71  FloatT threshold,
72  bool relative_threshold);
73 
74 
75 /*
76  * \brief Compare two .off files and determine if meshes are equal.
77  * Use a "close enough" comparison using an absolute or relative
78  * threshold.
79  *
80  * \param filenameA Filename of first .off file
81  * \param filenameB Filename of second .off file
82  * \param verbose Display meshes
83  * \param geom_threshold relative or absolute error tolerated in float
84  * comparison for geometry ; if the threshold is zero, an exact
85  * comparison occurs
86  * \param attr_threshold relative or absolute error tolerated in float
87  * comparison for attributes ; if the threshold is zero, an exact
88  * comparison occurs
89  * \param relative_threshold if true, the threshold is considered as a
90  * relative value, else it is considered as an absolute value
91  *
92  * \result true when meshes are equal, false otherwise
93  *
94  * \note Limitations. The method is based on replacing the vertex index
95  * by the vertex coordinates in faces descriptions. The comparison
96  * may fail if several vertices have the exact same coordinates.
97  * For example, if vertices #3 and #4 have the same coordinates,
98  * face #1-#2-#3 can be confused with face #1-#2-#4. Then the
99  * comparison may report equality while the meshes are topologically
100  * different.
101  */
102 bool
103 are_meshes_equal(std::string filename_a,
104  std::string filename_b,
105  bool verbose,
106  FloatT geom_threshold,
107  FloatT attr_threshold,
108  bool relative_thresholds);
109 
110 
FloatT
float FloatT
Definition: utils_are_meshes_identical.hpp:16
are_meshes_equal
bool are_meshes_equal(std::string filename_a, std::string filename_b, bool verbose)
Definition: utils_are_meshes_identical.inl:925
utils_are_meshes_identical.inl