DGtal  1.0.0
MeshHelpers.h
1 
17 #pragma once
18 
31 #if defined(MeshHelpers_RECURSES)
32 #error Recursive header files inclusion detected in MeshHelpers.h
33 #else // defined(MeshHelpers_RECURSES)
34 
35 #define MeshHelpers_RECURSES
36 
37 #if !defined MeshHelpers_h
38 
39 #define MeshHelpers_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/topology/CCellEmbedder.h"
46 #include "DGtal/topology/CDigitalSurfaceContainer.h"
47 #include "DGtal/topology/DigitalSurface.h"
48 #include "DGtal/shapes/TriangulatedSurface.h"
49 #include "DGtal/shapes/PolygonalSurface.h"
50 #include "DGtal/shapes/Mesh.h"
52 
53 namespace DGtal
54 {
55 
57  // template class MeshHelpers
63  {
64  // ----------------------- Static services ------------------------------
65  public:
79  template <typename Point>
80  static
82  ( const Mesh<Point>& mesh,
83  TriangulatedSurface<Point>& trisurf );
84 
95  template <typename Point>
96  static
98  ( const Mesh<Point>& mesh,
99  PolygonalSurface<Point>& polysurf );
100 
128  template <typename Point>
129  static
131  ( const PolygonalSurface<Point>& polysurf,
133  bool centroid = true );
134 
151  template < typename DigitalSurfaceContainer,
152  typename CellEmbedder,
153  typename VertexMap >
154  static
157  const CellEmbedder& cembedder,
159  VertexMap& vertexmap );
160 
172  template < typename DigitalSurfaceContainer,
173  typename CellEmbedder,
174  typename VertexMap >
175  static
178  const CellEmbedder& cembedder,
180  VertexMap& vertexmap );
181 
195  template < typename DigitalSurfaceContainer,
196  typename CellEmbedder,
197  typename CellMap >
198  static
201  const CellEmbedder& cembedder,
203  CellMap& cellmap );
204 
205 
214  template <typename Point>
215  static
217  ( const TriangulatedSurface<Point>& trisurf,
218  Mesh<Point>& mesh );
219 
228  template <typename Point>
229  static
231  ( const PolygonalSurface<Point>& polysurf,
232  Mesh<Point>& mesh );
233 
240  template <typename Point>
241  static
242  bool exportOBJ
243  ( std::ostream& output,
244  const TriangulatedSurface<Point>& trisurf );
245 
252  template <typename Point>
253  static
254  bool exportOBJ
255  ( std::ostream& output,
256  const PolygonalSurface<Point>& polysurf );
257 
258 
272  template <typename TTriangulatedOrPolygonalSurface>
273  static
275  ( std::ostream& output_obj,
276  const std::string& mtl_filename,
277  const TTriangulatedOrPolygonalSurface& polysurf,
278  const std::vector< typename TTriangulatedOrPolygonalSurface::Point >& normals,
279  const std::vector< Color >& diffuse_colors,
280  const Color& ambient_color = Color( 32, 32, 32 ),
281  const Color& diffuse_color = Color( 200, 200, 255 ),
282  const Color& specular_color = Color::White );
283 
284 
292  static
294  ( std::ostream& output_mtl,
295  unsigned int idxMaterial,
296  const Color& ambient_color,
297  const Color& diffuse_color,
298  const Color& specular_color );
299 
300  }; // end of class MeshHelpers
301 
302 } // namespace DGtal
303 
304 
306 // Includes inline functions.
307 #include "DGtal/shapes/MeshHelpers.ih"
308 
309 // //
311 
312 #endif // !defined MeshHelpers_h
313 
314 #undef MeshHelpers_RECURSES
315 #endif // else defined(MeshHelpers_RECURSES)
static void digitalSurface2DualTriangulatedSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, TriangulatedSurface< typename CellEmbedder::Value > &trisurf, VertexMap &vertexmap)
static void polygonalSurface2Mesh(const PolygonalSurface< Point > &polysurf, Mesh< Point > &mesh)
static void digitalSurface2DualPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, VertexMap &vertexmap)
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition: Mesh.h:91
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
static void triangulatedSurface2Mesh(const TriangulatedSurface< Point > &trisurf, Mesh< Point > &mesh)
static bool exportMTLNewMaterial(std::ostream &output_mtl, unsigned int idxMaterial, const Color &ambient_color, const Color &diffuse_color, const Color &specular_color)
static bool digitalSurface2PrimalPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, CellMap &cellmap)
static bool exportOBJ(std::ostream &output, const TriangulatedSurface< Point > &trisurf)
static bool mesh2PolygonalSurface(const Mesh< Point > &mesh, PolygonalSurface< Point > &polysurf)
Aim: Represents a triangulated surface. The topology is stored with a half-edge data structure....
static bool exportOBJwithFaceNormalAndColor(std::ostream &output_obj, const std::string &mtl_filename, const TTriangulatedOrPolygonalSurface &polysurf, const std::vector< typename TTriangulatedOrPolygonalSurface::Point > &normals, const std::vector< Color > &diffuse_colors, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
static void polygonalSurface2TriangulatedSurface(const PolygonalSurface< Point > &polysurf, TriangulatedSurface< Point > &trisurf, bool centroid=true)
DGtal is the top-level namespace which contains all DGtal functions and types.
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
static const Color White
Definition: Color.h:390
static bool mesh2TriangulatedSurface(const Mesh< Point > &mesh, TriangulatedSurface< Point > &trisurf)
Aim: Static class that provides builder and converters between meshes.
Definition: MeshHelpers.h:62
Aim: Represents a polygon mesh, i.e. a 2-dimensional combinatorial surface whose faces are (topologic...