DGtal  1.2.0
Static Public Member Functions
DGtal::MeshReader< TPoint > Struct Template Reference

Aim: Defined to import OFF and OFS surface mesh. It allows to import a Mesh object and takes into accouts the optional color faces. More...

#include <DGtal/io/readers/MeshReader.h>

Static Public Member Functions

static bool importOFFFile (const std::string &filename, DGtal::Mesh< TPoint > &aMesh, bool invertVertexOrder=false)
 
static bool importOFSFile (const std::string &filename, DGtal::Mesh< TPoint > &aMesh, bool invertVertexOrder=false, double scale=1.0)
 

Detailed Description

template<typename TPoint>
struct DGtal::MeshReader< TPoint >

Aim: Defined to import OFF and OFS surface mesh. It allows to import a Mesh object and takes into accouts the optional color faces.

Description of class 'MeshReader'

The importation can be done automatically according the input file extension with the operator <<

Example of typical use: Add these include files:

#include "DGtal/shapes/Mesh.h"
#include "DGtal/io/readers/MeshReader.h"

And automatic import the Mesh through the filename extension:

std::string filenameOFF = testPath + "samples/box.off";
Mesh<Point> a3DMesh;
bool importOK = a3DMesh << filenameOFF;

Then you can also display the resulting with a Viewer3D:

viewer.setLineColor(DGtal::Color(150,0,0,254));
viewer << a3DMesh;
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
See also
Mesh MeshWriter

Definition at line 96 of file MeshReader.h.

Member Function Documentation

◆ importOFFFile()

template<typename TPoint >
static bool DGtal::MeshReader< TPoint >::importOFFFile ( const std::string &  filename,
DGtal::Mesh< TPoint > &  aMesh,
bool  invertVertexOrder = false 
)
static

Main method to import OFF meshes file (Geomview Object File Format)

Parameters
filenamethe file name to import.
aMesh(return) the mesh object to be imported.
invertVertexOrderused to invert (default value=false) the order of imported points (important for normal orientation).
Returns
an instance of the imported mesh: MeshFromPoint.

Referenced by TEST_CASE().

◆ importOFSFile()

template<typename TPoint >
static bool DGtal::MeshReader< TPoint >::importOFSFile ( const std::string &  filename,
DGtal::Mesh< TPoint > &  aMesh,
bool  invertVertexOrder = false,
double  scale = 1.0 
)
static

Main method to import OFS meshes file (an equivalent of OFF format)

Parameters
filenamethe file name to import.
aMesh(return) the mesh object to be imported.
invertVertexOrderused to invert (default value=false) the order of imported points (important for normal orientation).
scaleused to avoid to display tiny shapes (since OFS shapes are generally included in a 1x1x1 cube)
Returns
an instance of the imported mesh: MeshFromPoint.

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