DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
io/meshFromOFF.cpp

Example of OFF file importation and display.

See also:
Import 3D mesh from OFF file
visuTrefExample.png
Visualisation of the sample/tref.off file
#include "DGtal/base/Common.h"
#include "DGtal/io/Color.h"
#include "ConfigExamples.h"
#include "DGtal/io/readers/MeshReader.h"
#include <QtGui/qapplication.h>
#include "DGtal/io/Display3D.h"
#include "DGtal/io/viewers/Viewer3D.h"
using namespace std;
using namespace DGtal;
int main( int argc, char** argv )
{
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
std::string inputFilename = examplesPath + "samples/tref.off";
// Since the input points are not necessary integers we use the PointD3D from Display3D.
anImportedMesh << inputFilename;
trace.info()<< "importating done..."<< endl;
anImportedMesh.invertVertexFaceOrder();
viewer.setLineColor(DGtal::Color(150,0,0,254));
viewer << anImportedMesh;
viewer << Viewer3D::updateDisplay;
return application.exec();
}