DGtal  1.5.beta
DGtal::SurfaceMeshWriter< TRealPoint, TRealVector > Struct Template Reference

Aim: An helper class for writing mesh file formats (Waverfront OBJ at this point) and creating a SurfaceMesh. More...

#include <DGtal/io/writers/SurfaceMeshWriter.h>

Public Types

typedef TRealPoint RealPoint
 
typedef TRealVector RealVector
 
typedef SurfaceMeshWriter< RealPoint, RealVectorSelf
 
typedef DGtal::SurfaceMesh< RealPoint, RealVectorSurfaceMesh
 
typedef SurfaceMesh::Size Size
 
typedef SurfaceMesh::Index Index
 
typedef SurfaceMesh::Vertex Vertex
 
typedef SurfaceMesh::Vertices Vertices
 
typedef SurfaceMesh::Face Face
 
typedef SurfaceMesh::Faces Faces
 
typedef SurfaceMesh::Scalar Scalar
 
typedef SurfaceMesh::Scalars Scalars
 
typedef std::vector< ColorColors
 

Public Member Functions

 BOOST_STATIC_ASSERT ((dimension==3))
 

Static Public Member Functions

static bool writeOBJ (std::ostream &output, const SurfaceMesh &smesh)
 
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)
 
template<typename EdgePredicate >
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)
 
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 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)
 

Static Public Attributes

static const Dimension dimension = RealPoint::dimension
 

Detailed Description

template<typename TRealPoint, typename TRealVector>
struct DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >

Aim: An helper class for writing mesh file formats (Waverfront OBJ at this point) and creating a SurfaceMesh.

Description of template class 'SurfaceMeshWriter'

Template Parameters
TRealPointan arbitrary model of RealPoint.
TRealVectoran arbitrary model of RealVector.

Definition at line 64 of file SurfaceMeshWriter.h.

Member Typedef Documentation

◆ Colors

template<typename TRealPoint , typename TRealVector >
typedef std::vector< Color > DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Colors

Definition at line 81 of file SurfaceMeshWriter.h.

◆ Face

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Face DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Face

Definition at line 77 of file SurfaceMeshWriter.h.

◆ Faces

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Faces DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Faces

Definition at line 78 of file SurfaceMeshWriter.h.

◆ Index

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Index DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Index

Definition at line 74 of file SurfaceMeshWriter.h.

◆ RealPoint

template<typename TRealPoint , typename TRealVector >
typedef TRealPoint DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::RealPoint

Definition at line 66 of file SurfaceMeshWriter.h.

◆ RealVector

template<typename TRealPoint , typename TRealVector >
typedef TRealVector DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::RealVector

Definition at line 67 of file SurfaceMeshWriter.h.

◆ Scalar

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Scalar DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Scalar

Definition at line 79 of file SurfaceMeshWriter.h.

◆ Scalars

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Scalars DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Scalars

Definition at line 80 of file SurfaceMeshWriter.h.

◆ Self

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMeshWriter< RealPoint, RealVector > DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Self

Definition at line 68 of file SurfaceMeshWriter.h.

◆ Size

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Size DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Size

Definition at line 73 of file SurfaceMeshWriter.h.

◆ SurfaceMesh

template<typename TRealPoint , typename TRealVector >
typedef DGtal::SurfaceMesh< RealPoint, RealVector > DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::SurfaceMesh

Definition at line 72 of file SurfaceMeshWriter.h.

◆ Vertex

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Vertex DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Vertex

Definition at line 75 of file SurfaceMeshWriter.h.

◆ Vertices

template<typename TRealPoint , typename TRealVector >
typedef SurfaceMesh::Vertices DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::Vertices

Definition at line 76 of file SurfaceMeshWriter.h.

Member Function Documentation

◆ BOOST_STATIC_ASSERT()

template<typename TRealPoint , typename TRealVector >
DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::BOOST_STATIC_ASSERT ( (dimension==3)  )

◆ writeEdgeLinesOBJ()

template<typename TRealPoint , typename TRealVector >
template<typename EdgePredicate >
static bool DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::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 
)
static

Writes, in an OBJ file, the geometric lines on edges that satisfies the given edge predicate.

Template Parameters
EdgePredicateany type of functor SurfaceMesh::Edge -> bool.
Parameters
[in]objfilethe name of the OBJ file (like "contour" or "contour.obj").
[in]smeshthe surface mesh.
[in]edge_predicatethe edge predicate, a functor SurfaceMesh::Edge -> bool.
[in]relative_thicknessthe thickness as a ratio of the average edge length of the mesh.
[in]ambient_color,diffuse_color,specular_colorthe default color information for each face.

◆ writeIsoLinesOBJ() [1/2]

template<typename TRealPoint , typename TRealVector >
static bool DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::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

Writes, in an OBJ file, the geometric isolines of a scalar field around value iso_value. Scalar values of the scalar field should be given at vertices and face centroids.

Parameters
[in]objfilethe name of the OBJ file (like "isocontour" or "isocontour.obj").
[in]smeshthe surface mesh.
[in]face_values,vertex_valuesthe range of values of the scalard field at faces and at vertices.
[in]iso_valuethe value of the isoline to output.
[in]relative_thicknessthe thickness as a ratio of the average edge length of the mesh.
[in]ambient_color,diffuse_color,specular_colorthe default color information for each face.

◆ writeIsoLinesOBJ() [2/2]

template<typename TRealPoint , typename TRealVector >
static bool DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::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 
)
static

Writes, in an OBJ file, the geometric isolines of a scalar field around values iso_values. Scalar values of the scalar field should be given at vertices and face centroids.

Parameters
[in]objfilethe name of the OBJ file (like "isocontour" or "isocontour.obj").
[in]smeshthe surface mesh.
[in]face_values,vertex_valuesthe range of values of the scalard field at faces and at vertices.
[in]iso_valuesthe values of the isolines to output.
[in]relative_thicknessthe thickness as a ratio of the average edge length of the mesh.
[in]diffuse_colorsthe range of colors for each isoline (in same order) or empty range (then the color is always diffuse_color).
[in]ambient_color,diffuse_color,specular_colorthe default color information for each face.

◆ writeOBJ() [1/2]

template<typename TRealPoint , typename TRealVector >
static bool DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::writeOBJ ( std::ostream &  output,
const SurfaceMesh smesh 
)
static

Writes a surface mesh in an output file (in OBJ file format).

Parameters
[in,out]outputthe output stream where the OBJ file is written.
[in]smeshthe surface mesh.
Returns
'true' if writing in the output stream was ok.
Examples
geometry/tools/exampleLatticeBallDelaunay2D.cpp, geometry/tools/exampleLatticeBallDelaunay3D.cpp, geometry/tools/exampleLatticeBallQuickHull3D.cpp, geometry/tools/exampleQuickHull3D.cpp, geometry/tools/exampleRationalBallDelaunay3D.cpp, and geometry/tools/exampleRationalBallQuickHull3D.cpp.

Referenced by main().

◆ writeOBJ() [2/2]

template<typename TRealPoint , typename TRealVector >
static bool DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::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

Writes a surface mesh in the given OBJ file (and an associated MTL file) and associate color information.

Parameters
[in]objfilethe name of the OBJ file (like "bunny" or "bunny.obj").
[in]smeshthe surface mesh.
[in]diffuse_colorseither empty or a vector containing the diffuse color for each face.
[in]ambient_color,diffuse_color,specular_colorthe default color information for each face.

Field Documentation

◆ dimension

template<typename TRealPoint , typename TRealVector >
const Dimension DGtal::SurfaceMeshWriter< TRealPoint, TRealVector >::dimension = RealPoint::dimension
static

Definition at line 69 of file SurfaceMeshWriter.h.


The documentation for this struct was generated from the following file: