DGtal  1.4.2
SurfaceMeshWriter.h
1 
17 #pragma once
18 
31 #if defined(SurfaceMeshWriter_RECURSES)
32 #error Recursive header files inclusion detected in SurfaceMeshWriter.h
33 #else // defined(SurfaceMeshWriter_RECURSES)
35 #define SurfaceMeshWriter_RECURSES
36 
37 #if !defined SurfaceMeshWriter_h
39 #define SurfaceMeshWriter_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <sstream>
45 #include <string>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/helpers/StdDefs.h"
48 #include "DGtal/shapes/SurfaceMesh.h"
49 #include "DGtal/io/Color.h"
50 
51 namespace DGtal
52 {
53 
55  // template class SurfaceMeshWriter
63  template < typename TRealPoint, typename TRealVector >
65  {
66  typedef TRealPoint RealPoint;
67  typedef TRealVector RealVector;
69  static const Dimension dimension = RealPoint::dimension;
71 
73  typedef typename SurfaceMesh::Size Size;
74  typedef typename SurfaceMesh::Index Index;
75  typedef typename SurfaceMesh::Vertex Vertex;
76  typedef typename SurfaceMesh::Vertices Vertices;
77  typedef typename SurfaceMesh::Face Face;
78  typedef typename SurfaceMesh::Faces Faces;
79  typedef typename SurfaceMesh::Scalar Scalar;
80  typedef typename SurfaceMesh::Scalars Scalars;
81  typedef std::vector< Color > Colors;
82 
87  static
88  bool writeOBJ( std::ostream & output, const SurfaceMesh & smesh );
89 
101  static
102  bool writeOBJ( std::string objfile,
103  const SurfaceMesh & smesh,
104  const Colors& diffuse_colors = Colors(),
105  const Color& ambient_color = Color( 32, 32, 32 ),
106  const Color& diffuse_color = Color( 200, 200, 255 ),
107  const Color& specular_color = Color::White );
108 
126  template <typename EdgePredicate>
127  static
128  bool writeEdgeLinesOBJ( std::string objfile,
129  const SurfaceMesh & smesh,
130  const EdgePredicate & edge_predicate,
131  const double relative_thickness = 0.05,
132  const Color& ambient_color = Color::Black,
133  const Color& diffuse_color = Color::Black,
134  const Color& specular_color= Color::Black );
135 
154  static
155  bool writeIsoLinesOBJ( std::string objfile,
156  const SurfaceMesh & smesh,
157  const Scalars& face_values,
158  const Scalars& vertex_values,
159  const Scalar iso_value,
160  const double relative_thickness = 0.05,
161  const Color& ambient_color = Color::Black,
162  const Color& diffuse_color = Color::Black,
163  const Color& specular_color= Color::Black );
164 
187  static
188  bool writeIsoLinesOBJ( std::string objfile,
189  const SurfaceMesh & smesh,
190  const Scalars& face_values,
191  const Scalars& vertex_values,
192  const Scalars& iso_values,
193  const double relative_thickness = 0.05,
194  const Colors& diffuse_colors = Colors(),
195  const Color& ambient_color = Color::Black,
196  const Color& diffuse_color = Color::Black,
197  const Color& specular_color= Color::Black );
198 
199  };
200 
201 
202 } // namespace DGtal
203 
205 // Includes inline functions.
206 #include "SurfaceMeshWriter.ih"
207 // //
209 
210 #endif // !defined SurfaceMeshWriter_h
211 
212 #undef SurfaceMeshWriter_RECURSES
213 #endif // else defined(SurfaceMeshWriter_RECURSES)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
static const Color White
Definition: Color.h:415
static const Color Black
Definition: Color.h:413
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition: Common.h:136
Aim: An helper class for writing mesh file formats (Waverfront OBJ at this point) and creating a Surf...
SurfaceMesh::Scalar Scalar
static bool writeOBJ(std::string objfile, const SurfaceMesh &smesh, const Colors &diffuse_colors=Colors(), const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
static bool writeOBJ(std::ostream &output, const SurfaceMesh &smesh)
SurfaceMeshWriter< RealPoint, RealVector > Self
static bool writeIsoLinesOBJ(std::string objfile, const SurfaceMesh &smesh, const Scalars &face_values, const Scalars &vertex_values, const Scalar iso_value, const double relative_thickness=0.05, const Color &ambient_color=Color::Black, const Color &diffuse_color=Color::Black, const Color &specular_color=Color::Black)
static bool writeEdgeLinesOBJ(std::string objfile, const SurfaceMesh &smesh, const EdgePredicate &edge_predicate, const double relative_thickness=0.05, const Color &ambient_color=Color::Black, const Color &diffuse_color=Color::Black, const Color &specular_color=Color::Black)
SurfaceMesh::Vertex Vertex
SurfaceMesh::Index Index
DGtal::SurfaceMesh< RealPoint, RealVector > SurfaceMesh
SurfaceMesh::Vertices Vertices
std::vector< Color > Colors
static const Dimension dimension
SurfaceMesh::Scalars Scalars
BOOST_STATIC_ASSERT((dimension==3))
SurfaceMesh::Faces Faces
static bool writeIsoLinesOBJ(std::string objfile, const SurfaceMesh &smesh, const Scalars &face_values, const Scalars &vertex_values, const Scalars &iso_values, const double relative_thickness=0.05, const Colors &diffuse_colors=Colors(), const Color &ambient_color=Color::Black, const Color &diffuse_color=Color::Black, const Color &specular_color=Color::Black)
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
Definition: SurfaceMesh.h:92
std::vector< Vertex > Vertices
The type that defines a list/range of vertices (e.g. to define faces)
Definition: SurfaceMesh.h:112
std::vector< Scalar > Scalars
Definition: SurfaceMesh.h:101
std::size_t Index
The type used for numbering vertices and faces.
Definition: SurfaceMesh.h:105
std::size_t Size
The type for counting elements.
Definition: SurfaceMesh.h:103
RealVector::Component Scalar
Definition: SurfaceMesh.h:100
std::vector< Face > Faces
Definition: SurfaceMesh.h:116