DGtalTools 2.0.0
Loading...
Searching...
No Matches
ofs2off.cpp
1
30#include <iostream>
31#include "DGtal/base/Common.h"
32
33#include "DGtal/io/readers/MeshReader.h"
34#include "DGtal/io/writers/MeshWriter.h"
35#include "DGtal/io/Display3D.h"
36#include "DGtal/shapes/Mesh.h"
37
38#include "CLI11.hpp"
39
40
41using namespace std;
42using namespace DGtal;
43
75int main( int argc, char** argv )
76{
77// parse command line using CLI ----------------------------------------------
78 CLI::App app;
79 std::string inputFileName;
80 std::string outputFileName {"result.off"};
81
82 app.description("Convert OFS file into OFF mesh format.");
83 app.add_option("-i,--input,1", inputFileName, "ofs file (.ofs)." )
84 ->required()
85 ->check(CLI::ExistingFile);
86 app.add_option("-o,--output,2", outputFileName, "ofs file (.off)");
87
88 app.get_formatter()->column_width(40);
89 CLI11_PARSE(app, argc, argv);
90 // END parse command line using CLI ----------------------------------------------
91
92 // We store the colors
93 Mesh<Z3i::RealPoint> anImportedMesh(true);
94 bool import = anImportedMesh << inputFileName;
95 bool exported = anImportedMesh >> outputFileName;
96 if(!import || !exported){
97 trace.info() << "Conversion failed: " << (exported? "Reading OFS failed. ": "Export OFF failed. ") << std::endl;
98 return 0;
99 }
100 trace.info() << "[done]. "<< std::endl;
101 return 0;
102}
Definition ATu0v1.h:57