Debug.hpp
Go to the documentation of this file.
1 
28 /*
29  * Debug.hpp
30  *
31  * Collection of functions to debug mesh generation.
32  *
33  * @date 18.07.2017
34  * @author Johan M. von Behren <johan@vonbehren.eu>
35  */
36 
37 #ifndef LVR2_UTIL_DEBUG_H_
38 #define LVR2_UTIL_DEBUG_H_
39 
40 #include <boost/iostreams/device/null.hpp>
41 #include <array>
42 #include <fstream>
43 #include <vector>
44 
45 using std::array;
46 using std::string;
47 using std::vector;
48 
53 
54 namespace lvr2
55 {
56 
57 inline std::ostream& dout()
58 {
59  // To have a "null" ostream, it's apparently a good idea to use an
60  // unopened file, as no one ever checks the error state or sth. Source:
61  //
62  // https://stackoverflow.com/a/8244052/2408867
63  static bool isDebug = getenv("LVR2_MESH_DEBUG") != nullptr;
64  static std::ofstream unopenedFile;
65 
66  return isDebug ? cout : unopenedFile;
67 }
68 
72 template<typename BaseVecT>
73 void writeDebugMesh(
74  const BaseMesh<BaseVecT>& mesh,
75  string filename = "debug.ply",
76  Rgb8Color color = {255, 0, 0}
77 );
78 
88 template<typename BaseVecT>
89 vector<vector<VertexHandle>> getDuplicateVertices(const BaseMesh<BaseVecT>& mesh);
90 
97 template<typename BaseVecT>
99  const BaseMesh<BaseVecT>& mesh,
100  string filename = "debug-contours.ply",
101  Rgb8Color connectedColor = {0, 255, 0},
102  Rgb8Color contourColor = {0, 0, 255},
103  Rgb8Color bugColor = {255, 0, 0}
104 );
105 
106 #ifdef NDEBUG
107 #define DOINDEBUG(...) ;
108 #else
109 #define DOINDEBUG(...) __VA_ARGS__
110 #endif
111 
112 } // namespace lvr2
113 
114 #include "lvr2/util/Debug.tcc"
115 
116 #endif /* LVR2_UTIL_DEBUG_H_ */
Handles.hpp
lvr2::writeDebugMesh
void writeDebugMesh(const BaseMesh< BaseVecT > &mesh, string filename="debug.ply", Rgb8Color color={255, 0, 0})
Write a mesh to the given filename and color it with the given color.
lvr2::dout
std::ostream & dout()
Definition: Debug.hpp:57
BaseMesh.hpp
lvr2::Rgb8Color
std::array< uint8_t, 3 > Rgb8Color
Definition: ColorAlgorithms.hpp:54
scripts.normalize_multiple.filename
filename
Definition: normalize_multiple.py:60
lvr2::getDuplicateVertices
vector< vector< VertexHandle > > getDuplicateVertices(const BaseMesh< BaseVecT > &mesh)
Returns all handles of duplicate vertices from the given mesh.
lvr2::writeDebugContourMesh
void writeDebugContourMesh(const BaseMesh< BaseVecT > &mesh, string filename="debug-contours.ply", Rgb8Color connectedColor={0, 255, 0}, Rgb8Color contourColor={0, 0, 255}, Rgb8Color bugColor={255, 0, 0})
Writes a mesh to the given filename and colors it with the following meaning:
lvr2
Definition: BaseBufferManipulators.hpp:39
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26
ClusterPainter.hpp
ColorAlgorithms.hpp


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23