DGtal  1.1.0
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)
34 
35 #define SurfaceMeshWriter_RECURSES
36 
37 #if !defined SurfaceMeshWriter_h
38 
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;
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)
DGtal::SurfaceMesh::Vertex
Index Vertex
Definition: SurfaceMesh.h:108
DGtal::SurfaceMesh::Scalar
RealVector::Component Scalar
Definition: SurfaceMesh.h:100
DGtal::SurfaceMeshWriter::Face
SurfaceMesh::Face Face
Definition: SurfaceMeshWriter.h:77
DGtal::SurfaceMeshWriter::Size
SurfaceMesh::Size Size
Definition: SurfaceMeshWriter.h:73
DGtal::SurfaceMeshWriter::dimension
static const Dimension dimension
Definition: SurfaceMeshWriter.h:69
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:133
DGtal::SurfaceMesh
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
Definition: SurfaceMesh.h:92
DGtal::SurfaceMeshWriter
Aim: An helper class for writing mesh file formats (Waverfront OBJ at this point) and creating a Surf...
Definition: SurfaceMeshWriter.h:65
DGtal::Color::Black
static const Color Black
Definition: Color.h:397
DGtal::SurfaceMeshWriter::writeEdgeLinesOBJ
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)
DGtal::SurfaceMeshWriter::SurfaceMesh
DGtal::SurfaceMesh< RealPoint, RealVector > SurfaceMesh
Definition: SurfaceMeshWriter.h:72
DGtal::SurfaceMesh::Faces
std::vector< Face > Faces
Definition: SurfaceMesh.h:116
DGtal::SurfaceMesh::Vertices
std::vector< Vertex > Vertices
The type that defines a list/range of vertices (e.g. to define faces)
Definition: SurfaceMesh.h:112
DGtal::Color::White
static const Color White
Definition: Color.h:399
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::SurfaceMeshWriter::Vertices
SurfaceMesh::Vertices Vertices
Definition: SurfaceMeshWriter.h:76
DGtal::SurfaceMeshWriter::Scalars
SurfaceMesh::Scalars Scalars
Definition: SurfaceMeshWriter.h:80
DGtal::SurfaceMeshWriter::writeOBJ
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)
DGtal::SurfaceMeshWriter::Scalar
SurfaceMesh::Scalar Scalar
Definition: SurfaceMeshWriter.h:79
DGtal::SurfaceMeshWriter::writeIsoLinesOBJ
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)
DGtal::SurfaceMesh::Scalars
std::vector< Scalar > Scalars
Definition: SurfaceMesh.h:101
DGtal::SurfaceMesh::Face
Index Face
Definition: SurfaceMesh.h:106
DGtal::PointVector::dimension
static const Dimension dimension
Copy of the static dimension of the Point/Vector.
Definition: PointVector.h:626
DGtal::SurfaceMeshWriter::RealVector
TRealVector RealVector
Definition: SurfaceMeshWriter.h:67
DGtal::SurfaceMeshWriter::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((dimension==3))
DGtal::SurfaceMeshWriter::Index
SurfaceMesh::Index Index
Definition: SurfaceMeshWriter.h:74
DGtal::SurfaceMeshWriter::writeIsoLinesOBJ
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)
DGtal::SurfaceMesh::Size
std::size_t Size
The type for counting elements.
Definition: SurfaceMesh.h:103
DGtal::SurfaceMeshWriter::Self
SurfaceMeshWriter< RealPoint, RealVector > Self
Definition: SurfaceMeshWriter.h:68
DGtal::SurfaceMeshWriter::Colors
std::vector< Color > Colors
Definition: SurfaceMeshWriter.h:81
DGtal::SurfaceMeshWriter::writeOBJ
static bool writeOBJ(std::ostream &output, const SurfaceMesh &smesh)
DGtal::SurfaceMeshWriter::Faces
SurfaceMesh::Faces Faces
Definition: SurfaceMeshWriter.h:78
DGtal::SurfaceMeshWriter::RealPoint
TRealPoint RealPoint
Definition: SurfaceMeshWriter.h:66
DGtal::SurfaceMesh::Index
std::size_t Index
The type used for numbering vertices and faces.
Definition: SurfaceMesh.h:105
DGtal::SurfaceMeshWriter::Vertex
SurfaceMesh::Vertex Vertex
Definition: SurfaceMeshWriter.h:75