DGtal  1.5.beta
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)
35 #define MeshHelpers_RECURSES
36 
37 #if !defined MeshHelpers_h
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"
51 #include "DGtal/shapes/SurfaceMesh.h"
53 
54 namespace DGtal
55 {
56 
58  // template class MeshHelpers
64  {
65  // ----------------------- Static services ------------------------------
66  public:
67 
68 
82  template <typename Point>
83  static
85  ( const Mesh<Point>& mesh,
86  TriangulatedSurface<Point>& trisurf );
87 
98  template <typename Point>
99  static
101  ( const Mesh<Point>& mesh,
102  PolygonalSurface<Point>& polysurf );
103 
131  template <typename Point>
132  static
134  ( const PolygonalSurface<Point>& polysurf,
136  bool centroid = true );
137 
154  template < typename DigitalSurfaceContainer,
155  typename CellEmbedder,
156  typename VertexMap >
157  static
160  const CellEmbedder& cembedder,
162  VertexMap& vertexmap );
163 
175  template < typename DigitalSurfaceContainer,
176  typename CellEmbedder,
177  typename VertexMap >
178  static
181  const CellEmbedder& cembedder,
183  VertexMap& vertexmap );
184 
198  template < typename DigitalSurfaceContainer,
199  typename CellEmbedder,
200  typename CellMap >
201  static
204  const CellEmbedder& cembedder,
206  CellMap& cellmap );
207 
222  template < typename DigitalSurfaceContainer,
223  typename CellEmbedder,
224  typename CellMap >
225  static
228  const CellEmbedder& cembedder,
230  CellMap& cellmap );
231 
232 
241  template <typename Point>
242  static
244  ( const TriangulatedSurface<Point>& trisurf,
245  Mesh<Point>& mesh );
246 
255  template <typename Point>
256  static
258  ( const PolygonalSurface<Point>& polysurf,
259  Mesh<Point>& mesh );
260 
271  template < typename RealPoint, typename RealVector >
272  static
275  Mesh< RealPoint >& mesh, const std::vector<Color> &cols = {} );
276 
283  template <typename Point>
284  static
286  ( std::ostream& output,
287  const TriangulatedSurface<Point>& trisurf );
288 
295  template <typename Point>
296  static
298  ( std::ostream& output,
299  const PolygonalSurface<Point>& polysurf );
300 
301 
315  template <typename TTriangulatedOrPolygonalSurface>
316  static
318  ( std::ostream& output_obj,
319  const std::string& mtl_filename,
320  const TTriangulatedOrPolygonalSurface& polysurf,
321  const std::vector< typename TTriangulatedOrPolygonalSurface::Point >& normals,
322  const std::vector< Color >& diffuse_colors,
323  const Color& ambient_color = Color( 32, 32, 32 ),
324  const Color& diffuse_color = Color( 200, 200, 255 ),
325  const Color& specular_color = Color::White );
326 
327 
335  static
337  ( std::ostream& output_mtl,
338  unsigned long idxMaterial,
339  const Color& ambient_color,
340  const Color& diffuse_color,
341  const Color& specular_color );
342 
343  }; // end of class MeshHelpers
344 
345 } // namespace DGtal
346 
347 
349 // Includes inline functions.
350 #include "DGtal/shapes/MeshHelpers.ih"
351 
352 // //
354 
355 #endif // !defined MeshHelpers_h
356 
357 #undef MeshHelpers_RECURSES
358 #endif // else defined(MeshHelpers_RECURSES)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
static const Color White
Definition: Color.h:415
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: Static class that provides builder and converters between meshes.
Definition: MeshHelpers.h:64
static bool exportOBJ(std::ostream &output, const TriangulatedSurface< Point > &trisurf)
static bool digitalSurface2PrimalSurfaceMesh(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, SurfaceMesh< typename CellEmbedder::Value, typename CellEmbedder::Value > &polysurf, CellMap &cellmap)
static bool digitalSurface2PrimalPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, CellMap &cellmap)
static bool mesh2TriangulatedSurface(const Mesh< Point > &mesh, TriangulatedSurface< Point > &trisurf)
static void polygonalSurface2TriangulatedSurface(const PolygonalSurface< Point > &polysurf, TriangulatedSurface< Point > &trisurf, bool centroid=true)
static bool exportMTLNewMaterial(std::ostream &output_mtl, unsigned long idxMaterial, const Color &ambient_color, const Color &diffuse_color, const Color &specular_color)
static void polygonalSurface2Mesh(const PolygonalSurface< Point > &polysurf, Mesh< Point > &mesh)
static void digitalSurface2DualTriangulatedSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, TriangulatedSurface< typename CellEmbedder::Value > &trisurf, VertexMap &vertexmap)
static void surfaceMesh2Mesh(const SurfaceMesh< RealPoint, RealVector > &smesh, Mesh< RealPoint > &mesh, const std::vector< Color > &cols={})
static bool exportOBJ(std::ostream &output, const PolygonalSurface< Point > &polysurf)
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 digitalSurface2DualPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, VertexMap &vertexmap)
static void triangulatedSurface2Mesh(const TriangulatedSurface< Point > &trisurf, Mesh< Point > &mesh)
static bool mesh2PolygonalSurface(const Mesh< Point > &mesh, PolygonalSurface< Point > &polysurf)
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition: Mesh.h:92
Aim: Represents a polygon mesh, i.e. a 2-dimensional combinatorial surface whose faces are (topologic...
Aim: Represents a triangulated surface. The topology is stored with a half-edge data structure....
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
Definition: SurfaceMesh.h:92